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.cjs CHANGED
@@ -95,7 +95,7 @@ var logger = new Logger();
95
95
  var import_es_toolkit2 = require("es-toolkit");
96
96
 
97
97
  // src/commands/commands-processor.ts
98
- var import_node_path11 = require("path");
98
+ var import_node_path12 = require("path");
99
99
  var import_mini8 = require("zod/mini");
100
100
 
101
101
  // src/utils/file.ts
@@ -210,9 +210,8 @@ var FeatureProcessor = class {
210
210
  }
211
211
  };
212
212
 
213
- // src/commands/claudecode-command.ts
213
+ // src/commands/agentsmd-command.ts
214
214
  var import_node_path4 = require("path");
215
- var import_mini4 = require("zod/mini");
216
215
 
217
216
  // src/utils/frontmatter.ts
218
217
  var import_gray_matter = __toESM(require("gray-matter"), 1);
@@ -263,9 +262,9 @@ function parseFrontmatter(content) {
263
262
  return { frontmatter, body };
264
263
  }
265
264
 
266
- // src/commands/rulesync-command.ts
265
+ // src/commands/simulated-command.ts
267
266
  var import_node_path3 = require("path");
268
- var import_mini3 = require("zod/mini");
267
+ var import_mini2 = require("zod/mini");
269
268
 
270
269
  // src/types/ai-file.ts
271
270
  var import_node_path2 = __toESM(require("path"), 1);
@@ -345,109 +344,6 @@ var AiFile = class {
345
344
  }
346
345
  };
347
346
 
