rulesync 2.2.0 → 3.1.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.
package/dist/index.js CHANGED
@@ -72,7 +72,7 @@ var logger = new Logger();
72
72
  import { intersection } from "es-toolkit";
73
73
 
74
74
  // src/commands/commands-processor.ts
75
- import { basename as basename10, join as join10 } from "path";
75
+ import { basename as basename11, join as join11 } from "path";
76
76
  import { z as z8 } from "zod/mini";
77
77
 
78
78
  // src/utils/file.ts
@@ -187,9 +187,8 @@ var FeatureProcessor = class {
187
187
  }
188
188
  };
189
189
 
190
- // src/commands/claudecode-command.ts
190
+ // src/commands/agentsmd-command.ts
191
191
  import { basename as basename3, join as join3 } from "path";
192
- import { z as z4 } from "zod/mini";
193
192
 
194
193
  // src/utils/frontmatter.ts
195
194
  import matter from "gray-matter";
@@ -240,9 +239,9 @@ function parseFrontmatter(content) {
240
239
  return { frontmatter, body };
241
240
  }
242
241
 
243
- // src/commands/rulesync-command.ts
242
+ // src/commands/simulated-command.ts
244
243
  import { basename as basename2, join as join2 } from "path";
245
- import { z as z3 } from "zod/mini";
244
+ import { z as z2 } from "zod/mini";
246
245
 
247
246
  // src/types/ai-file.ts
248
247
  import path, { relative as relative2, resolve as resolve2 } from "path";
@@ -322,109 +321,6 @@ var AiFile = class {
322
321
  }
323
322
  };
324
323
 