348
- // src/types/rulesync-file.ts
349
- var RulesyncFile = class extends AiFile {
350
- static async fromFile(_params) {
351
- throw new Error("Please implement this method in the subclass.");
352
- }
353
- static async fromFileLegacy(_params) {
354
- throw new Error("Please implement this method in the subclass.");
355
- }
356
- };
357
-
358
- // src/types/tool-targets.ts
359
- var import_mini2 = require("zod/mini");
360
- var ALL_TOOL_TARGETS = [
361
- "agentsmd",
362
- "amazonqcli",
363
- "augmentcode",
364
- "augmentcode-legacy",
365
- "copilot",
366
- "cursor",
367
- "cline",
368
- "claudecode",
369
- "codexcli",
370
- "opencode",
371
- "qwencode",
372
- "roo",
373
- "geminicli",
374
- "kiro",
375
- "junie",
376
- "warp",
377
- "windsurf"
378
- ];
379
- var ALL_TOOL_TARGETS_WITH_WILDCARD = [...ALL_TOOL_TARGETS, "*"];
380
- var ToolTargetSchema = import_mini2.z.enum(ALL_TOOL_TARGETS);
381
- var ToolTargetsSchema = import_mini2.z.array(ToolTargetSchema);
382
- var RulesyncTargetsSchema = import_mini2.z.array(import_mini2.z.enum(ALL_TOOL_TARGETS_WITH_WILDCARD));
383
-
384
- // src/commands/rulesync-command.ts
385
- var RulesyncCommandFrontmatterSchema = import_mini3.z.object({
386
- targets: RulesyncTargetsSchema,
387
- description: import_mini3.z.string()
388
- });
389
- var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
390
- frontmatter;
391
- body;
392
- constructor({ frontmatter, body, ...rest }) {
393
- if (rest.validate) {
394
- const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
395
- if (!result.success) {
396
- throw result.error;
397
- }
398
- }
399
- super({
400
- ...rest,
401
- fileContent: stringifyFrontmatter(body, frontmatter)
402
- });
403
- this.frontmatter = frontmatter;
404
- this.body = body;
405
- }
406
- static getSettablePaths() {
407
- return {
408
- relativeDirPath: ".rulesync/commands"
409
- };
410
- }
411
- getFrontmatter() {
412
- return this.frontmatter;
413
- }
414
- getBody() {
415
- return this.body;
416
- }
417
- validate() {
418
- if (!this.frontmatter) {
419
- return { success: true, error: null };
420
- }
421
- const result = RulesyncCommandFrontmatterSchema.safeParse(this.frontmatter);
422
- if (result.success) {
423
- return { success: true, error: null };
424
- } else {
425
- return { success: false, error: result.error };
426
- }
427
- }
428
- static async fromFile({
429
- relativeFilePath
430
- }) {
431
- const fileContent = await readFileContent(
432
- (0, import_node_path3.join)(_RulesyncCommand.getSettablePaths().relativeDirPath, relativeFilePath)
433
- );
434
- const { frontmatter, body: content } = parseFrontmatter(fileContent);
435
- const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
436
- if (!result.success) {
437
- throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${result.error.message}`);
438
- }
439
- const filename = (0, import_node_path3.basename)(relativeFilePath);
440
- return new _RulesyncCommand({
441
- baseDir: ".",
442
- relativeDirPath: _RulesyncCommand.getSettablePaths().relativeDirPath,
443
- relativeFilePath: filename,
444
- frontmatter: result.data,
445
- body: content.trim(),
446
- fileContent
447
- });
448
- }
449
- };
450
-
451
347
  // src/commands/tool-command.ts
452
348
  var ToolCommand = class extends AiFile {
453
349
  static getSettablePaths() {
@@ -518,16 +414,16 @@ var ToolCommand = class extends AiFile {
518
414
  }
519
415
  };
520
416
 
521
- // src/commands/claudecode-command.ts
522
- var ClaudecodeCommandFrontmatterSchema = import_mini4.z.object({
523
- description: import_mini4.z.string()
417
+ // src/commands/simulated-command.ts
418
+ var SimulatedCommandFrontmatterSchema = import_mini2.z.object({
419
+ description: import_mini2.z.string()
524
420
  });
525
- var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
421
+ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
526
422
  frontmatter;
527
423
  body;
528
424
  constructor({ frontmatter, body, ...rest }) {
529
425
  if (rest.validate) {
530
- const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
426
+ const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
531
427
  if (!result.success) {
532
428
  throw result.error;
533
429
  }
@@ -539,16 +435,6 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
539
435
  this.frontmatter = frontmatter;
540
436
  this.body = body;
541
437
  }
542
- static getSettablePaths() {
543
- return {
544
- relativeDirPath: ".claude/commands"
545
- };
546
- }
547
- static getSettablePathsGlobal() {
548
- return {
549
- relativeDirPath: (0, import_node_path4.join)(".claude", "commands")
550
- };
551
- }
552
438
  getBody() {
553
439
  return this.body;
554
440
  }
@@ -556,100 +442,235 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
556
442
  return this.frontmatter;
557
443
  }
558
444
  toRulesyncCommand() {
559
- const rulesyncFrontmatter = {
560
- targets: ["*"],
561
- description: this.frontmatter.description
562
- };
563
- const fileContent = stringifyFrontmatter(this.body, rulesyncFrontmatter);
564
- return new RulesyncCommand({
565
- baseDir: ".",
566
- // RulesyncCommand baseDir is always the project root directory
567
- frontmatter: rulesyncFrontmatter,
568
- body: this.body,
569
- relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
570
- relativeFilePath: this.relativeFilePath,
571
- fileContent,
572
- validate: true
573
- });
445
+ throw new Error("Not implemented because it is a SIMULATED file.");
574
446
  }
575
- static fromRulesyncCommand({
447
+ static fromRulesyncCommandDefault({
576
448
  baseDir = ".",
577
449
  rulesyncCommand,
578
- validate = true,
579
- global = false
450
+ validate = true
580
451
  }) {
581
452
  const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
582
453
  const claudecodeFrontmatter = {
583
454
  description: rulesyncFrontmatter.description
584
455
  };
585
456
  const body = rulesyncCommand.getBody();
586
- const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
587
- return new _ClaudecodeCommand({
457
+ return {
588
458
  baseDir,
589
459
  frontmatter: claudecodeFrontmatter,
590
460
  body,
591
- relativeDirPath: paths.relativeDirPath,
461
+ relativeDirPath: this.getSettablePaths().relativeDirPath,
592
462
  relativeFilePath: rulesyncCommand.getRelativeFilePath(),
593
463
  validate
594
- });
464
+ };
595
465
  }
596
466
  validate() {
597
467
  if (!this.frontmatter) {
598
468
  return { success: true, error: null };
599
469
  }
600
- const result = ClaudecodeCommandFrontmatterSchema.safeParse(this.frontmatter);
470
+ const result = SimulatedCommandFrontmatterSchema.safeParse(this.frontmatter);
601
471
  if (result.success) {
602
472
  return { success: true, error: null };
603
473
  } else {
604
474
  return { success: false, error: result.error };
605
475
  }
606
476
  }
607
- static isTargetedByRulesyncCommand(rulesyncCommand) {
608
- return this.isTargetedByRulesyncCommandDefault({
609
- rulesyncCommand,
610
- toolTarget: "claudecode"
611
- });
477
+ static async fromFileDefault({
478
+ baseDir = ".",
479
+ relativeFilePath,
480
+ validate = true
481
+ }) {
482
+ const filePath = (0, import_node_path3.join)(
483
+ baseDir,
484
+ _SimulatedCommand.getSettablePaths().relativeDirPath,
485
+ relativeFilePath
486
+ );
487
+ const fileContent = await readFileContent(filePath);
488
+ const { frontmatter, body: content } = parseFrontmatter(fileContent);
489
+ const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
490
+ if (!result.success) {
491
+ throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
492
+ }
493
+ return {
494
+ baseDir,
495
+ relativeDirPath: _SimulatedCommand.getSettablePaths().relativeDirPath,
496
+ relativeFilePath: (0, import_node_path3.basename)(relativeFilePath),
497
+ frontmatter: result.data,
498
+ body: content.trim(),
499
+ validate
500
+ };
501
+ }
502
+ };
503
+
504
+ // src/commands/agentsmd-command.ts
505
+ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
506
+ static getSettablePaths() {
507
+ return {
508
+ relativeDirPath: ".agents/commands"
509
+ };
510
+ }
511
+ static fromRulesyncCommand({
512
+ baseDir = ".",
513
+ rulesyncCommand,
514
+ validate = true
515
+ }) {
516
+ return new _AgentsmdCommand(
517
+ this.fromRulesyncCommandDefault({ baseDir, rulesyncCommand, validate })
518
+ );
612
519
  }
613
520
  static async fromFile({
614
521
  baseDir = ".",
615
522
  relativeFilePath,
616
- validate = true,
617
- global = false
523
+ validate = true
618
524
  }) {
619
- const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
620
- const filePath = (0, import_node_path4.join)(baseDir, paths.relativeDirPath, relativeFilePath);
525
+ const filePath = (0, import_node_path4.join)(
526
+ baseDir,
527
+ _AgentsmdCommand.getSettablePaths().relativeDirPath,
528
+ relativeFilePath
529
+ );
621
530
  const fileContent = await readFileContent(filePath);
622
531
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
623
- const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
532
+ const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
624
533
  if (!result.success) {
625
534
  throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
626
535
  }
627
- return new _ClaudecodeCommand({
536
+ return new _AgentsmdCommand({
628
537
  baseDir,
629
- relativeDirPath: paths.relativeDirPath,
538
+ relativeDirPath: _AgentsmdCommand.getSettablePaths().relativeDirPath,
630
539
  relativeFilePath: (0, import_node_path4.basename)(relativeFilePath),
631
540
  frontmatter: result.data,
632
541
  body: content.trim(),
633
542
  validate
634
543
  });
635
544
  }
545
+ static isTargetedByRulesyncCommand(rulesyncCommand) {
546
+ return this.isTargetedByRulesyncCommandDefault({
547
+ rulesyncCommand,
548
+ toolTarget: "agentsmd"
549
+ });
550
+ }
636
551
  };
637
552
 
638
- // src/commands/codexcli-command.ts
553
+ // src/commands/claudecode-command.ts
639
554
  var import_node_path6 = require("path");
555
+ var import_mini5 = require("zod/mini");
640
556
 
641
- // src/commands/simulated-command.ts
557
+ // src/commands/rulesync-command.ts
642
558
  var import_node_path5 = require("path");
643
- var import_mini5 = require("zod/mini");
644
- var SimulatedCommandFrontmatterSchema = import_mini5.z.object({
559
+ var import_mini4 = require("zod/mini");
560
+
561
+ // src/types/rulesync-file.ts
562
+ var RulesyncFile = class extends AiFile {
563
+ static async fromFile(_params) {
564
+ throw new Error("Please implement this method in the subclass.");
565
+ }
566
+ static async fromFileLegacy(_params) {
567
+ throw new Error("Please implement this method in the subclass.");
568
+ }
569
+ };
570
+
571
+ // src/types/tool-targets.ts
572
+ var import_mini3 = require("zod/mini");
573
+ var ALL_TOOL_TARGETS = [
574
+ "agentsmd",
575
+ "amazonqcli",
576
+ "augmentcode",
577
+ "augmentcode-legacy",
578
+ "copilot",
579
+ "cursor",
580
+ "cline",
581
+ "claudecode",
582
+ "codexcli",
583
+ "opencode",
584
+ "qwencode",
585
+ "roo",
586
+ "geminicli",
587
+ "kiro",
588
+ "junie",
589
+ "warp",
590
+ "windsurf"
591
+ ];
592
+ var ALL_TOOL_TARGETS_WITH_WILDCARD = [...ALL_TOOL_TARGETS, "*"];
593
+ var ToolTargetSchema = import_mini3.z.enum(ALL_TOOL_TARGETS);
594
+ var ToolTargetsSchema = import_mini3.z.array(ToolTargetSchema);
595
+ var RulesyncTargetsSchema = import_mini3.z.array(import_mini3.z.enum(ALL_TOOL_TARGETS_WITH_WILDCARD));
596
+
597
+ // src/commands/rulesync-command.ts
598
+ var RulesyncCommandFrontmatterSchema = import_mini4.z.object({
599
+ targets: RulesyncTargetsSchema,
600
+ description: import_mini4.z.string()
601
+ });
602
+ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
603
+ frontmatter;
604
+ body;
605
+ constructor({ frontmatter, body, ...rest }) {
606
+ if (rest.validate) {
607
+ const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
608
+ if (!result.success) {
609
+ throw result.error;
610
+ }
611
+ }
612
+ super({
613
+ ...rest,
614
+ fileContent: stringifyFrontmatter(body, frontmatter)
615
+ });
616
+ this.frontmatter = frontmatter;
617
+ this.body = body;
618
+ }
619
+ static getSettablePaths() {
620
+ return {
621
+ relativeDirPath: ".rulesync/commands"
622
+ };
623
+ }
624
+ getFrontmatter() {
625
+ return this.frontmatter;
626
+ }
627
+ getBody() {
628
+ return this.body;
629
+ }
630
+ validate() {
631
+ if (!this.frontmatter) {
632
+ return { success: true, error: null };
633
+ }
634
+ const result = RulesyncCommandFrontmatterSchema.safeParse(this.frontmatter);
635
+ if (result.success) {
636
+ return { success: true, error: null };
637
+ } else {
638
+ return { success: false, error: result.error };
639
+ }
640
+ }
641
+ static async fromFile({
642
+ relativeFilePath
643
+ }) {
644
+ const fileContent = await readFileContent(
645
+ (0, import_node_path5.join)(_RulesyncCommand.getSettablePaths().relativeDirPath, relativeFilePath)
646
+ );
647
+ const { frontmatter, body: content } = parseFrontmatter(fileContent);
648
+ const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
649
+ if (!result.success) {
650
+ throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${result.error.message}`);
651
+ }
652
+ const filename = (0, import_node_path5.basename)(relativeFilePath);
653
+ return new _RulesyncCommand({
654
+ baseDir: ".",
655
+ relativeDirPath: _RulesyncCommand.getSettablePaths().relativeDirPath,
656
+ relativeFilePath: filename,
657
+ frontmatter: result.data,
658
+ body: content.trim(),
659
+ fileContent
660
+ });
661
+ }
662
+ };
663
+
664
+ // src/commands/claudecode-command.ts
665
+ var ClaudecodeCommandFrontmatterSchema = import_mini5.z.object({
645
666
  description: import_mini5.z.string()
646
667
  });
647
- var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
668
+ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
648
669
  frontmatter;
649
670
  body;
650
671
  constructor({ frontmatter, body, ...rest }) {
651
672
  if (rest.validate) {
652
- const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
673
+ const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
653
674
  if (!result.success) {
654
675
  throw result.error;
655
676
  }
@@ -661,6 +682,16 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
661
682
  this.frontmatter = frontmatter;
662
683
  this.body = body;
663
684
  }
685
+ static getSettablePaths() {
686
+ return {
687
+ relativeDirPath: ".claude/commands"
688
+ };
689
+ }
690
+ static getSettablePathsGlobal() {
691
+ return {
692
+ relativeDirPath: (0, import_node_path6.join)(".claude", "commands")
693
+ };
694
+ }
664
695
  getBody() {
665
696
  return this.body;
666
697
  }
@@ -668,116 +699,161 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
668
699
  return this.frontmatter;
669
700
  }
670
701
  toRulesyncCommand() {
671
- throw new Error("Not implemented because it is a SIMULATED file.");
702
+ const rulesyncFrontmatter = {
703
+ targets: ["*"],
704
+ description: this.frontmatter.description
705
+ };
706
+ const fileContent = stringifyFrontmatter(this.body, rulesyncFrontmatter);
707
+ return new RulesyncCommand({
708
+ baseDir: ".",
709
+ // RulesyncCommand baseDir is always the project root directory
710
+ frontmatter: rulesyncFrontmatter,
711
+ body: this.body,
712
+ relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
713
+ relativeFilePath: this.relativeFilePath,
714
+ fileContent,
715
+ validate: true
716
+ });
672
717
  }