325
- // src/types/rulesync-file.ts
326
- var RulesyncFile = class extends AiFile {
327
- static async fromFile(_params) {
328
- throw new Error("Please implement this method in the subclass.");
329
- }
330
- static async fromFileLegacy(_params) {
331
- throw new Error("Please implement this method in the subclass.");
332
- }
333
- };
334
-
335
- // src/types/tool-targets.ts
336
- import { z as z2 } from "zod/mini";
337
- var ALL_TOOL_TARGETS = [
338
- "agentsmd",
339
- "amazonqcli",
340
- "augmentcode",
341
- "augmentcode-legacy",
342
- "copilot",
343
- "cursor",
344
- "cline",
345
- "claudecode",
346
- "codexcli",
347
- "opencode",
348
- "qwencode",
349
- "roo",
350
- "geminicli",
351
- "kiro",
352
- "junie",
353
- "warp",
354
- "windsurf"
355
- ];
356
- var ALL_TOOL_TARGETS_WITH_WILDCARD = [...ALL_TOOL_TARGETS, "*"];
357
- var ToolTargetSchema = z2.enum(ALL_TOOL_TARGETS);
358
- var ToolTargetsSchema = z2.array(ToolTargetSchema);
359
- var RulesyncTargetsSchema = z2.array(z2.enum(ALL_TOOL_TARGETS_WITH_WILDCARD));
360
-
361
- // src/commands/rulesync-command.ts
362
- var RulesyncCommandFrontmatterSchema = z3.object({
363
- targets: RulesyncTargetsSchema,
364
- description: z3.string()
365
- });
366
- var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
367
- frontmatter;
368
- body;
369
- constructor({ frontmatter, body, ...rest }) {
370
- if (rest.validate) {
371
- const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
372
- if (!result.success) {
373
- throw result.error;
374
- }
375
- }
376
- super({
377
- ...rest,
378
- fileContent: stringifyFrontmatter(body, frontmatter)
379
- });
380
- this.frontmatter = frontmatter;
381
- this.body = body;
382
- }
383
- static getSettablePaths() {
384
- return {
385
- relativeDirPath: ".rulesync/commands"
386
- };
387
- }
388
- getFrontmatter() {
389
- return this.frontmatter;
390
- }
391
- getBody() {
392
- return this.body;
393
- }
394
- validate() {
395
- if (!this.frontmatter) {
396
- return { success: true, error: null };
397
- }
398
- const result = RulesyncCommandFrontmatterSchema.safeParse(this.frontmatter);
399
- if (result.success) {
400
- return { success: true, error: null };
401
- } else {
402
- return { success: false, error: result.error };
403
- }
404
- }
405
- static async fromFile({
406
- relativeFilePath
407
- }) {
408
- const fileContent = await readFileContent(
409
- join2(_RulesyncCommand.getSettablePaths().relativeDirPath, relativeFilePath)
410
- );
411
- const { frontmatter, body: content } = parseFrontmatter(fileContent);
412
- const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
413
- if (!result.success) {
414
- throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${result.error.message}`);
415
- }
416
- const filename = basename2(relativeFilePath);
417
- return new _RulesyncCommand({
418
- baseDir: ".",
419
- relativeDirPath: _RulesyncCommand.getSettablePaths().relativeDirPath,
420
- relativeFilePath: filename,
421
- frontmatter: result.data,
422
- body: content.trim(),
423
- fileContent
424
- });
425
- }
426
- };
427
-
428
324
  // src/commands/tool-command.ts
429
325
  var ToolCommand = class extends AiFile {
430
326
  static getSettablePaths() {
@@ -495,16 +391,16 @@ var ToolCommand = class extends AiFile {
495
391
  }
496
392
  };
497
393
 
498
- // src/commands/claudecode-command.ts
499
- var ClaudecodeCommandFrontmatterSchema = z4.object({
500
- description: z4.string()
394
+ // src/commands/simulated-command.ts
395
+ var SimulatedCommandFrontmatterSchema = z2.object({
396
+ description: z2.string()
501
397
  });
502
- var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
398
+ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
503
399
  frontmatter;
504
400
  body;
505
401
  constructor({ frontmatter, body, ...rest }) {
506
402
  if (rest.validate) {
507
- const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
403
+ const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
508
404
  if (!result.success) {
509
405
  throw result.error;
510
406
  }
@@ -516,16 +412,6 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
516
412
  this.frontmatter = frontmatter;
517
413
  this.body = body;
518
414
  }
519
- static getSettablePaths() {
520
- return {
521
- relativeDirPath: ".claude/commands"
522
- };
523
- }
524
- static getSettablePathsGlobal() {
525
- return {
526
- relativeDirPath: join3(".claude", "commands")
527
- };
528
- }
529
415
  getBody() {
530
416
  return this.body;
531
417
  }
@@ -533,100 +419,235 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
533
419
  return this.frontmatter;
534
420
  }
535
421
  toRulesyncCommand() {
536
- const rulesyncFrontmatter = {
537
- targets: ["*"],
538
- description: this.frontmatter.description
539
- };
540
- const fileContent = stringifyFrontmatter(this.body, rulesyncFrontmatter);
541
- return new RulesyncCommand({
542
- baseDir: ".",
543
- // RulesyncCommand baseDir is always the project root directory
544
- frontmatter: rulesyncFrontmatter,
545
- body: this.body,
546
- relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
547
- relativeFilePath: this.relativeFilePath,
548
- fileContent,
549
- validate: true
550
- });
422
+ throw new Error("Not implemented because it is a SIMULATED file.");
551
423
  }
552
- static fromRulesyncCommand({
424
+ static fromRulesyncCommandDefault({
553
425
  baseDir = ".",
554
426
  rulesyncCommand,
555
- validate = true,
556
- global = false
427
+ validate = true
557
428
  }) {
558
429
  const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
559
430
  const claudecodeFrontmatter = {
560
431
  description: rulesyncFrontmatter.description
561
432
  };
562
433
  const body = rulesyncCommand.getBody();
563
- const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
564
- return new _ClaudecodeCommand({
434
+ return {
565
435
  baseDir,
566
436
  frontmatter: claudecodeFrontmatter,
567
437
  body,
568
- relativeDirPath: paths.relativeDirPath,
438
+ relativeDirPath: this.getSettablePaths().relativeDirPath,
569
439
  relativeFilePath: rulesyncCommand.getRelativeFilePath(),
570
440
  validate
571
- });
441
+ };
572
442
  }
573
443
  validate() {
574
444
  if (!this.frontmatter) {
575
445
  return { success: true, error: null };
576
446
  }
577
- const result = ClaudecodeCommandFrontmatterSchema.safeParse(this.frontmatter);
447
+ const result = SimulatedCommandFrontmatterSchema.safeParse(this.frontmatter);
578
448
  if (result.success) {
579
449
  return { success: true, error: null };
580
450
  } else {
581
451
  return { success: false, error: result.error };
582
452
  }
583
453
  }
584
- static isTargetedByRulesyncCommand(rulesyncCommand) {
585
- return this.isTargetedByRulesyncCommandDefault({
586
- rulesyncCommand,
587
- toolTarget: "claudecode"
588
- });
454
+ static async fromFileDefault({
455
+ baseDir = ".",
456
+ relativeFilePath,
457
+ validate = true
458
+ }) {
459
+ const filePath = join2(
460
+ baseDir,
461
+ _SimulatedCommand.getSettablePaths().relativeDirPath,
462
+ relativeFilePath
463
+ );
464
+ const fileContent = await readFileContent(filePath);
465
+ const { frontmatter, body: content } = parseFrontmatter(fileContent);
466
+ const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
467
+ if (!result.success) {
468
+ throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
469
+ }
470
+ return {
471
+ baseDir,
472
+ relativeDirPath: _SimulatedCommand.getSettablePaths().relativeDirPath,
473
+ relativeFilePath: basename2(relativeFilePath),
474
+ frontmatter: result.data,
475
+ body: content.trim(),
476
+ validate
477
+ };
478
+ }
479
+ };
480
+
481
+ // src/commands/agentsmd-command.ts
482
+ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
483
+ static getSettablePaths() {
484
+ return {
485
+ relativeDirPath: ".agents/commands"
486
+ };
487
+ }
488
+ static fromRulesyncCommand({
489
+ baseDir = ".",
490
+ rulesyncCommand,
491
+ validate = true
492
+ }) {
493
+ return new _AgentsmdCommand(
494
+ this.fromRulesyncCommandDefault({ baseDir, rulesyncCommand, validate })
495
+ );
589
496
  }
590
497
  static async fromFile({
591
498
  baseDir = ".",
592
499
  relativeFilePath,
593
- validate = true,
594
- global = false
500
+ validate = true
595
501
  }) {
596
- const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
597
- const filePath = join3(baseDir, paths.relativeDirPath, relativeFilePath);
502
+ const filePath = join3(
503
+ baseDir,
504
+ _AgentsmdCommand.getSettablePaths().relativeDirPath,
505
+ relativeFilePath
506
+ );
598
507
  const fileContent = await readFileContent(filePath);
599
508
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
600
- const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
509
+ const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
601
510
  if (!result.success) {
602
511
  throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
603
512
  }
604
- return new _ClaudecodeCommand({
513
+ return new _AgentsmdCommand({
605
514
  baseDir,
606
- relativeDirPath: paths.relativeDirPath,
515
+ relativeDirPath: _AgentsmdCommand.getSettablePaths().relativeDirPath,
607
516
  relativeFilePath: basename3(relativeFilePath),
608
517
  frontmatter: result.data,
609
518
  body: content.trim(),
610
519
  validate
611
520
  });
612
521
  }
522
+ static isTargetedByRulesyncCommand(rulesyncCommand) {
523
+ return this.isTargetedByRulesyncCommandDefault({
524
+ rulesyncCommand,
525
+ toolTarget: "agentsmd"
526
+ });
527
+ }
613
528
  };
614
529
 
615
- // src/commands/codexcli-command.ts
530
+ // src/commands/claudecode-command.ts
616
531
  import { basename as basename5, join as join5 } from "path";
532
+ import { z as z5 } from "zod/mini";
617
533
 
618
- // src/commands/simulated-command.ts
534
+ // src/commands/rulesync-command.ts
619
535
  import { basename as basename4, join as join4 } from "path";
620
- import { z as z5 } from "zod/mini";
621
- var SimulatedCommandFrontmatterSchema = z5.object({
536
+ import { z as z4 } from "zod/mini";
537
+
538
+ // src/types/rulesync-file.ts
539
+ var RulesyncFile = class extends AiFile {
540
+ static async fromFile(_params) {
541
+ throw new Error("Please implement this method in the subclass.");
542
+ }
543
+ static async fromFileLegacy(_params) {
544
+ throw new Error("Please implement this method in the subclass.");
545
+ }
546
+ };
547
+
548
+ // src/types/tool-targets.ts
549
+ import { z as z3 } from "zod/mini";
550
+ var ALL_TOOL_TARGETS = [
551
+ "agentsmd",
552
+ "amazonqcli",
553
+ "augmentcode",
554
+ "augmentcode-legacy",
555
+ "copilot",
556
+ "cursor",
557
+ "cline",
558
+ "claudecode",
559
+ "codexcli",
560
+ "opencode",
561
+ "qwencode",
562
+ "roo",
563
+ "geminicli",
564
+ "kiro",
565
+ "junie",
566
+ "warp",
567
+ "windsurf"
568
+ ];
569
+ var ALL_TOOL_TARGETS_WITH_WILDCARD = [...ALL_TOOL_TARGETS, "*"];
570
+ var ToolTargetSchema = z3.enum(ALL_TOOL_TARGETS);
571
+ var ToolTargetsSchema = z3.array(ToolTargetSchema);
572
+ var RulesyncTargetsSchema = z3.array(z3.enum(ALL_TOOL_TARGETS_WITH_WILDCARD));
573
+
574
+ // src/commands/rulesync-command.ts
575
+ var RulesyncCommandFrontmatterSchema = z4.object({
576
+ targets: RulesyncTargetsSchema,
577
+ description: z4.string()
578
+ });
579
+ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
580
+ frontmatter;
581
+ body;
582
+ constructor({ frontmatter, body, ...rest }) {
583
+ if (rest.validate) {
584
+ const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
585
+ if (!result.success) {
586
+ throw result.error;
587
+ }
588
+ }
589
+ super({
590
+ ...rest,
591
+ fileContent: stringifyFrontmatter(body, frontmatter)
592
+ });
593
+ this.frontmatter = frontmatter;
594
+ this.body = body;
595
+ }
596
+ static getSettablePaths() {
597
+ return {
598
+ relativeDirPath: ".rulesync/commands"
599
+ };
600
+ }
601
+ getFrontmatter() {
602
+ return this.frontmatter;
603
+ }
604
+ getBody() {
605
+ return this.body;
606
+ }
607
+ validate() {
608
+ if (!this.frontmatter) {
609
+ return { success: true, error: null };
610
+ }
611
+ const result = RulesyncCommandFrontmatterSchema.safeParse(this.frontmatter);
612
+ if (result.success) {
613
+ return { success: true, error: null };
614
+ } else {
615
+ return { success: false, error: result.error };
616
+ }
617
+ }
618
+ static async fromFile({
619
+ relativeFilePath
620
+ }) {
621
+ const fileContent = await readFileContent(
622
+ join4(_RulesyncCommand.getSettablePaths().relativeDirPath, relativeFilePath)
623
+ );
624
+ const { frontmatter, body: content } = parseFrontmatter(fileContent);
625
+ const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
626
+ if (!result.success) {
627
+ throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${result.error.message}`);
628
+ }
629
+ const filename = basename4(relativeFilePath);
630
+ return new _RulesyncCommand({
631
+ baseDir: ".",
632
+ relativeDirPath: _RulesyncCommand.getSettablePaths().relativeDirPath,
633
+ relativeFilePath: filename,
634
+ frontmatter: result.data,
635
+ body: content.trim(),
636
+ fileContent
637
+ });
638
+ }
639
+ };
640
+
641
+ // src/commands/claudecode-command.ts
642
+ var ClaudecodeCommandFrontmatterSchema = z5.object({
622
643
  description: z5.string()
623
644
  });
624
- var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
645
+ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
625
646
  frontmatter;
626
647
  body;
627
648
  constructor({ frontmatter, body, ...rest }) {
628
649
  if (rest.validate) {
629
- const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
650
+ const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
630
651
  if (!result.success) {
631
652
  throw result.error;
632
653
  }
@@ -638,6 +659,16 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
638
659
  this.frontmatter = frontmatter;
639
660
  this.body = body;
640
661
  }
662
+ static getSettablePaths() {
663
+ return {
664
+ relativeDirPath: ".claude/commands"
665
+ };
666
+ }
667
+ static getSettablePathsGlobal() {
668
+ return {
669
+ relativeDirPath: join5(".claude", "commands")
670
+ };
671
+ }
641
672
  getBody() {
642
673
  return this.body;
643
674
  }
@@ -645,116 +676,161 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
645
676
  return this.frontmatter;
646
677
  }
647
678
  toRulesyncCommand() {
648
- throw new Error("Not implemented because it is a SIMULATED file.");
679
+ const rulesyncFrontmatter = {
680
+ targets: ["*"],
681
+ description: this.frontmatter.description
682
+ };
683
+ const fileContent = stringifyFrontmatter(this.body, rulesyncFrontmatter);
684
+ return new RulesyncCommand({
685
+ baseDir: ".",
686
+ // RulesyncCommand baseDir is always the project root directory
687
+ frontmatter: rulesyncFrontmatter,
688
+ body: this.body,
689
+ relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
690
+ relativeFilePath: this.relativeFilePath,
691
+ fileContent,
692
+ validate: true
693
+ });
649
694
  }