673
- static fromRulesyncCommandDefault({
718
+ static fromRulesyncCommand({
674
719
  baseDir = ".",
675
720
  rulesyncCommand,
676
- validate = true
721
+ validate = true,
722
+ global = false
677
723
  }) {
678
724
  const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
679
725
  const claudecodeFrontmatter = {
680
726
  description: rulesyncFrontmatter.description
681
727
  };
682
728
  const body = rulesyncCommand.getBody();
683
- return {
729
+ const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
730
+ return new _ClaudecodeCommand({
684
731
  baseDir,
685
732
  frontmatter: claudecodeFrontmatter,
686
733
  body,
687
- relativeDirPath: this.getSettablePaths().relativeDirPath,
734
+ relativeDirPath: paths.relativeDirPath,
688
735
  relativeFilePath: rulesyncCommand.getRelativeFilePath(),
689
736
  validate
690
- };
737
+ });
691
738
  }
692
739
  validate() {
693
740
  if (!this.frontmatter) {
694
741
  return { success: true, error: null };
695
742
  }
696
- const result = SimulatedCommandFrontmatterSchema.safeParse(this.frontmatter);
743
+ const result = ClaudecodeCommandFrontmatterSchema.safeParse(this.frontmatter);
697
744
  if (result.success) {
698
745
  return { success: true, error: null };
699
746
  } else {
700
747
  return { success: false, error: result.error };
701
748
  }
702
749
  }
703
- static async fromFileDefault({
750
+ static isTargetedByRulesyncCommand(rulesyncCommand) {
751
+ return this.isTargetedByRulesyncCommandDefault({
752
+ rulesyncCommand,
753
+ toolTarget: "claudecode"
754
+ });
755
+ }
756
+ static async fromFile({
704
757
  baseDir = ".",
705
758
  relativeFilePath,
706
- validate = true
759
+ validate = true,
760
+ global = false
707
761
  }) {
708
- const filePath = (0, import_node_path5.join)(
709
- baseDir,
710
- _SimulatedCommand.getSettablePaths().relativeDirPath,
711
- relativeFilePath
712
- );
762
+ const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
763
+ const filePath = (0, import_node_path6.join)(baseDir, paths.relativeDirPath, relativeFilePath);
713
764
  const fileContent = await readFileContent(filePath);
714
765
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
715
- const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
766
+ const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
716
767
  if (!result.success) {
717
768
  throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
718
769
  }
719
- return {
770
+ return new _ClaudecodeCommand({
720
771
  baseDir,
721
- relativeDirPath: _SimulatedCommand.getSettablePaths().relativeDirPath,
722
- relativeFilePath: (0, import_node_path5.basename)(relativeFilePath),
772
+ relativeDirPath: paths.relativeDirPath,
773
+ relativeFilePath: (0, import_node_path6.basename)(relativeFilePath),
723
774
  frontmatter: result.data,
724
775
  body: content.trim(),
725
776
  validate
726
- };
777
+ });
727
778
  }
728
779
  };
729
780
 
730
781
  // src/commands/codexcli-command.ts
731
- var CodexCliCommand = class _CodexCliCommand extends SimulatedCommand {
782
+ var import_node_path7 = require("path");
783
+ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
732
784
  static getSettablePaths() {
785
+ throw new Error("getSettablePaths is not supported for CodexcliCommand");
786
+ }
787
+ static getSettablePathsGlobal() {
733
788
  return {
734
- relativeDirPath: ".codex/commands"
789
+ relativeDirPath: (0, import_node_path7.join)(".codex", "prompts")
735
790
  };
736
791
  }
792
+ toRulesyncCommand() {
793
+ const rulesyncFrontmatter = {
794
+ targets: ["*"],
795
+ description: ""
796
+ };
797
+ return new RulesyncCommand({
798
+ baseDir: ".",
799
+ // RulesyncCommand baseDir is always the project root directory
800
+ frontmatter: rulesyncFrontmatter,
801
+ body: this.getFileContent(),
802
+ relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
803
+ relativeFilePath: this.relativeFilePath,
804
+ fileContent: this.getFileContent(),
805
+ validate: true
806
+ });
807
+ }
737
808
  static fromRulesyncCommand({
738
809
  baseDir = ".",
739
810
  rulesyncCommand,
740
- validate = true
741
- }) {
742
- return new _CodexCliCommand(
743
- this.fromRulesyncCommandDefault({ baseDir, rulesyncCommand, validate })
744
- );
745
- }
746
- static async fromFile({
747
- baseDir = ".",
748
- relativeFilePath,
749
- validate = true
811
+ validate = true,
812
+ global = false
750
813
  }) {
751
- const filePath = (0, import_node_path6.join)(
752
- baseDir,
753
- _CodexCliCommand.getSettablePaths().relativeDirPath,
754
- relativeFilePath
755
- );
756
- const fileContent = await readFileContent(filePath);
757
- const { frontmatter, body: content } = parseFrontmatter(fileContent);
758
- const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
759
- if (!result.success) {
760
- throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
761
- }
762
- return new _CodexCliCommand({
814
+ const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
815
+ return new _CodexcliCommand({
763
816
  baseDir,
764
- relativeDirPath: _CodexCliCommand.getSettablePaths().relativeDirPath,
765
- relativeFilePath: (0, import_node_path6.basename)(relativeFilePath),
766
- frontmatter: result.data,
767
- body: content.trim(),
817
+ fileContent: rulesyncCommand.getBody(),
818
+ relativeDirPath: paths.relativeDirPath,
819
+ relativeFilePath: rulesyncCommand.getRelativeFilePath(),
768
820
  validate
769
821
  });
770
822
  }
823
+ validate() {
824
+ return { success: true, error: null };
825
+ }
826
+ getBody() {
827
+ return this.getFileContent();
828
+ }
771
829
  static isTargetedByRulesyncCommand(rulesyncCommand) {
772
830
  return this.isTargetedByRulesyncCommandDefault({
773
831
  rulesyncCommand,
774
832
  toolTarget: "codexcli"
775
833
  });
776
834
  }
835
+ static async fromFile({
836
+ baseDir = ".",
837
+ relativeFilePath,
838
+ validate = true,
839
+ global = false
840
+ }) {
841
+ const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
842
+ const filePath = (0, import_node_path7.join)(baseDir, paths.relativeDirPath, relativeFilePath);
843
+ const fileContent = await readFileContent(filePath);
844
+ const { body: content } = parseFrontmatter(fileContent);
845
+ return new _CodexcliCommand({
846
+ baseDir,
847
+ relativeDirPath: paths.relativeDirPath,
848
+ relativeFilePath: (0, import_node_path7.basename)(relativeFilePath),
849
+ fileContent: content.trim(),
850
+ validate
851
+ });
852
+ }
777
853
  };
778
854
 
779
855
  // src/commands/copilot-command.ts
780
- var import_node_path7 = require("path");
856
+ var import_node_path8 = require("path");
781
857
  var CopilotCommand = class _CopilotCommand extends SimulatedCommand {
782
858
  static getSettablePaths() {
783
859
  return {
@@ -798,7 +874,7 @@ var CopilotCommand = class _CopilotCommand extends SimulatedCommand {
798
874
  relativeFilePath,
799
875
  validate = true
800
876
  }) {
801
- const filePath = (0, import_node_path7.join)(
877
+ const filePath = (0, import_node_path8.join)(
802
878
  baseDir,
803
879
  _CopilotCommand.getSettablePaths().relativeDirPath,
804
880
  relativeFilePath
@@ -812,7 +888,7 @@ var CopilotCommand = class _CopilotCommand extends SimulatedCommand {
812
888
  return new _CopilotCommand({
813
889
  baseDir,
814
890
  relativeDirPath: _CopilotCommand.getSettablePaths().relativeDirPath,
815
- relativeFilePath: (0, import_node_path7.basename)(relativeFilePath),
891
+ relativeFilePath: (0, import_node_path8.basename)(relativeFilePath),
816
892
  frontmatter: result.data,
817
893
  body: content.trim(),
818
894
  validate
@@ -827,16 +903,16 @@ var CopilotCommand = class _CopilotCommand extends SimulatedCommand {
827
903
  };
828
904
 
829
905
  // src/commands/cursor-command.ts
830
- var import_node_path8 = require("path");
906
+ var import_node_path9 = require("path");
831
907
  var CursorCommand = class _CursorCommand extends ToolCommand {
832
908
  static getSettablePaths() {
833
909
  return {
834
- relativeDirPath: (0, import_node_path8.join)(".cursor", "commands")
910
+ relativeDirPath: (0, import_node_path9.join)(".cursor", "commands")
835
911
  };
836
912
  }
837
913
  static getSettablePathsGlobal() {
838
914
  return {
839
- relativeDirPath: (0, import_node_path8.join)(".cursor", "commands")
915
+ relativeDirPath: (0, import_node_path9.join)(".cursor", "commands")
840
916
  };
841
917
  }
842
918
  toRulesyncCommand() {
@@ -889,13 +965,13 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
889
965
  global = false
890
966
  }) {
891
967
  const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
892
- const filePath = (0, import_node_path8.join)(baseDir, paths.relativeDirPath, relativeFilePath);
968
+ const filePath = (0, import_node_path9.join)(baseDir, paths.relativeDirPath, relativeFilePath);
893
969
  const fileContent = await readFileContent(filePath);
894
970
  const { body: content } = parseFrontmatter(fileContent);
895
971
  return new _CursorCommand({
896
972
  baseDir,
897
973
  relativeDirPath: paths.relativeDirPath,
898
- relativeFilePath: (0, import_node_path8.basename)(relativeFilePath),
974
+ relativeFilePath: (0, import_node_path9.basename)(relativeFilePath),
899
975
  fileContent: content.trim(),
900
976
  validate
901
977
  });
@@ -903,7 +979,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
903
979
  };
904
980
 
905
981
  // src/commands/geminicli-command.ts
906
- var import_node_path9 = require("path");
982
+ var import_node_path10 = require("path");
907
983
  var import_smol_toml = require("smol-toml");
908
984
  var import_mini6 = require("zod/mini");
909
985
  var GeminiCliCommandFrontmatterSchema = import_mini6.z.object({
@@ -926,7 +1002,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
926
1002
  }
927
1003
  static getSettablePathsGlobal() {
928
1004
  return {
929
- relativeDirPath: (0, import_node_path9.join)(".gemini", "commands")
1005
+ relativeDirPath: (0, import_node_path10.join)(".gemini", "commands")
930
1006
  };
931
1007
  }
932
1008
  parseTomlContent(content) {
@@ -998,12 +1074,12 @@ ${geminiFrontmatter.prompt}
998
1074
  global = false
999
1075
  }) {
1000
1076
  const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
1001
- const filePath = (0, import_node_path9.join)(baseDir, paths.relativeDirPath, relativeFilePath);
1077
+ const filePath = (0, import_node_path10.join)(baseDir, paths.relativeDirPath, relativeFilePath);
1002
1078
  const fileContent = await readFileContent(filePath);
1003
1079
  return new _GeminiCliCommand({
1004
1080
  baseDir,
1005
1081
  relativeDirPath: paths.relativeDirPath,
1006
- relativeFilePath: (0, import_node_path9.basename)(relativeFilePath),
1082
+ relativeFilePath: (0, import_node_path10.basename)(relativeFilePath),
1007
1083
  fileContent,
1008
1084
  validate
1009
1085
  });
@@ -1025,7 +1101,7 @@ ${geminiFrontmatter.prompt}
1025
1101
  };
1026
1102
 
1027
1103
  // src/commands/roo-command.ts
1028
- var import_node_path10 = require("path");
1104
+ var import_node_path11 = require("path");
1029
1105
  var import_mini7 = require("zod/mini");
1030
1106
  var RooCommandFrontmatterSchema = import_mini7.z.object({
1031
1107
  description: import_mini7.z.string(),
@@ -1119,7 +1195,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
1119
1195
  relativeFilePath,
1120
1196
  validate = true
1121
1197
  }) {
1122
- const filePath = (0, import_node_path10.join)(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
1198
+ const filePath = (0, import_node_path11.join)(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
1123
1199
  const fileContent = await readFileContent(filePath);
1124
1200
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
1125
1201
  const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
@@ -1129,7 +1205,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
1129
1205
  return new _RooCommand({
1130
1206
  baseDir,
1131
1207
  relativeDirPath: _RooCommand.getSettablePaths().relativeDirPath,
1132
- relativeFilePath: (0, import_node_path10.basename)(relativeFilePath),
1208
+ relativeFilePath: (0, import_node_path11.basename)(relativeFilePath),
1133
1209
  frontmatter: result.data,
1134
1210
  body: content.trim(),
1135
1211
  fileContent,
@@ -1140,15 +1216,24 @@ var RooCommand = class _RooCommand extends ToolCommand {
1140
1216
 
1141
1217
  // src/commands/commands-processor.ts
1142
1218
  var commandsProcessorToolTargets = [
1219
+ "agentsmd",
1143
1220
  "claudecode",
1144
1221
  "geminicli",
1145
1222
  "roo",
1146
1223
  "copilot",
1224
+ "cursor"
1225
+ ];
1226
+ var CommandsProcessorToolTargetSchema = import_mini8.z.enum(
1227
+ // 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
1228
+ commandsProcessorToolTargets.concat("codexcli")
1229
+ );
1230
+ var commandsProcessorToolTargetsSimulated = ["agentsmd", "copilot"];
1231
+ var commandsProcessorToolTargetsGlobal = [
1232
+ "claudecode",
1147
1233
  "cursor",
1234
+ "geminicli",
1148
1235
  "codexcli"
1149
1236
  ];
1150
- var CommandsProcessorToolTargetSchema = import_mini8.z.enum(commandsProcessorToolTargets);
1151
- var commandsProcessorToolTargetsSimulated = ["copilot", "codexcli"];
1152
1237
  var CommandsProcessor = class extends FeatureProcessor {
1153
1238
  toolTarget;
1154
1239
  global;
@@ -1167,6 +1252,14 @@ var CommandsProcessor = class extends FeatureProcessor {
1167
1252
  );
1168
1253
  const toolCommands = rulesyncCommands.map((rulesyncCommand) => {
1169
1254
  switch (this.toolTarget) {
1255
+ case "agentsmd":
1256
+ if (!AgentsmdCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
1257
+ return null;
1258
+ }
1259
+ return AgentsmdCommand.fromRulesyncCommand({
1260
+ baseDir: this.baseDir,
1261
+ rulesyncCommand
1262
+ });
1170
1263
  case "claudecode":
1171
1264
  if (!ClaudecodeCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
1172
1265
  return null;
@@ -1211,12 +1304,13 @@ var CommandsProcessor = class extends FeatureProcessor {
1211
1304
  global: this.global
1212
1305
  });
1213
1306
  case "codexcli":
1214
- if (!CodexCliCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
1307
+ if (!CodexcliCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
1215
1308
  return null;
1216
1309
  }
1217
- return CodexCliCommand.fromRulesyncCommand({
1310
+ return CodexcliCommand.fromRulesyncCommand({
1218
1311
  baseDir: this.baseDir,
1219
- rulesyncCommand
1312
+ rulesyncCommand,
1313
+ global: this.global
1220
1314
  });
1221
1315
  default:
1222
1316
  throw new Error(`Unsupported tool target: ${this.toolTarget}`);
@@ -1241,11 +1335,11 @@ var CommandsProcessor = class extends FeatureProcessor {
1241
1335
  */
1242
1336
  async loadRulesyncFiles() {
1243
1337
  const rulesyncCommandPaths = await findFilesByGlobs(
1244
- (0, import_node_path11.join)(RulesyncCommand.getSettablePaths().relativeDirPath, "*.md")
1338
+ (0, import_node_path12.join)(RulesyncCommand.getSettablePaths().relativeDirPath, "*.md")
1245
1339
  );
1246
1340
  const rulesyncCommands = (await Promise.allSettled(
1247
1341
  rulesyncCommandPaths.map(
1248
- (path2) => RulesyncCommand.fromFile({ relativeFilePath: (0, import_node_path11.basename)(path2) })
1342
+ (path2) => RulesyncCommand.fromFile({ relativeFilePath: (0, import_node_path12.basename)(path2) })
1249
1343
  )
1250
1344
  )).filter((result) => result.status === "fulfilled").map((result) => result.value);
1251
1345
  logger.info(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
@@ -1257,6 +1351,8 @@ var CommandsProcessor = class extends FeatureProcessor {
1257
1351
  */
1258
1352
  async loadToolFiles() {
1259
1353
  switch (this.toolTarget) {
1354
+ case "agentsmd":
1355
+ return await this.loadAgentsmdCommands();
1260
1356
  case "claudecode":
1261
1357
  return await this.loadClaudecodeCommands();
1262
1358
  case "geminicli":
@@ -1282,43 +1378,49 @@ var CommandsProcessor = class extends FeatureProcessor {
1282
1378
  extension
1283
1379
  }) {
1284
1380
  const commandFilePaths = await findFilesByGlobs(
1285
- (0, import_node_path11.join)(this.baseDir, relativeDirPath, `*.${extension}`)
1381
+ (0, import_node_path12.join)(this.baseDir, relativeDirPath, `*.${extension}`)
1286
1382
  );
1287
1383
  const toolCommands = (await Promise.allSettled(
1288
1384
  commandFilePaths.map((path2) => {
1289
1385
  switch (toolTarget) {
1386
+ case "agentsmd":
1387
+ return AgentsmdCommand.fromFile({
1388
+ baseDir: this.baseDir,
1389
+ relativeFilePath: (0, import_node_path12.basename)(path2)
1390
+ });
1290
1391
  case "claudecode":
1291
1392
  return ClaudecodeCommand.fromFile({
1292
1393
  baseDir: this.baseDir,
1293
- relativeFilePath: (0, import_node_path11.basename)(path2),
1394
+ relativeFilePath: (0, import_node_path12.basename)(path2),
1294
1395
  global: this.global
1295
1396
  });
1296
1397
  case "geminicli":
1297
1398
  return GeminiCliCommand.fromFile({
1298
1399
  baseDir: this.baseDir,
1299
- relativeFilePath: (0, import_node_path11.basename)(path2),
1400
+ relativeFilePath: (0, import_node_path12.basename)(path2),
1300
1401
  global: this.global
1301
1402
  });
1302
1403
  case "roo":
1303
1404
  return RooCommand.fromFile({
1304
1405
  baseDir: this.baseDir,
1305
- relativeFilePath: (0, import_node_path11.basename)(path2)
1406
+ relativeFilePath: (0, import_node_path12.basename)(path2)
1306
1407
  });
1307
1408
  case "copilot":
1308
1409
  return CopilotCommand.fromFile({
1309
1410
  baseDir: this.baseDir,
1310
- relativeFilePath: (0, import_node_path11.basename)(path2)
1411
+ relativeFilePath: (0, import_node_path12.basename)(path2)
1311
1412
  });
1312
1413
  case "cursor":
1313
1414
  return CursorCommand.fromFile({
1314
1415
  baseDir: this.baseDir,
1315
- relativeFilePath: (0, import_node_path11.basename)(path2),
1416
+ relativeFilePath: (0, import_node_path12.basename)(path2),
1316
1417
  global: this.global
1317
1418
  });
1318
1419
  case "codexcli":
1319
- return CodexCliCommand.fromFile({
1420
+ return CodexcliCommand.fromFile({
1320
1421
  baseDir: this.baseDir,
1321
- relativeFilePath: (0, import_node_path11.basename)(path2)
1422
+ relativeFilePath: (0, import_node_path12.basename)(path2),
1423
+ global: this.global
1322
1424
  });
1323
1425
  default:
1324
1426
  throw new Error(`Unsupported tool target: ${toolTarget}`);
@@ -1329,7 +1431,17 @@ var CommandsProcessor = class extends FeatureProcessor {
1329
1431
  return toolCommands;
1330
1432
  }
1331
1433
  /**
1332
- * Load Claude Code command configurations from .claude/commands/ directory
1434
+ * Load Agents.md command configurations from .agents/commands/ directory
1435
+ */
1436
+ async loadAgentsmdCommands() {
1437
+ return await this.loadToolCommandDefault({
1438
+ toolTarget: "agentsmd",
1439
+ relativeDirPath: AgentsmdCommand.getSettablePaths().relativeDirPath,
1440
+ extension: "md"
1441
+ });
1442
+ }
1443
+ /**
1444
+ * Load Copilot command configurations from .github/commands/ directory
1333
1445
  */
1334
1446
  async loadCopilotCommands() {
1335
1447
  return await this.loadToolCommandDefault({
@@ -1372,12 +1484,13 @@ var CommandsProcessor = class extends FeatureProcessor {
1372
1484
  });
1373
1485
  }
1374
1486
  /**
1375
- * Load Roo Code command configurations from .roo/commands/ directory
1487
+ * Load Codex CLI command configurations from .codex/prompts/ directory
1376
1488
  */
1377
1489
  async loadCodexcliCommands() {
1490
+ const paths = this.global ? CodexcliCommand.getSettablePathsGlobal() : CodexcliCommand.getSettablePaths();
1378
1491
  return await this.loadToolCommandDefault({
1379
1492
  toolTarget: "codexcli",
1380
- relativeDirPath: CodexCliCommand.getSettablePaths().relativeDirPath,
1493
+ relativeDirPath: paths.relativeDirPath,
1381
1494
  extension: "md"
1382
1495
  });
1383
1496
  }
@@ -1409,12 +1522,12 @@ var CommandsProcessor = class extends FeatureProcessor {
1409
1522
  return commandsProcessorToolTargetsSimulated;
1410
1523
  }
1411
1524
  static getToolTargetsGlobal() {
1412
- return ["claudecode", "cursor", "geminicli"];
1525
+ return commandsProcessorToolTargetsGlobal;
1413
1526
  }
1414
1527
  };
1415
1528
 
1416
1529
  // src/config/config-resolver.ts
1417
- var import_node_path12 = require("path");
1530
+ var import_node_path13 = require("path");
1418
1531
  var import_c12 = require("c12");
1419
1532
 
1420
1533
  // src/config/config.ts
@@ -1550,7 +1663,7 @@ function getBaseDirsInLightOfGlobal({
1550
1663
  global
1551
1664
  }) {
1552
1665
  if (isEnvTest) {
1553
- return baseDirs.map((baseDir) => (0, import_node_path12.join)(".", baseDir));
1666
+ return baseDirs.map((baseDir) => (0, import_node_path13.join)(".", baseDir));
1554
1667
  }
1555
1668
  if (global) {
1556
1669
  return [getHomeDirectory()];
@@ -1565,7 +1678,7 @@ function getBaseDirsInLightOfGlobal({
1565
1678
  var import_mini9 = require("zod/mini");
1566
1679
 
1567
1680
  // src/ignore/amazonqcli-ignore.ts
1568
- var import_node_path13 = require("path");
1681
+ var import_node_path14 = require("path");
1569
1682
 
1570
1683
  // src/types/tool-file.ts
1571
1684
  var ToolFile = class extends AiFile {
@@ -1673,7 +1786,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1673
1786
  validate = true
1674
1787
  }) {
1675
1788
  const fileContent = await readFileContent(
1676
- (0, import_node_path13.join)(
1789
+ (0, import_node_path14.join)(
1677
1790
  baseDir,
1678
1791
  this.getSettablePaths().relativeDirPath,
1679
1792
  this.getSettablePaths().relativeFilePath
@@ -1690,7 +1803,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1690
1803
  };
1691
1804
 
1692
1805
  // src/ignore/augmentcode-ignore.ts
1693
- var import_node_path14 = require("path");
1806
+ var import_node_path15 = require("path");
1694
1807
  var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
1695
1808
  static getSettablePaths() {
1696
1809
  return {
@@ -1728,7 +1841,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
1728
1841
  validate = true
1729
1842
  }) {
1730
1843
  const fileContent = await readFileContent(
1731
- (0, import_node_path14.join)(
1844
+ (0, import_node_path15.join)(
1732
1845
  baseDir,
1733
1846
  this.getSettablePaths().relativeDirPath,
1734
1847
  this.getSettablePaths().relativeFilePath
@@ -1745,7 +1858,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
1745
1858
  };
1746
1859
 
1747
1860
  // src/ignore/claudecode-ignore.ts
1748
- var import_node_path15 = require("path");
1861
+ var import_node_path16 = require("path");
1749
1862
  var import_es_toolkit = require("es-toolkit");
1750
1863
  var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
1751
1864
  constructor(params) {
@@ -1781,7 +1894,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
1781
1894
  const fileContent = rulesyncIgnore.getFileContent();
1782
1895
  const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
1783
1896
  const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
1784
- const filePath = (0, import_node_path15.join)(
1897
+ const filePath = (0, import_node_path16.join)(
1785
1898
  baseDir,
1786
1899
  this.getSettablePaths().relativeDirPath,
1787
1900
  this.getSettablePaths().relativeFilePath
@@ -1809,7 +1922,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
1809
1922
  validate = true
1810
1923
  }) {
1811
1924
  const fileContent = await readFileContent(
1812
- (0, import_node_path15.join)(
1925
+ (0, import_node_path16.join)(
1813
1926
  baseDir,
1814
1927
  this.getSettablePaths().relativeDirPath,
1815
1928
  this.getSettablePaths().relativeFilePath
@@ -1826,7 +1939,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
1826
1939
  };
1827
1940
 
1828
1941
  // src/ignore/cline-ignore.ts
1829
- var import_node_path16 = require("path");
1942
+ var import_node_path17 = require("path");
1830
1943
  var ClineIgnore = class _ClineIgnore extends ToolIgnore {
1831
1944
  static getSettablePaths() {
1832
1945
  return {
@@ -1858,53 +1971,6 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
1858
1971
  /**
1859
1972
  * Load ClineIgnore from .clineignore file
1860
1973
  */
1861
- static async fromFile({
1862
- baseDir = ".",
1863
- validate = true
1864
- }) {
1865
- const fileContent = await readFileContent(
1866
- (0, import_node_path16.join)(
1867
- baseDir,
1868
- this.getSettablePaths().relativeDirPath,
1869
- this.getSettablePaths().relativeFilePath
1870
- )
1871
- );
1872
- return new _ClineIgnore({
1873
- baseDir,
1874
- relativeDirPath: this.getSettablePaths().relativeDirPath,
1875
- relativeFilePath: this.getSettablePaths().relativeFilePath,
1876
- fileContent,
1877
- validate
1878
- });
1879
- }
1880
- };
1881
-
1882
- // src/ignore/codexcli-ignore.ts
1883
- var import_node_path17 = require("path");
1884
- var CodexcliIgnore = class _CodexcliIgnore extends ToolIgnore {
1885
- static getSettablePaths() {
1886
- return {
1887
- relativeDirPath: ".",
1888
- relativeFilePath: ".codexignore"
1889
- };
1890
- }
1891
- toRulesyncIgnore() {
1892
- return this.toRulesyncIgnoreDefault();
1893
- }
1894
- static fromRulesyncIgnore({
1895
- baseDir = ".",
1896
- rulesyncIgnore
1897
- }) {
1898
- const fileContent = rulesyncIgnore.getFileContent();
1899
- return new _CodexcliIgnore({
1900
- baseDir,
1901
- relativeDirPath: this.getSettablePaths().relativeDirPath,
1902
- relativeFilePath: this.getSettablePaths().relativeFilePath,
1903
- fileContent,
1904
- validate: true
1905
- // Skip validation to allow empty patterns
1906
- });
1907
- }
1908
1974
  static async fromFile({
1909
1975
  baseDir = ".",
1910
1976
  validate = true
@@ -1916,7 +1982,7 @@ var CodexcliIgnore = class _CodexcliIgnore extends ToolIgnore {
1916
1982
  this.getSettablePaths().relativeFilePath
1917
1983
  )
1918
1984
  );
1919
- return new _CodexcliIgnore({
1985
+ return new _ClineIgnore({
1920
1986
  baseDir,
1921
1987
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1922
1988
  relativeFilePath: this.getSettablePaths().relativeFilePath,
@@ -2246,7 +2312,6 @@ var ignoreProcessorToolTargets = [
2246
2312
  "augmentcode",
2247
2313
  "claudecode",
2248
2314
  "cline",
2249
- "codexcli",
2250
2315
  "cursor",
2251
2316
  "geminicli",
2252
2317
  "junie",
@@ -2304,8 +2369,6 @@ var IgnoreProcessor = class extends FeatureProcessor {
2304
2369
  return [await ClaudecodeIgnore.fromFile({ baseDir: this.baseDir })];
2305
2370
  case "cline":
2306
2371
  return [await ClineIgnore.fromFile({ baseDir: this.baseDir })];
2307
- case "codexcli":
2308
- return [await CodexcliIgnore.fromFile({ baseDir: this.baseDir })];
2309
2372
  case "cursor":
2310
2373
  return [await CursorIgnore.fromFile({ baseDir: this.baseDir })];
2311
2374
  case "geminicli":
@@ -2363,11 +2426,6 @@ var IgnoreProcessor = class extends FeatureProcessor {
2363
2426
  baseDir: this.baseDir,
2364
2427
  rulesyncIgnore: rulesyncIgnore2
2365
2428
  });
2366
- case "codexcli":
2367
- return CodexcliIgnore.fromRulesyncIgnore({
2368
- baseDir: this.baseDir,
2369
- rulesyncIgnore: rulesyncIgnore2
2370
- });
2371
2429
  case "cursor":
2372
2430
  return CursorIgnore.fromRulesyncIgnore({
2373
2431
  baseDir: this.baseDir,
@@ -3143,6 +3201,29 @@ var SimulatedSubagent = class extends ToolSubagent {
3143
3201
  }
3144
3202
  };
3145
3203
 
3204
+ // src/subagents/agentsmd-subagent.ts
3205
+ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
3206
+ static getSettablePaths() {
3207
+ return {
3208
+ relativeDirPath: ".agents/subagents"
3209
+ };
3210
+ }
3211
+ static async fromFile(params) {
3212
+ const baseParams = await this.fromFileDefault(params);
3213
+ return new _AgentsmdSubagent(baseParams);
3214
+ }
3215
+ static fromRulesyncSubagent(params) {
3216
+ const baseParams = this.fromRulesyncSubagentDefault(params);
3217
+ return new _AgentsmdSubagent(baseParams);
3218
+ }
3219
+ static isTargetedByRulesyncSubagent(rulesyncSubagent) {
3220
+ return this.isTargetedByRulesyncSubagentDefault({
3221
+ rulesyncSubagent,
3222
+ toolTarget: "agentsmd"
3223
+ });
3224
+ }
3225
+ };
3226
+
3146
3227
  // src/subagents/codexcli-subagent.ts
3147
3228
  var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
3148
3229
  static getSettablePaths() {
@@ -3459,6 +3540,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
3459
3540
 
3460
3541
  // src/subagents/subagents-processor.ts
3461
3542
  var subagentsProcessorToolTargets = [
3543
+ "agentsmd",
3462
3544
  "claudecode",
3463
3545
  "copilot",
3464
3546
  "cursor",
@@ -3467,6 +3549,7 @@ var subagentsProcessorToolTargets = [
3467
3549
  "roo"
3468
3550
  ];
3469
3551
  var subagentsProcessorToolTargetsSimulated = [
3552
+ "agentsmd",
3470
3553
  "copilot",
3471
3554
  "cursor",
3472
3555
  "codexcli",
@@ -3489,6 +3572,15 @@ var SubagentsProcessor = class extends FeatureProcessor {
3489
3572
  );
3490
3573
  const toolSubagents = rulesyncSubagents.map((rulesyncSubagent) => {
3491
3574
  switch (this.toolTarget) {
3575
+ case "agentsmd":
3576
+ if (!AgentsmdSubagent.isTargetedByRulesyncSubagent(rulesyncSubagent)) {
3577
+ return null;
3578
+ }
3579
+ return AgentsmdSubagent.fromRulesyncSubagent({
3580
+ baseDir: this.baseDir,
3581
+ relativeDirPath: RulesyncSubagent.getSettablePaths().relativeDirPath,
3582
+ rulesyncSubagent
3583
+ });
3492
3584
  case "claudecode":
3493
3585
  if (!ClaudecodeSubagent.isTargetedByRulesyncSubagent(rulesyncSubagent)) {
3494
3586
  return null;
@@ -3611,6 +3703,8 @@ var SubagentsProcessor = class extends FeatureProcessor {
3611
3703
  */
3612
3704
  async loadToolFiles() {
3613
3705
  switch (this.toolTarget) {
3706
+ case "agentsmd":
3707
+ return await this.loadAgentsmdSubagents();
3614
3708
  case "claudecode":
3615
3709
  return await this.loadClaudecodeSubagents();
3616
3710
  case "copilot":
@@ -3630,6 +3724,15 @@ var SubagentsProcessor = class extends FeatureProcessor {
3630
3724
  async loadToolFilesToDelete() {
3631
3725
  return this.loadToolFiles();
3632
3726
  }
3727
+ /**
3728
+ * Load Agents.md subagent configurations from .agents/subagents/ directory
3729
+ */
3730
+ async loadAgentsmdSubagents() {
3731
+ return await this.loadToolSubagentsDefault({
3732
+ relativeDirPath: AgentsmdSubagent.getSettablePaths().relativeDirPath,
3733
+ fromFile: (relativeFilePath) => AgentsmdSubagent.fromFile({ relativeFilePath })
3734
+ });
3735
+ }
3633
3736
  /**
3634
3737
  * Load Claude Code subagent configurations from .claude/agents/ directory
3635
3738
  */
@@ -5547,7 +5650,12 @@ var RulesProcessor = class extends FeatureProcessor {
5547
5650
  case "agentsmd": {
5548
5651
  const rootRule = toolRules[rootRuleIndex];
5549
5652
  rootRule?.setFileContent(
5550
- this.generateXmlReferencesSection(toolRules) + rootRule.getFileContent()
5653
+ this.generateXmlReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
5654
+ commands: { relativeDirPath: AgentsmdCommand.getSettablePaths().relativeDirPath },
5655
+ subagents: {
5656
+ relativeDirPath: AgentsmdSubagent.getSettablePaths().relativeDirPath
5657
+ }
5658
+ }) + rootRule.getFileContent()
5551
5659
  );
5552
5660
  return toolRules;
5553
5661
  }
@@ -5569,7 +5677,6 @@ var RulesProcessor = class extends FeatureProcessor {
5569
5677
  const rootRule = toolRules[rootRuleIndex];
5570
5678
  rootRule?.setFileContent(
5571
5679
  this.generateXmlReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
5572
- commands: { relativeDirPath: CodexCliCommand.getSettablePaths().relativeDirPath },
5573
5680
  subagents: {
5574
5681
  relativeDirPath: CodexCliSubagent.getSettablePaths().relativeDirPath
5575
5682
  }
@@ -6112,7 +6219,7 @@ var RulesProcessor = class extends FeatureProcessor {
6112
6219
  const overview = `# Additional Conventions Beyond the Built-in Functions
6113
6220
 
6114
6221
  As this project's AI coding tool, you must follow the additional conventions below, in addition to the built-in functions.`;
6115
- const commandsSection = `## Simulated Custom Slash Commands
6222
+ const commandsSection = commands ? `## Simulated Custom Slash Commands
6116
6223
 
6117
6224
  Custom slash commands allow you to define frequently-used prompts as Markdown files that you can execute.
6118
6225
 
@@ -6127,14 +6234,14 @@ s/<command> [arguments]
6127
6234
  This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
6128
6235
  The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
6129
6236
 
6130
- When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path55.join)(commands.relativeDirPath, "{command}.md")}\`, then execute the contents of that file as the block of operations.`;
6131
- const subagentsSection = `## Simulated Subagents
6237
+ When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path55.join)(commands.relativeDirPath, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
6238
+ const subagentsSection = subagents ? `## Simulated Subagents
6132
6239
 
6133
6240
  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.
6134
6241
 
6135
6242
  When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path55.join)(subagents.relativeDirPath, "{subagent}.md")}\`, and execute its contents as the block of operations.
6136
6243
 
6137
- For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path55.join)(subagents.relativeDirPath, "planner.md")}\`, and execute its contents as the block of operations.`;
6244
+ For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path55.join)(subagents.relativeDirPath, "planner.md")}\`, and execute its contents as the block of operations.` : "";
6138
6245
  const result = [
6139
6246
  overview,
6140
6247
  ...this.simulateCommands && CommandsProcessor.getToolTargetsSimulated().includes(this.toolTarget) ? [commandsSection] : [],
@@ -6682,7 +6789,7 @@ globs: ["**/*"]
6682
6789
  }
6683
6790
 
6684
6791
  // src/cli/index.ts
6685
- var getVersion = () => "2.2.0";
6792
+ var getVersion = () => "3.1.0";
6686
6793
  var main = async () => {
6687
6794
  const program = new import_commander.Command();
6688
6795
  const version = getVersion();