650
- static fromRulesyncCommandDefault({
695
+ static fromRulesyncCommand({
651
696
  baseDir = ".",
652
697
  rulesyncCommand,
653
- validate = true
698
+ validate = true,
699
+ global = false
654
700
  }) {
655
701
  const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
656
702
  const claudecodeFrontmatter = {
657
703
  description: rulesyncFrontmatter.description
658
704
  };
659
705
  const body = rulesyncCommand.getBody();
660
- return {
706
+ const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
707
+ return new _ClaudecodeCommand({
661
708
  baseDir,
662
709
  frontmatter: claudecodeFrontmatter,
663
710
  body,
664
- relativeDirPath: this.getSettablePaths().relativeDirPath,
711
+ relativeDirPath: paths.relativeDirPath,
665
712
  relativeFilePath: rulesyncCommand.getRelativeFilePath(),
666
713
  validate
667
- };
714
+ });
668
715
  }
669
716
  validate() {
670
717
  if (!this.frontmatter) {
671
718
  return { success: true, error: null };
672
719
  }
673
- const result = SimulatedCommandFrontmatterSchema.safeParse(this.frontmatter);
720
+ const result = ClaudecodeCommandFrontmatterSchema.safeParse(this.frontmatter);
674
721
  if (result.success) {
675
722
  return { success: true, error: null };
676
723
  } else {
677
724
  return { success: false, error: result.error };
678
725
  }
679
726
  }
680
- static async fromFileDefault({
727
+ static isTargetedByRulesyncCommand(rulesyncCommand) {
728
+ return this.isTargetedByRulesyncCommandDefault({
729
+ rulesyncCommand,
730
+ toolTarget: "claudecode"
731
+ });
732
+ }
733
+ static async fromFile({
681
734
  baseDir = ".",
682
735
  relativeFilePath,
683
- validate = true
736
+ validate = true,
737
+ global = false
684
738
  }) {
685
- const filePath = join4(
686
- baseDir,
687
- _SimulatedCommand.getSettablePaths().relativeDirPath,
688
- relativeFilePath
689
- );
739
+ const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
740
+ const filePath = join5(baseDir, paths.relativeDirPath, relativeFilePath);
690
741
  const fileContent = await readFileContent(filePath);
691
742
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
692
- const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
743
+ const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
693
744
  if (!result.success) {
694
745
  throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
695
746
  }
696
- return {
747
+ return new _ClaudecodeCommand({
697
748
  baseDir,
698
- relativeDirPath: _SimulatedCommand.getSettablePaths().relativeDirPath,
699
- relativeFilePath: basename4(relativeFilePath),
749
+ relativeDirPath: paths.relativeDirPath,
750
+ relativeFilePath: basename5(relativeFilePath),
700
751
  frontmatter: result.data,
701
752
  body: content.trim(),
702
753
  validate
703
- };
754
+ });
704
755
  }
705
756
  };
706
757
 
707
758
  // src/commands/codexcli-command.ts
708
- var CodexCliCommand = class _CodexCliCommand extends SimulatedCommand {
759
+ import { basename as basename6, join as join6 } from "path";
760
+ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
709
761
  static getSettablePaths() {
762
+ throw new Error("getSettablePaths is not supported for CodexcliCommand");
763
+ }
764
+ static getSettablePathsGlobal() {
710
765
  return {
711
- relativeDirPath: ".codex/commands"
766
+ relativeDirPath: join6(".codex", "prompts")
767
+ };
768
+ }
769
+ toRulesyncCommand() {
770
+ const rulesyncFrontmatter = {
771
+ targets: ["*"],
772
+ description: ""
712
773
  };
774
+ return new RulesyncCommand({
775
+ baseDir: ".",
776
+ // RulesyncCommand baseDir is always the project root directory
777
+ frontmatter: rulesyncFrontmatter,
778
+ body: this.getFileContent(),
779
+ relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
780
+ relativeFilePath: this.relativeFilePath,
781
+ fileContent: this.getFileContent(),
782
+ validate: true
783
+ });
713
784
  }
714
785
  static fromRulesyncCommand({
715
786
  baseDir = ".",
716
787
  rulesyncCommand,
717
- validate = true
718
- }) {
719
- return new _CodexCliCommand(
720
- this.fromRulesyncCommandDefault({ baseDir, rulesyncCommand, validate })
721
- );
722
- }
723
- static async fromFile({
724
- baseDir = ".",
725
- relativeFilePath,
726
- validate = true
788
+ validate = true,
789
+ global = false
727
790
  }) {
728
- const filePath = join5(
729
- baseDir,
730
- _CodexCliCommand.getSettablePaths().relativeDirPath,
731
- relativeFilePath
732
- );
733
- const fileContent = await readFileContent(filePath);
734
- const { frontmatter, body: content } = parseFrontmatter(fileContent);
735
- const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
736
- if (!result.success) {
737
- throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
738
- }
739
- return new _CodexCliCommand({
791
+ const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
792
+ return new _CodexcliCommand({
740
793
  baseDir,
741
- relativeDirPath: _CodexCliCommand.getSettablePaths().relativeDirPath,
742
- relativeFilePath: basename5(relativeFilePath),
743
- frontmatter: result.data,
744
- body: content.trim(),
794
+ fileContent: rulesyncCommand.getBody(),
795
+ relativeDirPath: paths.relativeDirPath,
796
+ relativeFilePath: rulesyncCommand.getRelativeFilePath(),
745
797
  validate
746
798
  });
747
799
  }
800
+ validate() {
801
+ return { success: true, error: null };
802
+ }
803
+ getBody() {
804
+ return this.getFileContent();
805
+ }
748
806
  static isTargetedByRulesyncCommand(rulesyncCommand) {
749
807
  return this.isTargetedByRulesyncCommandDefault({
750
808
  rulesyncCommand,
751
809
  toolTarget: "codexcli"
752
810
  });
753
811
  }
812
+ static async fromFile({
813
+ baseDir = ".",
814
+ relativeFilePath,
815
+ validate = true,
816
+ global = false
817
+ }) {
818
+ const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
819
+ const filePath = join6(baseDir, paths.relativeDirPath, relativeFilePath);
820
+ const fileContent = await readFileContent(filePath);
821
+ const { body: content } = parseFrontmatter(fileContent);
822
+ return new _CodexcliCommand({
823
+ baseDir,
824
+ relativeDirPath: paths.relativeDirPath,
825
+ relativeFilePath: basename6(relativeFilePath),
826
+ fileContent: content.trim(),
827
+ validate
828
+ });
829
+ }
754
830
  };
755
831
 
756
832
  // src/commands/copilot-command.ts
757
- import { basename as basename6, join as join6 } from "path";
833
+ import { basename as basename7, join as join7 } from "path";
758
834
  var CopilotCommand = class _CopilotCommand extends SimulatedCommand {
759
835
  static getSettablePaths() {
760
836
  return {
@@ -775,7 +851,7 @@ var CopilotCommand = class _CopilotCommand extends SimulatedCommand {
775
851
  relativeFilePath,
776
852
  validate = true
777
853
  }) {
778
- const filePath = join6(
854
+ const filePath = join7(
779
855
  baseDir,
780
856
  _CopilotCommand.getSettablePaths().relativeDirPath,
781
857
  relativeFilePath
@@ -789,7 +865,7 @@ var CopilotCommand = class _CopilotCommand extends SimulatedCommand {
789
865
  return new _CopilotCommand({
790
866
  baseDir,
791
867
  relativeDirPath: _CopilotCommand.getSettablePaths().relativeDirPath,
792
- relativeFilePath: basename6(relativeFilePath),
868
+ relativeFilePath: basename7(relativeFilePath),
793
869
  frontmatter: result.data,
794
870
  body: content.trim(),
795
871
  validate
@@ -804,16 +880,16 @@ var CopilotCommand = class _CopilotCommand extends SimulatedCommand {
804
880
  };
805
881
 
806
882
  // src/commands/cursor-command.ts
807
- import { basename as basename7, join as join7 } from "path";
883
+ import { basename as basename8, join as join8 } from "path";
808
884
  var CursorCommand = class _CursorCommand extends ToolCommand {
809
885
  static getSettablePaths() {
810
886
  return {
811
- relativeDirPath: join7(".cursor", "commands")
887
+ relativeDirPath: join8(".cursor", "commands")
812
888
  };
813
889
  }
814
890
  static getSettablePathsGlobal() {
815
891
  return {
816
- relativeDirPath: join7(".cursor", "commands")
892
+ relativeDirPath: join8(".cursor", "commands")
817
893
  };
818
894
  }
819
895
  toRulesyncCommand() {
@@ -866,13 +942,13 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
866
942
  global = false
867
943
  }) {
868
944
  const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
869
- const filePath = join7(baseDir, paths.relativeDirPath, relativeFilePath);
945
+ const filePath = join8(baseDir, paths.relativeDirPath, relativeFilePath);
870
946
  const fileContent = await readFileContent(filePath);
871
947
  const { body: content } = parseFrontmatter(fileContent);
872
948
  return new _CursorCommand({
873
949
  baseDir,
874
950
  relativeDirPath: paths.relativeDirPath,
875
- relativeFilePath: basename7(relativeFilePath),
951
+ relativeFilePath: basename8(relativeFilePath),
876
952
  fileContent: content.trim(),
877
953
  validate
878
954
  });
@@ -880,7 +956,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
880
956
  };
881
957
 
882
958
  // src/commands/geminicli-command.ts
883
- import { basename as basename8, join as join8 } from "path";
959
+ import { basename as basename9, join as join9 } from "path";
884
960
  import { parse as parseToml } from "smol-toml";
885
961
  import { z as z6 } from "zod/mini";
886
962
  var GeminiCliCommandFrontmatterSchema = z6.object({
@@ -903,7 +979,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
903
979
  }
904
980
  static getSettablePathsGlobal() {
905
981
  return {
906
- relativeDirPath: join8(".gemini", "commands")
982
+ relativeDirPath: join9(".gemini", "commands")
907
983
  };
908
984
  }
909
985
  parseTomlContent(content) {
@@ -975,12 +1051,12 @@ ${geminiFrontmatter.prompt}
975
1051
  global = false
976
1052
  }) {
977
1053
  const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
978
- const filePath = join8(baseDir, paths.relativeDirPath, relativeFilePath);
1054
+ const filePath = join9(baseDir, paths.relativeDirPath, relativeFilePath);
979
1055
  const fileContent = await readFileContent(filePath);
980
1056
  return new _GeminiCliCommand({
981
1057
  baseDir,
982
1058
  relativeDirPath: paths.relativeDirPath,
983
- relativeFilePath: basename8(relativeFilePath),
1059
+ relativeFilePath: basename9(relativeFilePath),
984
1060
  fileContent,
985
1061
  validate
986
1062
  });
@@ -1002,7 +1078,7 @@ ${geminiFrontmatter.prompt}
1002
1078
  };
1003
1079
 
1004
1080
  // src/commands/roo-command.ts
1005
- import { basename as basename9, join as join9 } from "path";
1081
+ import { basename as basename10, join as join10 } from "path";
1006
1082
  import { optional, z as z7 } from "zod/mini";
1007
1083
  var RooCommandFrontmatterSchema = z7.object({
1008
1084
  description: z7.string(),
@@ -1096,7 +1172,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
1096
1172
  relativeFilePath,
1097
1173
  validate = true
1098
1174
  }) {
1099
- const filePath = join9(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
1175
+ const filePath = join10(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
1100
1176
  const fileContent = await readFileContent(filePath);
1101
1177
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
1102
1178
  const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
@@ -1106,7 +1182,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
1106
1182
  return new _RooCommand({
1107
1183
  baseDir,
1108
1184
  relativeDirPath: _RooCommand.getSettablePaths().relativeDirPath,
1109
- relativeFilePath: basename9(relativeFilePath),
1185
+ relativeFilePath: basename10(relativeFilePath),
1110
1186
  frontmatter: result.data,
1111
1187
  body: content.trim(),
1112
1188
  fileContent,
@@ -1117,15 +1193,24 @@ var RooCommand = class _RooCommand extends ToolCommand {
1117
1193
 
1118
1194
  // src/commands/commands-processor.ts
1119
1195
  var commandsProcessorToolTargets = [
1196
+ "agentsmd",
1120
1197
  "claudecode",
1121
1198
  "geminicli",
1122
1199
  "roo",
1123
1200
  "copilot",
1201
+ "cursor"
1202
+ ];
1203
+ var CommandsProcessorToolTargetSchema = z8.enum(
1204
+ // codexcli is not in the list of tool targets but we add it here because it is a valid tool target for global mode generation
1205
+ commandsProcessorToolTargets.concat("codexcli")
1206
+ );
1207
+ var commandsProcessorToolTargetsSimulated = ["agentsmd", "copilot"];
1208
+ var commandsProcessorToolTargetsGlobal = [
1209
+ "claudecode",
1124
1210
  "cursor",
1211
+ "geminicli",
1125
1212
  "codexcli"
1126
1213
  ];
1127
- var CommandsProcessorToolTargetSchema = z8.enum(commandsProcessorToolTargets);
1128
- var commandsProcessorToolTargetsSimulated = ["copilot", "codexcli"];
1129
1214
  var CommandsProcessor = class extends FeatureProcessor {
1130
1215
  toolTarget;
1131
1216
  global;
@@ -1144,6 +1229,14 @@ var CommandsProcessor = class extends FeatureProcessor {
1144
1229
  );
1145
1230
  const toolCommands = rulesyncCommands.map((rulesyncCommand) => {
1146
1231
  switch (this.toolTarget) {
1232
+ case "agentsmd":
1233
+ if (!AgentsmdCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
1234
+ return null;
1235
+ }
1236
+ return AgentsmdCommand.fromRulesyncCommand({
1237
+ baseDir: this.baseDir,
1238
+ rulesyncCommand
1239
+ });
1147
1240
  case "claudecode":
1148
1241
  if (!ClaudecodeCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
1149
1242
  return null;
@@ -1188,12 +1281,13 @@ var CommandsProcessor = class extends FeatureProcessor {
1188
1281
  global: this.global
1189
1282
  });
1190
1283
  case "codexcli":
1191
- if (!CodexCliCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
1284
+ if (!CodexcliCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
1192
1285
  return null;
1193
1286
  }
1194
- return CodexCliCommand.fromRulesyncCommand({
1287
+ return CodexcliCommand.fromRulesyncCommand({
1195
1288
  baseDir: this.baseDir,
1196
- rulesyncCommand
1289
+ rulesyncCommand,
1290
+ global: this.global
1197
1291
  });
1198
1292
  default:
1199
1293
  throw new Error(`Unsupported tool target: ${this.toolTarget}`);
@@ -1218,11 +1312,11 @@ var CommandsProcessor = class extends FeatureProcessor {
1218
1312
  */
1219
1313
  async loadRulesyncFiles() {
1220
1314
  const rulesyncCommandPaths = await findFilesByGlobs(
1221
- join10(RulesyncCommand.getSettablePaths().relativeDirPath, "*.md")
1315
+ join11(RulesyncCommand.getSettablePaths().relativeDirPath, "*.md")
1222
1316
  );
1223
1317
  const rulesyncCommands = (await Promise.allSettled(
1224
1318
  rulesyncCommandPaths.map(
1225
- (path2) => RulesyncCommand.fromFile({ relativeFilePath: basename10(path2) })
1319
+ (path2) => RulesyncCommand.fromFile({ relativeFilePath: basename11(path2) })
1226
1320
  )
1227
1321
  )).filter((result) => result.status === "fulfilled").map((result) => result.value);
1228
1322
  logger.info(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
@@ -1234,6 +1328,8 @@ var CommandsProcessor = class extends FeatureProcessor {
1234
1328
  */
1235
1329
  async loadToolFiles() {
1236
1330
  switch (this.toolTarget) {
1331
+ case "agentsmd":
1332
+ return await this.loadAgentsmdCommands();
1237
1333
  case "claudecode":
1238
1334
  return await this.loadClaudecodeCommands();
1239
1335
  case "geminicli":
@@ -1259,43 +1355,49 @@ var CommandsProcessor = class extends FeatureProcessor {
1259
1355
  extension
1260
1356
  }) {
1261
1357
  const commandFilePaths = await findFilesByGlobs(
1262
- join10(this.baseDir, relativeDirPath, `*.${extension}`)
1358
+ join11(this.baseDir, relativeDirPath, `*.${extension}`)
1263
1359
  );
1264
1360
  const toolCommands = (await Promise.allSettled(
1265
1361
  commandFilePaths.map((path2) => {
1266
1362
  switch (toolTarget) {
1363
+ case "agentsmd":
1364
+ return AgentsmdCommand.fromFile({
1365
+ baseDir: this.baseDir,
1366
+ relativeFilePath: basename11(path2)
1367
+ });
1267
1368
  case "claudecode":
1268
1369
  return ClaudecodeCommand.fromFile({
1269
1370
  baseDir: this.baseDir,
1270
- relativeFilePath: basename10(path2),
1371
+ relativeFilePath: basename11(path2),
1271
1372
  global: this.global
1272
1373
  });
1273
1374
  case "geminicli":
1274
1375
  return GeminiCliCommand.fromFile({
1275
1376
  baseDir: this.baseDir,
1276
- relativeFilePath: basename10(path2),
1377
+ relativeFilePath: basename11(path2),
1277
1378
  global: this.global
1278
1379
  });
1279
1380
  case "roo":
1280
1381
  return RooCommand.fromFile({
1281
1382
  baseDir: this.baseDir,
1282
- relativeFilePath: basename10(path2)
1383
+ relativeFilePath: basename11(path2)
1283
1384
  });
1284
1385
  case "copilot":
1285
1386
  return CopilotCommand.fromFile({
1286
1387
  baseDir: this.baseDir,
1287
- relativeFilePath: basename10(path2)
1388
+ relativeFilePath: basename11(path2)
1288
1389
  });
1289
1390
  case "cursor":
1290
1391
  return CursorCommand.fromFile({
1291
1392
  baseDir: this.baseDir,
1292
- relativeFilePath: basename10(path2),
1393
+ relativeFilePath: basename11(path2),
1293
1394
  global: this.global
1294
1395
  });
1295
1396
  case "codexcli":
1296
- return CodexCliCommand.fromFile({
1397
+ return CodexcliCommand.fromFile({
1297
1398
  baseDir: this.baseDir,
1298
- relativeFilePath: basename10(path2)
1399
+ relativeFilePath: basename11(path2),
1400
+ global: this.global
1299
1401
  });
1300
1402
  default:
1301
1403
  throw new Error(`Unsupported tool target: ${toolTarget}`);
@@ -1306,7 +1408,17 @@ var CommandsProcessor = class extends FeatureProcessor {
1306
1408
  return toolCommands;
1307
1409
  }
1308
1410
  /**
1309
- * Load Claude Code command configurations from .claude/commands/ directory
1411
+ * Load Agents.md command configurations from .agents/commands/ directory
1412
+ */
1413
+ async loadAgentsmdCommands() {
1414
+ return await this.loadToolCommandDefault({
1415
+ toolTarget: "agentsmd",
1416
+ relativeDirPath: AgentsmdCommand.getSettablePaths().relativeDirPath,
1417
+ extension: "md"
1418
+ });
1419
+ }
1420
+ /**
1421
+ * Load Copilot command configurations from .github/commands/ directory
1310
1422
  */
1311
1423
  async loadCopilotCommands() {
1312
1424
  return await this.loadToolCommandDefault({
@@ -1349,12 +1461,13 @@ var CommandsProcessor = class extends FeatureProcessor {
1349
1461
  });
1350
1462
  }
1351
1463
  /**
1352
- * Load Roo Code command configurations from .roo/commands/ directory
1464
+ * Load Codex CLI command configurations from .codex/prompts/ directory
1353
1465
  */
1354
1466
  async loadCodexcliCommands() {
1467
+ const paths = this.global ? CodexcliCommand.getSettablePathsGlobal() : CodexcliCommand.getSettablePaths();
1355
1468
  return await this.loadToolCommandDefault({
1356
1469
  toolTarget: "codexcli",
1357
- relativeDirPath: CodexCliCommand.getSettablePaths().relativeDirPath,
1470
+ relativeDirPath: paths.relativeDirPath,
1358
1471
  extension: "md"
1359
1472
  });
1360
1473
  }
@@ -1386,12 +1499,12 @@ var CommandsProcessor = class extends FeatureProcessor {
1386
1499
  return commandsProcessorToolTargetsSimulated;
1387
1500
  }
1388
1501
  static getToolTargetsGlobal() {
1389
- return ["claudecode", "cursor", "geminicli"];
1502
+ return commandsProcessorToolTargetsGlobal;
1390
1503
  }
1391
1504
  };
1392
1505
 
1393
1506
  // src/config/config-resolver.ts
1394
- import { join as join11 } from "path";
1507
+ import { join as join12 } from "path";
1395
1508
  import { loadConfig } from "c12";
1396
1509
 
1397
1510
  // src/config/config.ts
@@ -1527,7 +1640,7 @@ function getBaseDirsInLightOfGlobal({
1527
1640
  global
1528
1641
  }) {
1529
1642
  if (isEnvTest) {
1530
- return baseDirs.map((baseDir) => join11(".", baseDir));
1643
+ return baseDirs.map((baseDir) => join12(".", baseDir));
1531
1644
  }
1532
1645
  if (global) {
1533
1646
  return [getHomeDirectory()];
@@ -1542,7 +1655,7 @@ function getBaseDirsInLightOfGlobal({
1542
1655
  import { z as z9 } from "zod/mini";
1543
1656
 
1544
1657
  // src/ignore/amazonqcli-ignore.ts
1545
- import { join as join12 } from "path";
1658
+ import { join as join13 } from "path";
1546
1659
 
1547
1660
  // src/types/tool-file.ts
1548
1661
  var ToolFile = class extends AiFile {
@@ -1650,7 +1763,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1650
1763
  validate = true
1651
1764
  }) {
1652
1765
  const fileContent = await readFileContent(
1653
- join12(
1766
+ join13(
1654
1767
  baseDir,
1655
1768
  this.getSettablePaths().relativeDirPath,
1656
1769
  this.getSettablePaths().relativeFilePath
@@ -1667,7 +1780,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1667
1780
  };
1668
1781
 
1669
1782
  // src/ignore/augmentcode-ignore.ts
1670
- import { join as join13 } from "path";
1783
+ import { join as join14 } from "path";
1671
1784
  var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
1672
1785
  static getSettablePaths() {
1673
1786
  return {
@@ -1705,7 +1818,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
1705
1818
  validate = true
1706
1819
  }) {
1707
1820
  const fileContent = await readFileContent(
1708
- join13(
1821
+ join14(
1709
1822
  baseDir,
1710
1823
  this.getSettablePaths().relativeDirPath,
1711
1824
  this.getSettablePaths().relativeFilePath
@@ -1722,7 +1835,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
1722
1835
  };
1723
1836
 
1724
1837
  // src/ignore/claudecode-ignore.ts
1725
- import { join as join14 } from "path";
1838
+ import { join as join15 } from "path";
1726
1839
  import { uniq } from "es-toolkit";
1727
1840
  var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
1728
1841
  constructor(params) {
@@ -1758,7 +1871,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
1758
1871
  const fileContent = rulesyncIgnore.getFileContent();
1759
1872
  const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
1760
1873
  const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
1761
- const filePath = join14(
1874
+ const filePath = join15(
1762
1875
  baseDir,
1763
1876
  this.getSettablePaths().relativeDirPath,
1764
1877
  this.getSettablePaths().relativeFilePath
@@ -1786,7 +1899,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
1786
1899
  validate = true
1787
1900
  }) {
1788
1901
  const fileContent = await readFileContent(
1789
- join14(
1902
+ join15(
1790
1903
  baseDir,
1791
1904
  this.getSettablePaths().relativeDirPath,
1792
1905
  this.getSettablePaths().relativeFilePath
@@ -1803,7 +1916,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
1803
1916
  };
1804
1917
 
1805
1918
  // src/ignore/cline-ignore.ts
1806
- import { join as join15 } from "path";
1919
+ import { join as join16 } from "path";
1807
1920
  var ClineIgnore = class _ClineIgnore extends ToolIgnore {
1808
1921
  static getSettablePaths() {
1809
1922
  return {
@@ -1835,53 +1948,6 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
1835
1948
  /**
1836
1949
  * Load ClineIgnore from .clineignore file
1837
1950
  */
1838
- static async fromFile({
1839
- baseDir = ".",
1840
- validate = true
1841
- }) {
1842
- const fileContent = await readFileContent(
1843
- join15(
1844
- baseDir,
1845
- this.getSettablePaths().relativeDirPath,
1846
- this.getSettablePaths().relativeFilePath
1847
- )
1848
- );
1849
- return new _ClineIgnore({
1850
- baseDir,
1851
- relativeDirPath: this.getSettablePaths().relativeDirPath,
1852
- relativeFilePath: this.getSettablePaths().relativeFilePath,
1853
- fileContent,
1854
- validate
1855
- });
1856
- }
1857
- };
1858
-
1859
- // src/ignore/codexcli-ignore.ts
1860
- import { join as join16 } from "path";
1861
- var CodexcliIgnore = class _CodexcliIgnore extends ToolIgnore {
1862
- static getSettablePaths() {
1863
- return {
1864
- relativeDirPath: ".",
1865
- relativeFilePath: ".codexignore"
1866
- };
1867
- }
1868
- toRulesyncIgnore() {
1869
- return this.toRulesyncIgnoreDefault();
1870
- }
1871
- static fromRulesyncIgnore({
1872
- baseDir = ".",
1873
- rulesyncIgnore
1874
- }) {
1875
- const fileContent = rulesyncIgnore.getFileContent();
1876
- return new _CodexcliIgnore({
1877
- baseDir,
1878
- relativeDirPath: this.getSettablePaths().relativeDirPath,
1879
- relativeFilePath: this.getSettablePaths().relativeFilePath,
1880
- fileContent,
1881
- validate: true
1882
- // Skip validation to allow empty patterns
1883
- });
1884
- }
1885
1951
  static async fromFile({
1886
1952
  baseDir = ".",
1887
1953
  validate = true
@@ -1893,7 +1959,7 @@ var CodexcliIgnore = class _CodexcliIgnore extends ToolIgnore {
1893
1959
  this.getSettablePaths().relativeFilePath
1894
1960
  )
1895
1961
  );
1896
- return new _CodexcliIgnore({
1962
+ return new _ClineIgnore({
1897
1963
  baseDir,
1898
1964
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1899
1965
  relativeFilePath: this.getSettablePaths().relativeFilePath,
@@ -2223,7 +2289,6 @@ var ignoreProcessorToolTargets = [
2223
2289
  "augmentcode",
2224
2290
  "claudecode",
2225
2291
  "cline",
2226
- "codexcli",
2227
2292
  "cursor",
2228
2293
  "geminicli",
2229
2294
  "junie",
@@ -2281,8 +2346,6 @@ var IgnoreProcessor = class extends FeatureProcessor {
2281
2346
  return [await ClaudecodeIgnore.fromFile({ baseDir: this.baseDir })];
2282
2347
  case "cline":
2283
2348
  return [await ClineIgnore.fromFile({ baseDir: this.baseDir })];
2284
- case "codexcli":
2285
- return [await CodexcliIgnore.fromFile({ baseDir: this.baseDir })];
2286
2349
  case "cursor":
2287
2350
  return [await CursorIgnore.fromFile({ baseDir: this.baseDir })];
2288
2351
  case "geminicli":
@@ -2340,11 +2403,6 @@ var IgnoreProcessor = class extends FeatureProcessor {
2340
2403
  baseDir: this.baseDir,
2341
2404
  rulesyncIgnore: rulesyncIgnore2
2342
2405
  });
2343
- case "codexcli":
2344
- return CodexcliIgnore.fromRulesyncIgnore({
2345
- baseDir: this.baseDir,
2346
- rulesyncIgnore: rulesyncIgnore2
2347
- });
2348
2406
  case "cursor":
2349
2407
  return CursorIgnore.fromRulesyncIgnore({
2350
2408
  baseDir: this.baseDir,
@@ -2995,12 +3053,12 @@ var McpProcessor = class extends FeatureProcessor {
2995
3053
  };
2996
3054
 
2997
3055
  // src/rules/rules-processor.ts
2998
- import { basename as basename16, join as join54 } from "path";
3056
+ import { basename as basename17, join as join54 } from "path";
2999
3057
  import { XMLBuilder } from "fast-xml-parser";
3000
3058
  import { z as z20 } from "zod/mini";
3001
3059
 
3002
3060
  // src/subagents/simulated-subagent.ts
3003
- import { basename as basename11, join as join31 } from "path";
3061
+ import { basename as basename12, join as join31 } from "path";
3004
3062
  import { z as z12 } from "zod/mini";
3005
3063
 
3006
3064
  // src/subagents/tool-subagent.ts
@@ -3112,7 +3170,7 @@ var SimulatedSubagent = class extends ToolSubagent {
3112
3170
  return {
3113
3171
  baseDir,
3114
3172
  relativeDirPath: this.getSettablePaths().relativeDirPath,
3115
- relativeFilePath: basename11(relativeFilePath),
3173
+ relativeFilePath: basename12(relativeFilePath),
3116
3174
  frontmatter: result.data,
3117
3175
  body: content.trim(),
3118
3176
  validate
@@ -3120,6 +3178,29 @@ var SimulatedSubagent = class extends ToolSubagent {
3120
3178
  }
3121
3179
  };
3122
3180
 
3181
+ // src/subagents/agentsmd-subagent.ts
3182
+ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
3183
+ static getSettablePaths() {
3184
+ return {
3185
+ relativeDirPath: ".agents/subagents"
3186
+ };
3187
+ }
3188
+ static async fromFile(params) {
3189
+ const baseParams = await this.fromFileDefault(params);
3190
+ return new _AgentsmdSubagent(baseParams);
3191
+ }
3192
+ static fromRulesyncSubagent(params) {
3193
+ const baseParams = this.fromRulesyncSubagentDefault(params);
3194
+ return new _AgentsmdSubagent(baseParams);
3195
+ }
3196
+ static isTargetedByRulesyncSubagent(rulesyncSubagent) {
3197
+ return this.isTargetedByRulesyncSubagentDefault({
3198
+ rulesyncSubagent,
3199
+ toolTarget: "agentsmd"
3200
+ });
3201
+ }
3202
+ };
3203
+
3123
3204
  // src/subagents/codexcli-subagent.ts
3124
3205
  var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
3125
3206
  static getSettablePaths() {
@@ -3236,7 +3317,7 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
3236
3317
  };
3237
3318
 
3238
3319
  // src/subagents/subagents-processor.ts
3239
- import { basename as basename13, join as join34 } from "path";
3320
+ import { basename as basename14, join as join34 } from "path";
3240
3321
  import { z as z15 } from "zod/mini";
3241
3322
 
3242
3323
  // src/subagents/claudecode-subagent.ts
@@ -3244,7 +3325,7 @@ import { join as join33 } from "path";
3244
3325
  import { z as z14 } from "zod/mini";
3245
3326
 
3246
3327
  // src/subagents/rulesync-subagent.ts
3247
- import { basename as basename12, join as join32 } from "path";
3328
+ import { basename as basename13, join as join32 } from "path";
3248
3329
  import { z as z13 } from "zod/mini";
3249
3330
  var RulesyncSubagentModelSchema = z13.enum(["opus", "sonnet", "haiku", "inherit"]);
3250
3331
  var RulesyncSubagentFrontmatterSchema = z13.object({
@@ -3304,7 +3385,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
3304
3385
  if (!result.success) {
3305
3386
  throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${result.error.message}`);
3306
3387
  }
3307
- const filename = basename12(relativeFilePath);
3388
+ const filename = basename13(relativeFilePath);
3308
3389
  return new _RulesyncSubagent({
3309
3390
  baseDir: ".",
3310
3391
  relativeDirPath: this.getSettablePaths().relativeDirPath,
@@ -3436,6 +3517,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
3436
3517
 
3437
3518
  // src/subagents/subagents-processor.ts
3438
3519
  var subagentsProcessorToolTargets = [
3520
+ "agentsmd",
3439
3521
  "claudecode",
3440
3522
  "copilot",
3441
3523
  "cursor",
@@ -3444,6 +3526,7 @@ var subagentsProcessorToolTargets = [
3444
3526
  "roo"
3445
3527
  ];
3446
3528
  var subagentsProcessorToolTargetsSimulated = [
3529
+ "agentsmd",
3447
3530
  "copilot",
3448
3531
  "cursor",
3449
3532
  "codexcli",
@@ -3466,6 +3549,15 @@ var SubagentsProcessor = class extends FeatureProcessor {
3466
3549
  );
3467
3550
  const toolSubagents = rulesyncSubagents.map((rulesyncSubagent) => {
3468
3551
  switch (this.toolTarget) {
3552
+ case "agentsmd":
3553
+ if (!AgentsmdSubagent.isTargetedByRulesyncSubagent(rulesyncSubagent)) {
3554
+ return null;
3555
+ }
3556
+ return AgentsmdSubagent.fromRulesyncSubagent({
3557
+ baseDir: this.baseDir,
3558
+ relativeDirPath: RulesyncSubagent.getSettablePaths().relativeDirPath,
3559
+ rulesyncSubagent
3560
+ });
3469
3561
  case "claudecode":
3470
3562
  if (!ClaudecodeSubagent.isTargetedByRulesyncSubagent(rulesyncSubagent)) {
3471
3563
  return null;
@@ -3588,6 +3680,8 @@ var SubagentsProcessor = class extends FeatureProcessor {
3588
3680
  */
3589
3681
  async loadToolFiles() {
3590
3682
  switch (this.toolTarget) {
3683
+ case "agentsmd":
3684
+ return await this.loadAgentsmdSubagents();
3591
3685
  case "claudecode":
3592
3686
  return await this.loadClaudecodeSubagents();
3593
3687
  case "copilot":
@@ -3607,6 +3701,15 @@ var SubagentsProcessor = class extends FeatureProcessor {
3607
3701
  async loadToolFilesToDelete() {
3608
3702
  return this.loadToolFiles();
3609
3703
  }
3704
+ /**
3705
+ * Load Agents.md subagent configurations from .agents/subagents/ directory
3706
+ */
3707
+ async loadAgentsmdSubagents() {
3708
+ return await this.loadToolSubagentsDefault({
3709
+ relativeDirPath: AgentsmdSubagent.getSettablePaths().relativeDirPath,
3710
+ fromFile: (relativeFilePath) => AgentsmdSubagent.fromFile({ relativeFilePath })
3711
+ });
3712
+ }
3610
3713
  /**
3611
3714
  * Load Claude Code subagent configurations from .claude/agents/ directory
3612
3715
  */
@@ -3666,7 +3769,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
3666
3769
  fromFile
3667
3770
  }) {
3668
3771
  const paths = await findFilesByGlobs(join34(this.baseDir, relativeDirPath, "*.md"));
3669
- const subagents = (await Promise.allSettled(paths.map((path2) => fromFile(basename13(path2))))).filter((r) => r.status === "fulfilled").map((r) => r.value);
3772
+ const subagents = (await Promise.allSettled(paths.map((path2) => fromFile(basename14(path2))))).filter((r) => r.status === "fulfilled").map((r) => r.value);
3670
3773
  logger.info(`Successfully loaded ${subagents.length} ${relativeDirPath} subagents`);
3671
3774
  return subagents;
3672
3775
  }
@@ -3696,7 +3799,7 @@ import { join as join37 } from "path";
3696
3799
  import { join as join36 } from "path";
3697
3800
 
3698
3801
  // src/rules/rulesync-rule.ts
3699
- import { basename as basename14, join as join35 } from "path";
3802
+ import { basename as basename15, join as join35 } from "path";
3700
3803
  import { z as z16 } from "zod/mini";
3701
3804
  var RulesyncRuleFrontmatterSchema = z16.object({
3702
3805
  root: z16.optional(z16.optional(z16.boolean())),
@@ -3777,7 +3880,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
3777
3880
  agentsmd: result.data.agentsmd,
3778
3881
  cursor: result.data.cursor
3779
3882
  };
3780
- const filename = basename14(filePath);
3883
+ const filename = basename15(filePath);
3781
3884
  return new _RulesyncRule({
3782
3885
  baseDir: ".",
3783
3886
  relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
@@ -3806,7 +3909,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
3806
3909
  agentsmd: result.data.agentsmd,
3807
3910
  cursor: result.data.cursor
3808
3911
  };
3809
- const filename = basename14(filePath);
3912
+ const filename = basename15(filePath);
3810
3913
  return new _RulesyncRule({
3811
3914
  baseDir: ".",
3812
3915
  relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
@@ -4588,7 +4691,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
4588
4691
  };
4589
4692
 
4590
4693
  // src/rules/cursor-rule.ts
4591
- import { basename as basename15, join as join45 } from "path";
4694
+ import { basename as basename16, join as join45 } from "path";
4592
4695
  import { z as z19 } from "zod/mini";
4593
4696
  var CursorRuleFrontmatterSchema = z19.object({
4594
4697
  description: z19.optional(z19.string()),
@@ -4727,7 +4830,7 @@ var CursorRule = class _CursorRule extends ToolRule {
4727
4830
  return new _CursorRule({
4728
4831
  baseDir,
4729
4832
  relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
4730
- relativeFilePath: basename15(relativeFilePath),
4833
+ relativeFilePath: basename16(relativeFilePath),
4731
4834
  frontmatter: result.data,
4732
4835
  body: content.trim(),
4733
4836
  validate
@@ -5524,7 +5627,12 @@ var RulesProcessor = class extends FeatureProcessor {
5524
5627
  case "agentsmd": {
5525
5628
  const rootRule = toolRules[rootRuleIndex];
5526
5629
  rootRule?.setFileContent(
5527
- this.generateXmlReferencesSection(toolRules) + rootRule.getFileContent()
5630
+ this.generateXmlReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
5631
+ commands: { relativeDirPath: AgentsmdCommand.getSettablePaths().relativeDirPath },
5632
+ subagents: {
5633
+ relativeDirPath: AgentsmdSubagent.getSettablePaths().relativeDirPath
5634
+ }
5635
+ }) + rootRule.getFileContent()
5528
5636
  );
5529
5637
  return toolRules;
5530
5638
  }
@@ -5546,7 +5654,6 @@ var RulesProcessor = class extends FeatureProcessor {
5546
5654
  const rootRule = toolRules[rootRuleIndex];
5547
5655
  rootRule?.setFileContent(
5548
5656
  this.generateXmlReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
5549
- commands: { relativeDirPath: CodexCliCommand.getSettablePaths().relativeDirPath },
5550
5657
  subagents: {
5551
5658
  relativeDirPath: CodexCliSubagent.getSettablePaths().relativeDirPath
5552
5659
  }
@@ -5625,7 +5732,7 @@ var RulesProcessor = class extends FeatureProcessor {
5625
5732
  const files = await findFilesByGlobs(join54(".rulesync/rules", "*.md"));
5626
5733
  logger.debug(`Found ${files.length} rulesync files`);
5627
5734
  const rulesyncRules = await Promise.all(
5628
- files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename16(file) }))
5735
+ files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename17(file) }))
5629
5736
  );
5630
5737
  const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
5631
5738
  if (rootRules.length > 1) {
@@ -5646,7 +5753,7 @@ var RulesProcessor = class extends FeatureProcessor {
5646
5753
  const legacyFiles = await findFilesByGlobs(join54(".rulesync", "*.md"));
5647
5754
  logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
5648
5755
  return Promise.all(
5649
- legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename16(file) }))
5756
+ legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename17(file) }))
5650
5757
  );
5651
5758
  }
5652
5759
  /**
@@ -5716,7 +5823,7 @@ var RulesProcessor = class extends FeatureProcessor {
5716
5823
  rootFilePaths.map(
5717
5824
  (filePath) => root.fromFile({
5718
5825
  baseDir: this.baseDir,
5719
- relativeFilePath: basename16(filePath),
5826
+ relativeFilePath: basename17(filePath),
5720
5827
  global: this.global
5721
5828
  })
5722
5829
  )
@@ -5734,7 +5841,7 @@ var RulesProcessor = class extends FeatureProcessor {
5734
5841
  nonRootFilePaths.map(
5735
5842
  (filePath) => nonRoot.fromFile({
5736
5843
  baseDir: this.baseDir,
5737
- relativeFilePath: basename16(filePath),
5844
+ relativeFilePath: basename17(filePath),
5738
5845
  global: this.global
5739
5846
  })
5740
5847
  )
@@ -6089,7 +6196,7 @@ var RulesProcessor = class extends FeatureProcessor {
6089
6196
  const overview = `# Additional Conventions Beyond the Built-in Functions
6090
6197
 
6091
6198
  As this project's AI coding tool, you must follow the additional conventions below, in addition to the built-in functions.`;
6092
- const commandsSection = `## Simulated Custom Slash Commands
6199
+ const commandsSection = commands ? `## Simulated Custom Slash Commands
6093
6200
 
6094
6201
  Custom slash commands allow you to define frequently-used prompts as Markdown files that you can execute.
6095
6202
 
@@ -6104,14 +6211,14 @@ s/<command> [arguments]
6104
6211
  This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
6105
6212
  The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
6106
6213
 
6107
- When users call a custom slash command, you have to look for the markdown file, \`${join54(commands.relativeDirPath, "{command}.md")}\`, then execute the contents of that file as the block of operations.`;
6108
- const subagentsSection = `## Simulated Subagents
6214
+ When users call a custom slash command, you have to look for the markdown file, \`${join54(commands.relativeDirPath, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
6215
+ const subagentsSection = subagents ? `## Simulated Subagents
6109
6216
 
6110
6217
  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.
6111
6218
 
6112
6219
  When users call a simulated subagent, it will look for the corresponding markdown file, \`${join54(subagents.relativeDirPath, "{subagent}.md")}\`, and execute its contents as the block of operations.
6113
6220
 
6114
- For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join54(subagents.relativeDirPath, "planner.md")}\`, and execute its contents as the block of operations.`;
6221
+ For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join54(subagents.relativeDirPath, "planner.md")}\`, and execute its contents as the block of operations.` : "";
6115
6222
  const result = [
6116
6223
  overview,
6117
6224
  ...this.simulateCommands && CommandsProcessor.getToolTargetsSimulated().includes(this.toolTarget) ? [commandsSection] : [],
@@ -6659,7 +6766,7 @@ globs: ["**/*"]
6659
6766
  }
6660
6767
 
6661
6768
  // src/cli/index.ts
6662
- var getVersion = () => "2.2.0";
6769
+ var getVersion = () => "3.1.0";
6663
6770
  var main = async () => {
6664
6771
  const program = new Command();
6665
6772
  const version = getVersion();