rulesync 0.70.0 → 0.72.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/README.md +37 -4
- package/dist/index.cjs +1622 -473
- package/dist/index.js +1613 -464
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
));
|
|
25
25
|
|
|
26
26
|
// src/cli/index.ts
|
|
27
|
-
var
|
|
27
|
+
var import_node_path56 = require("path");
|
|
28
28
|
var import_node_url = require("url");
|
|
29
29
|
var import_commander = require("commander");
|
|
30
30
|
|
|
@@ -253,7 +253,9 @@ async function initConfig() {
|
|
|
253
253
|
features: ["rules", "ignore", "mcp", "commands", "subagents"],
|
|
254
254
|
baseDirs: ["."],
|
|
255
255
|
delete: true,
|
|
256
|
-
verbose: false
|
|
256
|
+
verbose: false,
|
|
257
|
+
experimentalSimulateCommands: false,
|
|
258
|
+
experimentalSimulateSubagents: false
|
|
257
259
|
},
|
|
258
260
|
null,
|
|
259
261
|
2
|
|
@@ -266,8 +268,8 @@ async function initConfig() {
|
|
|
266
268
|
var import_es_toolkit = require("es-toolkit");
|
|
267
269
|
|
|
268
270
|
// src/commands/commands-processor.ts
|
|
269
|
-
var
|
|
270
|
-
var
|
|
271
|
+
var import_node_path11 = require("path");
|
|
272
|
+
var import_mini8 = require("zod/mini");
|
|
271
273
|
|
|
272
274
|
// src/types/feature-processor.ts
|
|
273
275
|
var FeatureProcessor = class {
|
|
@@ -278,7 +280,7 @@ var FeatureProcessor = class {
|
|
|
278
280
|
/**
|
|
279
281
|
* Return tool targets that this feature supports.
|
|
280
282
|
*/
|
|
281
|
-
static getToolTargets() {
|
|
283
|
+
static getToolTargets(_params = {}) {
|
|
282
284
|
throw new Error("Not implemented");
|
|
283
285
|
}
|
|
284
286
|
/**
|
|
@@ -299,7 +301,7 @@ var FeatureProcessor = class {
|
|
|
299
301
|
};
|
|
300
302
|
|
|
301
303
|
// src/commands/claudecode-command.ts
|
|
302
|
-
var
|
|
304
|
+
var import_node_path4 = require("path");
|
|
303
305
|
var import_mini4 = require("zod/mini");
|
|
304
306
|
|
|
305
307
|
// src/utils/frontmatter.ts
|
|
@@ -330,6 +332,9 @@ function deepRemoveNullishValue(value) {
|
|
|
330
332
|
return value;
|
|
331
333
|
}
|
|
332
334
|
function deepRemoveNullishObject(obj) {
|
|
335
|
+
if (!obj || typeof obj !== "object") {
|
|
336
|
+
return {};
|
|
337
|
+
}
|
|
333
338
|
const result = {};
|
|
334
339
|
for (const [key, val] of Object.entries(obj)) {
|
|
335
340
|
const cleaned = deepRemoveNullishValue(val);
|
|
@@ -349,20 +354,11 @@ function parseFrontmatter(content) {
|
|
|
349
354
|
}
|
|
350
355
|
|
|
351
356
|
// src/commands/rulesync-command.ts
|
|
352
|
-
var
|
|
357
|
+
var import_node_path3 = require("path");
|
|
353
358
|
var import_mini3 = require("zod/mini");
|
|
354
359
|
|
|
355
|
-
// src/constants/paths.ts
|
|
356
|
-
var import_node_path2 = require("path");
|
|
357
|
-
var RULESYNC_DIR = ".rulesync";
|
|
358
|
-
var RULESYNC_RULES_DIR = (0, import_node_path2.join)(".rulesync", "rules");
|
|
359
|
-
var RULESYNC_RULES_DIR_LEGACY = ".rulesync";
|
|
360
|
-
var RULESYNC_MCP_FILE = (0, import_node_path2.join)(".rulesync", ".mcp.json");
|
|
361
|
-
var RULESYNC_COMMANDS_DIR = (0, import_node_path2.join)(".rulesync", "commands");
|
|
362
|
-
var RULESYNC_SUBAGENTS_DIR = (0, import_node_path2.join)(".rulesync", "subagents");
|
|
363
|
-
|
|
364
360
|
// src/types/ai-file.ts
|
|
365
|
-
var
|
|
361
|
+
var import_node_path2 = __toESM(require("path"), 1);
|
|
366
362
|
var AiFile = class {
|
|
367
363
|
/**
|
|
368
364
|
* @example "."
|
|
@@ -411,13 +407,13 @@ var AiFile = class {
|
|
|
411
407
|
return this.relativeFilePath;
|
|
412
408
|
}
|
|
413
409
|
getFilePath() {
|
|
414
|
-
return
|
|
410
|
+
return import_node_path2.default.join(this.baseDir, this.relativeDirPath, this.relativeFilePath);
|
|
415
411
|
}
|
|
416
412
|
getFileContent() {
|
|
417
413
|
return this.fileContent;
|
|
418
414
|
}
|
|
419
415
|
getRelativePathFromCwd() {
|
|
420
|
-
return
|
|
416
|
+
return import_node_path2.default.join(this.relativeDirPath, this.relativeFilePath);
|
|
421
417
|
}
|
|
422
418
|
setFileContent(newFileContent) {
|
|
423
419
|
this.fileContent = newFileContent;
|
|
@@ -456,6 +452,11 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
456
452
|
this.frontmatter = frontmatter;
|
|
457
453
|
this.body = body;
|
|
458
454
|
}
|
|
455
|
+
static getSettablePaths() {
|
|
456
|
+
return {
|
|
457
|
+
relativeDirPath: ".rulesync/commands"
|
|
458
|
+
};
|
|
459
|
+
}
|
|
459
460
|
getFrontmatter() {
|
|
460
461
|
return this.frontmatter;
|
|
461
462
|
}
|
|
@@ -476,16 +477,18 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
476
477
|
static async fromFile({
|
|
477
478
|
relativeFilePath
|
|
478
479
|
}) {
|
|
479
|
-
const fileContent = await readFileContent(
|
|
480
|
+
const fileContent = await readFileContent(
|
|
481
|
+
(0, import_node_path3.join)(_RulesyncCommand.getSettablePaths().relativeDirPath, relativeFilePath)
|
|
482
|
+
);
|
|
480
483
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
481
484
|
const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
|
|
482
485
|
if (!result.success) {
|
|
483
486
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${result.error.message}`);
|
|
484
487
|
}
|
|
485
|
-
const filename = (0,
|
|
488
|
+
const filename = (0, import_node_path3.basename)(relativeFilePath);
|
|
486
489
|
return new _RulesyncCommand({
|
|
487
490
|
baseDir: ".",
|
|
488
|
-
relativeDirPath:
|
|
491
|
+
relativeDirPath: _RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
489
492
|
relativeFilePath: filename,
|
|
490
493
|
frontmatter: result.data,
|
|
491
494
|
body: content.trim(),
|
|
@@ -496,6 +499,9 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
496
499
|
|
|
497
500
|
// src/commands/tool-command.ts
|
|
498
501
|
var ToolCommand = class extends AiFile {
|
|
502
|
+
static getSettablePaths() {
|
|
503
|
+
throw new Error("Please implement this method in the subclass.");
|
|
504
|
+
}
|
|
499
505
|
/**
|
|
500
506
|
* Load a command from a tool-specific file path.
|
|
501
507
|
*
|
|
@@ -549,6 +555,11 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
549
555
|
this.frontmatter = frontmatter;
|
|
550
556
|
this.body = body;
|
|
551
557
|
}
|
|
558
|
+
static getSettablePaths() {
|
|
559
|
+
return {
|
|
560
|
+
relativeDirPath: ".claude/commands"
|
|
561
|
+
};
|
|
562
|
+
}
|
|
552
563
|
getBody() {
|
|
553
564
|
return this.body;
|
|
554
565
|
}
|
|
@@ -565,7 +576,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
565
576
|
baseDir: this.baseDir,
|
|
566
577
|
frontmatter: rulesyncFrontmatter,
|
|
567
578
|
body: this.body,
|
|
568
|
-
relativeDirPath:
|
|
579
|
+
relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
569
580
|
relativeFilePath: this.relativeFilePath,
|
|
570
581
|
fileContent,
|
|
571
582
|
validate: true
|
|
@@ -585,7 +596,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
585
596
|
baseDir,
|
|
586
597
|
frontmatter: claudecodeFrontmatter,
|
|
587
598
|
body,
|
|
588
|
-
relativeDirPath: (
|
|
599
|
+
relativeDirPath: _ClaudecodeCommand.getSettablePaths().relativeDirPath,
|
|
589
600
|
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
590
601
|
validate
|
|
591
602
|
});
|
|
@@ -606,7 +617,11 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
606
617
|
relativeFilePath,
|
|
607
618
|
validate = true
|
|
608
619
|
}) {
|
|
609
|
-
const filePath = (0,
|
|
620
|
+
const filePath = (0, import_node_path4.join)(
|
|
621
|
+
baseDir,
|
|
622
|
+
_ClaudecodeCommand.getSettablePaths().relativeDirPath,
|
|
623
|
+
relativeFilePath
|
|
624
|
+
);
|
|
610
625
|
const fileContent = await readFileContent(filePath);
|
|
611
626
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
612
627
|
const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -615,22 +630,245 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
615
630
|
}
|
|
616
631
|
return new _ClaudecodeCommand({
|
|
617
632
|
baseDir,
|
|
618
|
-
relativeDirPath:
|
|
633
|
+
relativeDirPath: _ClaudecodeCommand.getSettablePaths().relativeDirPath,
|
|
634
|
+
relativeFilePath: (0, import_node_path4.basename)(relativeFilePath),
|
|
635
|
+
frontmatter: result.data,
|
|
636
|
+
body: content.trim(),
|
|
637
|
+
validate
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
};
|
|
641
|
+
|
|
642
|
+
// src/commands/codexcli-command.ts
|
|
643
|
+
var import_node_path6 = require("path");
|
|
644
|
+
|
|
645
|
+
// src/commands/simulated-command.ts
|
|
646
|
+
var import_node_path5 = require("path");
|
|
647
|
+
var import_mini5 = require("zod/mini");
|
|
648
|
+
var SimulatedCommandFrontmatterSchema = import_mini5.z.object({
|
|
649
|
+
description: import_mini5.z.string()
|
|
650
|
+
});
|
|
651
|
+
var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
652
|
+
frontmatter;
|
|
653
|
+
body;
|
|
654
|
+
constructor({ frontmatter, body, ...rest }) {
|
|
655
|
+
if (rest.validate) {
|
|
656
|
+
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
657
|
+
if (!result.success) {
|
|
658
|
+
throw result.error;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
super({
|
|
662
|
+
...rest,
|
|
663
|
+
fileContent: stringifyFrontmatter(body, frontmatter)
|
|
664
|
+
});
|
|
665
|
+
this.frontmatter = frontmatter;
|
|
666
|
+
this.body = body;
|
|
667
|
+
}
|
|
668
|
+
getBody() {
|
|
669
|
+
return this.body;
|
|
670
|
+
}
|
|
671
|
+
getFrontmatter() {
|
|
672
|
+
return this.frontmatter;
|
|
673
|
+
}
|
|
674
|
+
toRulesyncCommand() {
|
|
675
|
+
throw new Error("Not implemented because it is a SIMULATED file.");
|
|
676
|
+
}
|
|
677
|
+
static fromRulesyncCommandDefault({
|
|
678
|
+
baseDir = ".",
|
|
679
|
+
rulesyncCommand,
|
|
680
|
+
validate = true
|
|
681
|
+
}) {
|
|
682
|
+
const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
|
|
683
|
+
const claudecodeFrontmatter = {
|
|
684
|
+
description: rulesyncFrontmatter.description
|
|
685
|
+
};
|
|
686
|
+
const body = rulesyncCommand.getBody();
|
|
687
|
+
return {
|
|
688
|
+
baseDir,
|
|
689
|
+
frontmatter: claudecodeFrontmatter,
|
|
690
|
+
body,
|
|
691
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
692
|
+
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
693
|
+
validate
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
validate() {
|
|
697
|
+
if (!this.frontmatter) {
|
|
698
|
+
return { success: true, error: null };
|
|
699
|
+
}
|
|
700
|
+
const result = SimulatedCommandFrontmatterSchema.safeParse(this.frontmatter);
|
|
701
|
+
if (result.success) {
|
|
702
|
+
return { success: true, error: null };
|
|
703
|
+
} else {
|
|
704
|
+
return { success: false, error: result.error };
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
static async fromFileDefault({
|
|
708
|
+
baseDir = ".",
|
|
709
|
+
relativeFilePath,
|
|
710
|
+
validate = true
|
|
711
|
+
}) {
|
|
712
|
+
const filePath = (0, import_node_path5.join)(
|
|
713
|
+
baseDir,
|
|
714
|
+
_SimulatedCommand.getSettablePaths().relativeDirPath,
|
|
715
|
+
relativeFilePath
|
|
716
|
+
);
|
|
717
|
+
const fileContent = await readFileContent(filePath);
|
|
718
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
719
|
+
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
720
|
+
if (!result.success) {
|
|
721
|
+
throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
|
|
722
|
+
}
|
|
723
|
+
return {
|
|
724
|
+
baseDir,
|
|
725
|
+
relativeDirPath: _SimulatedCommand.getSettablePaths().relativeDirPath,
|
|
619
726
|
relativeFilePath: (0, import_node_path5.basename)(relativeFilePath),
|
|
620
727
|
frontmatter: result.data,
|
|
621
728
|
body: content.trim(),
|
|
622
729
|
validate
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
|
|
734
|
+
// src/commands/codexcli-command.ts
|
|
735
|
+
var CodexCliCommand = class _CodexCliCommand extends SimulatedCommand {
|
|
736
|
+
static getSettablePaths() {
|
|
737
|
+
return {
|
|
738
|
+
relativeDirPath: ".codex/commands"
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
static fromRulesyncCommand({
|
|
742
|
+
baseDir = ".",
|
|
743
|
+
rulesyncCommand,
|
|
744
|
+
validate = true
|
|
745
|
+
}) {
|
|
746
|
+
return new _CodexCliCommand(
|
|
747
|
+
this.fromRulesyncCommandDefault({ baseDir, rulesyncCommand, validate })
|
|
748
|
+
);
|
|
749
|
+
}
|
|
750
|
+
static async fromFile({
|
|
751
|
+
baseDir = ".",
|
|
752
|
+
relativeFilePath,
|
|
753
|
+
validate = true
|
|
754
|
+
}) {
|
|
755
|
+
const filePath = (0, import_node_path6.join)(
|
|
756
|
+
baseDir,
|
|
757
|
+
_CodexCliCommand.getSettablePaths().relativeDirPath,
|
|
758
|
+
relativeFilePath
|
|
759
|
+
);
|
|
760
|
+
const fileContent = await readFileContent(filePath);
|
|
761
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
762
|
+
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
763
|
+
if (!result.success) {
|
|
764
|
+
throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
|
|
765
|
+
}
|
|
766
|
+
return new _CodexCliCommand({
|
|
767
|
+
baseDir,
|
|
768
|
+
relativeDirPath: _CodexCliCommand.getSettablePaths().relativeDirPath,
|
|
769
|
+
relativeFilePath: (0, import_node_path6.basename)(relativeFilePath),
|
|
770
|
+
frontmatter: result.data,
|
|
771
|
+
body: content.trim(),
|
|
772
|
+
validate
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
};
|
|
776
|
+
|
|
777
|
+
// src/commands/copilot-command.ts
|
|
778
|
+
var import_node_path7 = require("path");
|
|
779
|
+
var CopilotCommand = class _CopilotCommand extends SimulatedCommand {
|
|
780
|
+
static getSettablePaths() {
|
|
781
|
+
return {
|
|
782
|
+
relativeDirPath: ".copilot/commands"
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
static fromRulesyncCommand({
|
|
786
|
+
baseDir = ".",
|
|
787
|
+
rulesyncCommand,
|
|
788
|
+
validate = true
|
|
789
|
+
}) {
|
|
790
|
+
return new _CopilotCommand(
|
|
791
|
+
this.fromRulesyncCommandDefault({ baseDir, rulesyncCommand, validate })
|
|
792
|
+
);
|
|
793
|
+
}
|
|
794
|
+
static async fromFile({
|
|
795
|
+
baseDir = ".",
|
|
796
|
+
relativeFilePath,
|
|
797
|
+
validate = true
|
|
798
|
+
}) {
|
|
799
|
+
const filePath = (0, import_node_path7.join)(
|
|
800
|
+
baseDir,
|
|
801
|
+
_CopilotCommand.getSettablePaths().relativeDirPath,
|
|
802
|
+
relativeFilePath
|
|
803
|
+
);
|
|
804
|
+
const fileContent = await readFileContent(filePath);
|
|
805
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
806
|
+
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
807
|
+
if (!result.success) {
|
|
808
|
+
throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
|
|
809
|
+
}
|
|
810
|
+
return new _CopilotCommand({
|
|
811
|
+
baseDir,
|
|
812
|
+
relativeDirPath: _CopilotCommand.getSettablePaths().relativeDirPath,
|
|
813
|
+
relativeFilePath: (0, import_node_path7.basename)(relativeFilePath),
|
|
814
|
+
frontmatter: result.data,
|
|
815
|
+
body: content.trim(),
|
|
816
|
+
validate
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
};
|
|
820
|
+
|
|
821
|
+
// src/commands/cursor-command.ts
|
|
822
|
+
var import_node_path8 = require("path");
|
|
823
|
+
var CursorCommand = class _CursorCommand extends SimulatedCommand {
|
|
824
|
+
static getSettablePaths() {
|
|
825
|
+
return {
|
|
826
|
+
relativeDirPath: ".cursor/commands"
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
static fromRulesyncCommand({
|
|
830
|
+
baseDir = ".",
|
|
831
|
+
rulesyncCommand,
|
|
832
|
+
validate = true
|
|
833
|
+
}) {
|
|
834
|
+
return new _CursorCommand(
|
|
835
|
+
this.fromRulesyncCommandDefault({ baseDir, rulesyncCommand, validate })
|
|
836
|
+
);
|
|
837
|
+
}
|
|
838
|
+
static async fromFile({
|
|
839
|
+
baseDir = ".",
|
|
840
|
+
relativeFilePath,
|
|
841
|
+
validate = true
|
|
842
|
+
}) {
|
|
843
|
+
const filePath = (0, import_node_path8.join)(
|
|
844
|
+
baseDir,
|
|
845
|
+
_CursorCommand.getSettablePaths().relativeDirPath,
|
|
846
|
+
relativeFilePath
|
|
847
|
+
);
|
|
848
|
+
const fileContent = await readFileContent(filePath);
|
|
849
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
850
|
+
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
851
|
+
if (!result.success) {
|
|
852
|
+
throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
|
|
853
|
+
}
|
|
854
|
+
return new _CursorCommand({
|
|
855
|
+
baseDir,
|
|
856
|
+
relativeDirPath: _CursorCommand.getSettablePaths().relativeDirPath,
|
|
857
|
+
relativeFilePath: (0, import_node_path8.basename)(relativeFilePath),
|
|
858
|
+
frontmatter: result.data,
|
|
859
|
+
body: content.trim(),
|
|
860
|
+
validate
|
|
623
861
|
});
|
|
624
862
|
}
|
|
625
863
|
};
|
|
626
864
|
|
|
627
865
|
// src/commands/geminicli-command.ts
|
|
628
|
-
var
|
|
866
|
+
var import_node_path9 = require("path");
|
|
629
867
|
var import_smol_toml = require("smol-toml");
|
|
630
|
-
var
|
|
631
|
-
var GeminiCliCommandFrontmatterSchema =
|
|
632
|
-
description:
|
|
633
|
-
prompt:
|
|
868
|
+
var import_mini6 = require("zod/mini");
|
|
869
|
+
var GeminiCliCommandFrontmatterSchema = import_mini6.z.object({
|
|
870
|
+
description: import_mini6.z.optional(import_mini6.z.string()),
|
|
871
|
+
prompt: import_mini6.z.string()
|
|
634
872
|
});
|
|
635
873
|
var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
636
874
|
frontmatter;
|
|
@@ -641,6 +879,11 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
641
879
|
this.frontmatter = parsed;
|
|
642
880
|
this.body = parsed.prompt;
|
|
643
881
|
}
|
|
882
|
+
static getSettablePaths() {
|
|
883
|
+
return {
|
|
884
|
+
relativeDirPath: ".gemini/commands"
|
|
885
|
+
};
|
|
886
|
+
}
|
|
644
887
|
parseTomlContent(content) {
|
|
645
888
|
try {
|
|
646
889
|
const parsed = (0, import_smol_toml.parse)(content);
|
|
@@ -683,7 +926,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
683
926
|
baseDir: this.baseDir,
|
|
684
927
|
frontmatter: rulesyncFrontmatter,
|
|
685
928
|
body: this.body,
|
|
686
|
-
relativeDirPath:
|
|
929
|
+
relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
687
930
|
relativeFilePath: this.relativeFilePath,
|
|
688
931
|
fileContent,
|
|
689
932
|
validate: true
|
|
@@ -705,7 +948,7 @@ ${geminiFrontmatter.prompt}
|
|
|
705
948
|
"""`;
|
|
706
949
|
return new _GeminiCliCommand({
|
|
707
950
|
baseDir,
|
|
708
|
-
relativeDirPath:
|
|
951
|
+
relativeDirPath: _GeminiCliCommand.getSettablePaths().relativeDirPath,
|
|
709
952
|
relativeFilePath: rulesyncCommand.getRelativeFilePath().replace(".md", ".toml"),
|
|
710
953
|
fileContent: tomlContent,
|
|
711
954
|
validate
|
|
@@ -716,12 +959,16 @@ ${geminiFrontmatter.prompt}
|
|
|
716
959
|
relativeFilePath,
|
|
717
960
|
validate = true
|
|
718
961
|
}) {
|
|
719
|
-
const filePath = (0,
|
|
962
|
+
const filePath = (0, import_node_path9.join)(
|
|
963
|
+
baseDir,
|
|
964
|
+
_GeminiCliCommand.getSettablePaths().relativeDirPath,
|
|
965
|
+
relativeFilePath
|
|
966
|
+
);
|
|
720
967
|
const fileContent = await readFileContent(filePath);
|
|
721
968
|
return new _GeminiCliCommand({
|
|
722
969
|
baseDir,
|
|
723
|
-
relativeDirPath:
|
|
724
|
-
relativeFilePath: (0,
|
|
970
|
+
relativeDirPath: _GeminiCliCommand.getSettablePaths().relativeDirPath,
|
|
971
|
+
relativeFilePath: (0, import_node_path9.basename)(relativeFilePath),
|
|
725
972
|
fileContent,
|
|
726
973
|
validate
|
|
727
974
|
});
|
|
@@ -737,15 +984,20 @@ ${geminiFrontmatter.prompt}
|
|
|
737
984
|
};
|
|
738
985
|
|
|
739
986
|
// src/commands/roo-command.ts
|
|
740
|
-
var
|
|
741
|
-
var
|
|
742
|
-
var RooCommandFrontmatterSchema =
|
|
743
|
-
description:
|
|
744
|
-
"argument-hint": (0,
|
|
987
|
+
var import_node_path10 = require("path");
|
|
988
|
+
var import_mini7 = require("zod/mini");
|
|
989
|
+
var RooCommandFrontmatterSchema = import_mini7.z.object({
|
|
990
|
+
description: import_mini7.z.string(),
|
|
991
|
+
"argument-hint": (0, import_mini7.optional)(import_mini7.z.string())
|
|
745
992
|
});
|
|
746
993
|
var RooCommand = class _RooCommand extends ToolCommand {
|
|
747
994
|
frontmatter;
|
|
748
995
|
body;
|
|
996
|
+
static getSettablePaths() {
|
|
997
|
+
return {
|
|
998
|
+
relativeDirPath: ".roo/commands"
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
749
1001
|
constructor({ frontmatter, body, ...rest }) {
|
|
750
1002
|
if (rest.validate) {
|
|
751
1003
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -776,7 +1028,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
776
1028
|
baseDir: this.baseDir,
|
|
777
1029
|
frontmatter: rulesyncFrontmatter,
|
|
778
1030
|
body: this.body,
|
|
779
|
-
relativeDirPath:
|
|
1031
|
+
relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
780
1032
|
relativeFilePath: this.relativeFilePath,
|
|
781
1033
|
fileContent,
|
|
782
1034
|
validate: true
|
|
@@ -797,7 +1049,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
797
1049
|
baseDir,
|
|
798
1050
|
frontmatter: rooFrontmatter,
|
|
799
1051
|
body,
|
|
800
|
-
relativeDirPath:
|
|
1052
|
+
relativeDirPath: _RooCommand.getSettablePaths().relativeDirPath,
|
|
801
1053
|
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
802
1054
|
fileContent,
|
|
803
1055
|
validate
|
|
@@ -819,7 +1071,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
819
1071
|
relativeFilePath,
|
|
820
1072
|
validate = true
|
|
821
1073
|
}) {
|
|
822
|
-
const filePath = (0,
|
|
1074
|
+
const filePath = (0, import_node_path10.join)(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
823
1075
|
const fileContent = await readFileContent(filePath);
|
|
824
1076
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
825
1077
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -828,8 +1080,8 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
828
1080
|
}
|
|
829
1081
|
return new _RooCommand({
|
|
830
1082
|
baseDir,
|
|
831
|
-
relativeDirPath:
|
|
832
|
-
relativeFilePath: (0,
|
|
1083
|
+
relativeDirPath: _RooCommand.getSettablePaths().relativeDirPath,
|
|
1084
|
+
relativeFilePath: (0, import_node_path10.basename)(relativeFilePath),
|
|
833
1085
|
frontmatter: result.data,
|
|
834
1086
|
body: content.trim(),
|
|
835
1087
|
fileContent,
|
|
@@ -839,8 +1091,16 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
839
1091
|
};
|
|
840
1092
|
|
|
841
1093
|
// src/commands/commands-processor.ts
|
|
842
|
-
var commandsProcessorToolTargets = [
|
|
843
|
-
|
|
1094
|
+
var commandsProcessorToolTargets = [
|
|
1095
|
+
"claudecode",
|
|
1096
|
+
"geminicli",
|
|
1097
|
+
"roo",
|
|
1098
|
+
"copilot",
|
|
1099
|
+
"cursor",
|
|
1100
|
+
"codexcli"
|
|
1101
|
+
];
|
|
1102
|
+
var CommandsProcessorToolTargetSchema = import_mini8.z.enum(commandsProcessorToolTargets);
|
|
1103
|
+
var commandsProcessorToolTargetsSimulated = ["copilot", "cursor", "codexcli"];
|
|
844
1104
|
var CommandsProcessor = class extends FeatureProcessor {
|
|
845
1105
|
toolTarget;
|
|
846
1106
|
constructor({
|
|
@@ -871,6 +1131,21 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
871
1131
|
baseDir: this.baseDir,
|
|
872
1132
|
rulesyncCommand
|
|
873
1133
|
});
|
|
1134
|
+
case "copilot":
|
|
1135
|
+
return CopilotCommand.fromRulesyncCommand({
|
|
1136
|
+
baseDir: this.baseDir,
|
|
1137
|
+
rulesyncCommand
|
|
1138
|
+
});
|
|
1139
|
+
case "cursor":
|
|
1140
|
+
return CursorCommand.fromRulesyncCommand({
|
|
1141
|
+
baseDir: this.baseDir,
|
|
1142
|
+
rulesyncCommand
|
|
1143
|
+
});
|
|
1144
|
+
case "codexcli":
|
|
1145
|
+
return CodexCliCommand.fromRulesyncCommand({
|
|
1146
|
+
baseDir: this.baseDir,
|
|
1147
|
+
rulesyncCommand
|
|
1148
|
+
});
|
|
874
1149
|
default:
|
|
875
1150
|
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
876
1151
|
}
|
|
@@ -891,10 +1166,12 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
891
1166
|
* Load and parse rulesync command files from .rulesync/commands/ directory
|
|
892
1167
|
*/
|
|
893
1168
|
async loadRulesyncFiles() {
|
|
894
|
-
const rulesyncCommandPaths = await findFilesByGlobs(
|
|
1169
|
+
const rulesyncCommandPaths = await findFilesByGlobs(
|
|
1170
|
+
(0, import_node_path11.join)(RulesyncCommand.getSettablePaths().relativeDirPath, "*.md")
|
|
1171
|
+
);
|
|
895
1172
|
const rulesyncCommands = (await Promise.allSettled(
|
|
896
1173
|
rulesyncCommandPaths.map(
|
|
897
|
-
(path2) => RulesyncCommand.fromFile({ relativeFilePath: (0,
|
|
1174
|
+
(path2) => RulesyncCommand.fromFile({ relativeFilePath: (0, import_node_path11.basename)(path2) })
|
|
898
1175
|
)
|
|
899
1176
|
)).filter((result) => result.status === "fulfilled").map((result) => result.value);
|
|
900
1177
|
logger.info(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
@@ -912,6 +1189,12 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
912
1189
|
return await this.loadGeminicliCommands();
|
|
913
1190
|
case "roo":
|
|
914
1191
|
return await this.loadRooCommands();
|
|
1192
|
+
case "copilot":
|
|
1193
|
+
return await this.loadCopilotCommands();
|
|
1194
|
+
case "cursor":
|
|
1195
|
+
return await this.loadCursorCommands();
|
|
1196
|
+
case "codexcli":
|
|
1197
|
+
return await this.loadCodexcliCommands();
|
|
915
1198
|
default:
|
|
916
1199
|
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
917
1200
|
}
|
|
@@ -922,17 +1205,23 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
922
1205
|
extension
|
|
923
1206
|
}) {
|
|
924
1207
|
const commandFilePaths = await findFilesByGlobs(
|
|
925
|
-
(0,
|
|
1208
|
+
(0, import_node_path11.join)(this.baseDir, relativeDirPath, `*.${extension}`)
|
|
926
1209
|
);
|
|
927
1210
|
const toolCommands = (await Promise.allSettled(
|
|
928
1211
|
commandFilePaths.map((path2) => {
|
|
929
1212
|
switch (toolTarget) {
|
|
930
1213
|
case "claudecode":
|
|
931
|
-
return ClaudecodeCommand.fromFile({ relativeFilePath: (0,
|
|
1214
|
+
return ClaudecodeCommand.fromFile({ relativeFilePath: (0, import_node_path11.basename)(path2) });
|
|
932
1215
|
case "geminicli":
|
|
933
|
-
return GeminiCliCommand.fromFile({ relativeFilePath: (0,
|
|
1216
|
+
return GeminiCliCommand.fromFile({ relativeFilePath: (0, import_node_path11.basename)(path2) });
|
|
934
1217
|
case "roo":
|
|
935
|
-
return RooCommand.fromFile({ relativeFilePath: (0,
|
|
1218
|
+
return RooCommand.fromFile({ relativeFilePath: (0, import_node_path11.basename)(path2) });
|
|
1219
|
+
case "copilot":
|
|
1220
|
+
return CopilotCommand.fromFile({ relativeFilePath: (0, import_node_path11.basename)(path2) });
|
|
1221
|
+
case "cursor":
|
|
1222
|
+
return CursorCommand.fromFile({ relativeFilePath: (0, import_node_path11.basename)(path2) });
|
|
1223
|
+
case "codexcli":
|
|
1224
|
+
return CodexCliCommand.fromFile({ relativeFilePath: (0, import_node_path11.basename)(path2) });
|
|
936
1225
|
default:
|
|
937
1226
|
throw new Error(`Unsupported tool target: ${toolTarget}`);
|
|
938
1227
|
}
|
|
@@ -941,13 +1230,33 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
941
1230
|
logger.info(`Successfully loaded ${toolCommands.length} ${relativeDirPath} commands`);
|
|
942
1231
|
return toolCommands;
|
|
943
1232
|
}
|
|
1233
|
+
/**
|
|
1234
|
+
* Load Claude Code command configurations from .claude/commands/ directory
|
|
1235
|
+
*/
|
|
1236
|
+
async loadCopilotCommands() {
|
|
1237
|
+
return await this.loadToolCommandDefault({
|
|
1238
|
+
toolTarget: "copilot",
|
|
1239
|
+
relativeDirPath: CopilotCommand.getSettablePaths().relativeDirPath,
|
|
1240
|
+
extension: "md"
|
|
1241
|
+
});
|
|
1242
|
+
}
|
|
944
1243
|
/**
|
|
945
1244
|
* Load Claude Code command configurations from .claude/commands/ directory
|
|
946
1245
|
*/
|
|
947
1246
|
async loadClaudecodeCommands() {
|
|
948
1247
|
return await this.loadToolCommandDefault({
|
|
949
1248
|
toolTarget: "claudecode",
|
|
950
|
-
relativeDirPath:
|
|
1249
|
+
relativeDirPath: ClaudecodeCommand.getSettablePaths().relativeDirPath,
|
|
1250
|
+
extension: "md"
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
/**
|
|
1254
|
+
* Load Gemini CLI command configurations from .gemini/commands/ directory
|
|
1255
|
+
*/
|
|
1256
|
+
async loadCursorCommands() {
|
|
1257
|
+
return await this.loadToolCommandDefault({
|
|
1258
|
+
toolTarget: "cursor",
|
|
1259
|
+
relativeDirPath: CursorCommand.getSettablePaths().relativeDirPath,
|
|
951
1260
|
extension: "md"
|
|
952
1261
|
});
|
|
953
1262
|
}
|
|
@@ -957,7 +1266,17 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
957
1266
|
async loadGeminicliCommands() {
|
|
958
1267
|
return await this.loadToolCommandDefault({
|
|
959
1268
|
toolTarget: "geminicli",
|
|
960
|
-
relativeDirPath:
|
|
1269
|
+
relativeDirPath: GeminiCliCommand.getSettablePaths().relativeDirPath,
|
|
1270
|
+
extension: "md"
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1273
|
+
/**
|
|
1274
|
+
* Load Roo Code command configurations from .roo/commands/ directory
|
|
1275
|
+
*/
|
|
1276
|
+
async loadCodexcliCommands() {
|
|
1277
|
+
return await this.loadToolCommandDefault({
|
|
1278
|
+
toolTarget: "codexcli",
|
|
1279
|
+
relativeDirPath: CodexCliCommand.getSettablePaths().relativeDirPath,
|
|
961
1280
|
extension: "md"
|
|
962
1281
|
});
|
|
963
1282
|
}
|
|
@@ -967,7 +1286,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
967
1286
|
async loadRooCommands() {
|
|
968
1287
|
return await this.loadToolCommandDefault({
|
|
969
1288
|
toolTarget: "roo",
|
|
970
|
-
relativeDirPath:
|
|
1289
|
+
relativeDirPath: RooCommand.getSettablePaths().relativeDirPath,
|
|
971
1290
|
extension: "md"
|
|
972
1291
|
});
|
|
973
1292
|
}
|
|
@@ -975,8 +1294,15 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
975
1294
|
* Implementation of abstract method from FeatureProcessor
|
|
976
1295
|
* Return the tool targets that this processor supports
|
|
977
1296
|
*/
|
|
978
|
-
static getToolTargets(
|
|
979
|
-
|
|
1297
|
+
static getToolTargets({
|
|
1298
|
+
includeSimulated = false
|
|
1299
|
+
} = {}) {
|
|
1300
|
+
if (!includeSimulated) {
|
|
1301
|
+
return commandsProcessorToolTargets.filter(
|
|
1302
|
+
(target) => !commandsProcessorToolTargetsSimulated.includes(target)
|
|
1303
|
+
);
|
|
1304
|
+
}
|
|
1305
|
+
return commandsProcessorToolTargets;
|
|
980
1306
|
}
|
|
981
1307
|
};
|
|
982
1308
|
|
|
@@ -984,12 +1310,12 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
984
1310
|
var import_c12 = require("c12");
|
|
985
1311
|
|
|
986
1312
|
// src/types/features.ts
|
|
987
|
-
var
|
|
1313
|
+
var import_mini9 = require("zod/mini");
|
|
988
1314
|
var ALL_FEATURES = ["rules", "ignore", "mcp", "subagents", "commands"];
|
|
989
1315
|
var ALL_FEATURES_WITH_WILDCARD = [...ALL_FEATURES, "*"];
|
|
990
|
-
var FeatureSchema =
|
|
991
|
-
var FeaturesSchema2 =
|
|
992
|
-
var RulesyncFeaturesSchema =
|
|
1316
|
+
var FeatureSchema = import_mini9.z.enum(ALL_FEATURES);
|
|
1317
|
+
var FeaturesSchema2 = import_mini9.z.array(FeatureSchema);
|
|
1318
|
+
var RulesyncFeaturesSchema = import_mini9.z.array(import_mini9.z.enum(ALL_FEATURES_WITH_WILDCARD));
|
|
993
1319
|
|
|
994
1320
|
// src/config/config.ts
|
|
995
1321
|
var Config = class {
|
|
@@ -998,12 +1324,24 @@ var Config = class {
|
|
|
998
1324
|
features;
|
|
999
1325
|
verbose;
|
|
1000
1326
|
delete;
|
|
1001
|
-
|
|
1327
|
+
experimentalSimulateCommands;
|
|
1328
|
+
experimentalSimulateSubagents;
|
|
1329
|
+
constructor({
|
|
1330
|
+
baseDirs,
|
|
1331
|
+
targets,
|
|
1332
|
+
features,
|
|
1333
|
+
verbose,
|
|
1334
|
+
delete: isDelete,
|
|
1335
|
+
experimentalSimulateCommands,
|
|
1336
|
+
experimentalSimulateSubagents
|
|
1337
|
+
}) {
|
|
1002
1338
|
this.baseDirs = baseDirs;
|
|
1003
1339
|
this.targets = targets;
|
|
1004
1340
|
this.features = features;
|
|
1005
1341
|
this.verbose = verbose;
|
|
1006
1342
|
this.delete = isDelete;
|
|
1343
|
+
this.experimentalSimulateCommands = experimentalSimulateCommands;
|
|
1344
|
+
this.experimentalSimulateSubagents = experimentalSimulateSubagents;
|
|
1007
1345
|
}
|
|
1008
1346
|
getBaseDirs() {
|
|
1009
1347
|
return this.baseDirs;
|
|
@@ -1026,6 +1364,12 @@ var Config = class {
|
|
|
1026
1364
|
getDelete() {
|
|
1027
1365
|
return this.delete;
|
|
1028
1366
|
}
|
|
1367
|
+
getExperimentalSimulateCommands() {
|
|
1368
|
+
return this.experimentalSimulateCommands;
|
|
1369
|
+
}
|
|
1370
|
+
getExperimentalSimulateSubagents() {
|
|
1371
|
+
return this.experimentalSimulateSubagents;
|
|
1372
|
+
}
|
|
1029
1373
|
};
|
|
1030
1374
|
|
|
1031
1375
|
// src/config/config-resolver.ts
|
|
@@ -1035,7 +1379,9 @@ var defaults = {
|
|
|
1035
1379
|
verbose: false,
|
|
1036
1380
|
delete: false,
|
|
1037
1381
|
baseDirs: ["."],
|
|
1038
|
-
configPath: "rulesync.jsonc"
|
|
1382
|
+
configPath: "rulesync.jsonc",
|
|
1383
|
+
experimentalSimulateCommands: false,
|
|
1384
|
+
experimentalSimulateSubagents: false
|
|
1039
1385
|
};
|
|
1040
1386
|
var ConfigResolver = class {
|
|
1041
1387
|
static async resolve({
|
|
@@ -1044,7 +1390,9 @@ var ConfigResolver = class {
|
|
|
1044
1390
|
verbose,
|
|
1045
1391
|
delete: isDelete,
|
|
1046
1392
|
baseDirs,
|
|
1047
|
-
configPath = defaults.configPath
|
|
1393
|
+
configPath = defaults.configPath,
|
|
1394
|
+
experimentalSimulateCommands,
|
|
1395
|
+
experimentalSimulateSubagents
|
|
1048
1396
|
}) {
|
|
1049
1397
|
if (!fileExists(configPath)) {
|
|
1050
1398
|
return new Config({
|
|
@@ -1052,7 +1400,9 @@ var ConfigResolver = class {
|
|
|
1052
1400
|
features: features ?? defaults.features,
|
|
1053
1401
|
verbose: verbose ?? defaults.verbose,
|
|
1054
1402
|
delete: isDelete ?? defaults.delete,
|
|
1055
|
-
baseDirs: baseDirs ?? defaults.baseDirs
|
|
1403
|
+
baseDirs: baseDirs ?? defaults.baseDirs,
|
|
1404
|
+
experimentalSimulateCommands: experimentalSimulateCommands ?? defaults.experimentalSimulateCommands,
|
|
1405
|
+
experimentalSimulateSubagents: experimentalSimulateSubagents ?? defaults.experimentalSimulateSubagents
|
|
1056
1406
|
});
|
|
1057
1407
|
}
|
|
1058
1408
|
const loadOptions = {
|
|
@@ -1072,17 +1422,19 @@ var ConfigResolver = class {
|
|
|
1072
1422
|
features: features ?? configByFile.features ?? defaults.features,
|
|
1073
1423
|
verbose: verbose ?? configByFile.verbose ?? defaults.verbose,
|
|
1074
1424
|
delete: isDelete ?? configByFile.delete ?? defaults.delete,
|
|
1075
|
-
baseDirs: baseDirs ?? configByFile.baseDirs ?? defaults.baseDirs
|
|
1425
|
+
baseDirs: baseDirs ?? configByFile.baseDirs ?? defaults.baseDirs,
|
|
1426
|
+
experimentalSimulateCommands: experimentalSimulateCommands ?? configByFile.experimentalSimulateCommands ?? defaults.experimentalSimulateCommands,
|
|
1427
|
+
experimentalSimulateSubagents: experimentalSimulateSubagents ?? configByFile.experimentalSimulateSubagents ?? defaults.experimentalSimulateSubagents
|
|
1076
1428
|
};
|
|
1077
1429
|
return new Config(configParams);
|
|
1078
1430
|
}
|
|
1079
1431
|
};
|
|
1080
1432
|
|
|
1081
1433
|
// src/ignore/ignore-processor.ts
|
|
1082
|
-
var
|
|
1434
|
+
var import_mini10 = require("zod/mini");
|
|
1083
1435
|
|
|
1084
|
-
// src/ignore/
|
|
1085
|
-
var
|
|
1436
|
+
// src/ignore/amazonqcli-ignore.ts
|
|
1437
|
+
var import_node_path12 = require("path");
|
|
1086
1438
|
|
|
1087
1439
|
// src/types/tool-file.ts
|
|
1088
1440
|
var ToolFile = class extends AiFile {
|
|
@@ -1093,12 +1445,18 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
1093
1445
|
validate() {
|
|
1094
1446
|
return { success: true, error: null };
|
|
1095
1447
|
}
|
|
1448
|
+
static getSettablePaths() {
|
|
1449
|
+
return {
|
|
1450
|
+
relativeDirPath: ".",
|
|
1451
|
+
relativeFilePath: ".rulesyncignore"
|
|
1452
|
+
};
|
|
1453
|
+
}
|
|
1096
1454
|
static async fromFile() {
|
|
1097
|
-
const fileContent = await readFileContent(
|
|
1455
|
+
const fileContent = await readFileContent(this.getSettablePaths().relativeFilePath);
|
|
1098
1456
|
return new _RulesyncIgnore({
|
|
1099
1457
|
baseDir: ".",
|
|
1100
|
-
relativeDirPath:
|
|
1101
|
-
relativeFilePath:
|
|
1458
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1459
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1102
1460
|
fileContent
|
|
1103
1461
|
});
|
|
1104
1462
|
}
|
|
@@ -1121,6 +1479,9 @@ var ToolIgnore = class extends ToolFile {
|
|
|
1121
1479
|
}
|
|
1122
1480
|
}
|
|
1123
1481
|
}
|
|
1482
|
+
static getSettablePaths() {
|
|
1483
|
+
throw new Error("Please implement this method in the subclass.");
|
|
1484
|
+
}
|
|
1124
1485
|
getPatterns() {
|
|
1125
1486
|
return this.patterns;
|
|
1126
1487
|
}
|
|
@@ -1143,8 +1504,70 @@ var ToolIgnore = class extends ToolFile {
|
|
|
1143
1504
|
}
|
|
1144
1505
|
};
|
|
1145
1506
|
|
|
1507
|
+
// src/ignore/amazonqcli-ignore.ts
|
|
1508
|
+
var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
1509
|
+
static getSettablePaths() {
|
|
1510
|
+
return {
|
|
1511
|
+
relativeDirPath: ".",
|
|
1512
|
+
relativeFilePath: ".amazonqignore"
|
|
1513
|
+
};
|
|
1514
|
+
}
|
|
1515
|
+
/**
|
|
1516
|
+
* Convert to RulesyncIgnore format
|
|
1517
|
+
*/
|
|
1518
|
+
toRulesyncIgnore() {
|
|
1519
|
+
return this.toRulesyncIgnoreDefault();
|
|
1520
|
+
}
|
|
1521
|
+
/**
|
|
1522
|
+
* Create AmazonqcliIgnore from RulesyncIgnore
|
|
1523
|
+
* Supports conversion from unified rulesync format to Amazon Q CLI specific format
|
|
1524
|
+
*/
|
|
1525
|
+
static fromRulesyncIgnore({
|
|
1526
|
+
baseDir = ".",
|
|
1527
|
+
rulesyncIgnore
|
|
1528
|
+
}) {
|
|
1529
|
+
const body = rulesyncIgnore.getFileContent();
|
|
1530
|
+
return new _AmazonqcliIgnore({
|
|
1531
|
+
baseDir,
|
|
1532
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1533
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1534
|
+
fileContent: body
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
/**
|
|
1538
|
+
* Create AmazonqcliIgnore from file path
|
|
1539
|
+
* Supports both proposed .q-ignore and .amazonqignore formats
|
|
1540
|
+
*/
|
|
1541
|
+
static async fromFile({
|
|
1542
|
+
baseDir = ".",
|
|
1543
|
+
validate = true
|
|
1544
|
+
}) {
|
|
1545
|
+
const fileContent = await readFileContent(
|
|
1546
|
+
(0, import_node_path12.join)(
|
|
1547
|
+
baseDir,
|
|
1548
|
+
this.getSettablePaths().relativeDirPath,
|
|
1549
|
+
this.getSettablePaths().relativeFilePath
|
|
1550
|
+
)
|
|
1551
|
+
);
|
|
1552
|
+
return new _AmazonqcliIgnore({
|
|
1553
|
+
baseDir,
|
|
1554
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1555
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1556
|
+
fileContent,
|
|
1557
|
+
validate
|
|
1558
|
+
});
|
|
1559
|
+
}
|
|
1560
|
+
};
|
|
1561
|
+
|
|
1146
1562
|
// src/ignore/augmentcode-ignore.ts
|
|
1563
|
+
var import_node_path13 = require("path");
|
|
1147
1564
|
var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
1565
|
+
static getSettablePaths() {
|
|
1566
|
+
return {
|
|
1567
|
+
relativeDirPath: ".",
|
|
1568
|
+
relativeFilePath: ".augmentignore"
|
|
1569
|
+
};
|
|
1570
|
+
}
|
|
1148
1571
|
/**
|
|
1149
1572
|
* Convert to RulesyncIgnore format
|
|
1150
1573
|
*/
|
|
@@ -1161,8 +1584,8 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
1161
1584
|
}) {
|
|
1162
1585
|
return new _AugmentcodeIgnore({
|
|
1163
1586
|
baseDir,
|
|
1164
|
-
relativeDirPath:
|
|
1165
|
-
relativeFilePath:
|
|
1587
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1588
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1166
1589
|
fileContent: rulesyncIgnore.getFileContent()
|
|
1167
1590
|
});
|
|
1168
1591
|
}
|
|
@@ -1174,11 +1597,17 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
1174
1597
|
baseDir = ".",
|
|
1175
1598
|
validate = true
|
|
1176
1599
|
}) {
|
|
1177
|
-
const fileContent = await readFileContent(
|
|
1600
|
+
const fileContent = await readFileContent(
|
|
1601
|
+
(0, import_node_path13.join)(
|
|
1602
|
+
baseDir,
|
|
1603
|
+
this.getSettablePaths().relativeDirPath,
|
|
1604
|
+
this.getSettablePaths().relativeFilePath
|
|
1605
|
+
)
|
|
1606
|
+
);
|
|
1178
1607
|
return new _AugmentcodeIgnore({
|
|
1179
1608
|
baseDir,
|
|
1180
|
-
relativeDirPath:
|
|
1181
|
-
relativeFilePath:
|
|
1609
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1610
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1182
1611
|
fileContent,
|
|
1183
1612
|
validate
|
|
1184
1613
|
});
|
|
@@ -1186,8 +1615,14 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
1186
1615
|
};
|
|
1187
1616
|
|
|
1188
1617
|
// src/ignore/cline-ignore.ts
|
|
1189
|
-
var
|
|
1618
|
+
var import_node_path14 = require("path");
|
|
1190
1619
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
1620
|
+
static getSettablePaths() {
|
|
1621
|
+
return {
|
|
1622
|
+
relativeDirPath: ".",
|
|
1623
|
+
relativeFilePath: ".clineignore"
|
|
1624
|
+
};
|
|
1625
|
+
}
|
|
1191
1626
|
/**
|
|
1192
1627
|
* Convert ClineIgnore to RulesyncIgnore format
|
|
1193
1628
|
*/
|
|
@@ -1204,8 +1639,8 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
1204
1639
|
const body = rulesyncIgnore.getFileContent();
|
|
1205
1640
|
return new _ClineIgnore({
|
|
1206
1641
|
baseDir,
|
|
1207
|
-
relativeDirPath:
|
|
1208
|
-
relativeFilePath:
|
|
1642
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1643
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1209
1644
|
fileContent: body
|
|
1210
1645
|
});
|
|
1211
1646
|
}
|
|
@@ -1216,11 +1651,17 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
1216
1651
|
baseDir = ".",
|
|
1217
1652
|
validate = true
|
|
1218
1653
|
}) {
|
|
1219
|
-
const fileContent = await readFileContent(
|
|
1654
|
+
const fileContent = await readFileContent(
|
|
1655
|
+
(0, import_node_path14.join)(
|
|
1656
|
+
baseDir,
|
|
1657
|
+
this.getSettablePaths().relativeDirPath,
|
|
1658
|
+
this.getSettablePaths().relativeFilePath
|
|
1659
|
+
)
|
|
1660
|
+
);
|
|
1220
1661
|
return new _ClineIgnore({
|
|
1221
1662
|
baseDir,
|
|
1222
|
-
relativeDirPath:
|
|
1223
|
-
relativeFilePath:
|
|
1663
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1664
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1224
1665
|
fileContent,
|
|
1225
1666
|
validate
|
|
1226
1667
|
});
|
|
@@ -1228,8 +1669,14 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
1228
1669
|
};
|
|
1229
1670
|
|
|
1230
1671
|
// src/ignore/codexcli-ignore.ts
|
|
1231
|
-
var
|
|
1672
|
+
var import_node_path15 = require("path");
|
|
1232
1673
|
var CodexcliIgnore = class _CodexcliIgnore extends ToolIgnore {
|
|
1674
|
+
static getSettablePaths() {
|
|
1675
|
+
return {
|
|
1676
|
+
relativeDirPath: ".",
|
|
1677
|
+
relativeFilePath: ".codexignore"
|
|
1678
|
+
};
|
|
1679
|
+
}
|
|
1233
1680
|
toRulesyncIgnore() {
|
|
1234
1681
|
return this.toRulesyncIgnoreDefault();
|
|
1235
1682
|
}
|
|
@@ -1240,8 +1687,8 @@ var CodexcliIgnore = class _CodexcliIgnore extends ToolIgnore {
|
|
|
1240
1687
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
1241
1688
|
return new _CodexcliIgnore({
|
|
1242
1689
|
baseDir,
|
|
1243
|
-
relativeDirPath:
|
|
1244
|
-
relativeFilePath:
|
|
1690
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1691
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1245
1692
|
fileContent,
|
|
1246
1693
|
validate: true
|
|
1247
1694
|
// Skip validation to allow empty patterns
|
|
@@ -1251,11 +1698,17 @@ var CodexcliIgnore = class _CodexcliIgnore extends ToolIgnore {
|
|
|
1251
1698
|
baseDir = ".",
|
|
1252
1699
|
validate = true
|
|
1253
1700
|
}) {
|
|
1254
|
-
const fileContent = await readFileContent(
|
|
1701
|
+
const fileContent = await readFileContent(
|
|
1702
|
+
(0, import_node_path15.join)(
|
|
1703
|
+
baseDir,
|
|
1704
|
+
this.getSettablePaths().relativeDirPath,
|
|
1705
|
+
this.getSettablePaths().relativeFilePath
|
|
1706
|
+
)
|
|
1707
|
+
);
|
|
1255
1708
|
return new _CodexcliIgnore({
|
|
1256
1709
|
baseDir,
|
|
1257
|
-
relativeDirPath:
|
|
1258
|
-
relativeFilePath:
|
|
1710
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1711
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1259
1712
|
fileContent,
|
|
1260
1713
|
validate
|
|
1261
1714
|
});
|
|
@@ -1263,8 +1716,14 @@ var CodexcliIgnore = class _CodexcliIgnore extends ToolIgnore {
|
|
|
1263
1716
|
};
|
|
1264
1717
|
|
|
1265
1718
|
// src/ignore/cursor-ignore.ts
|
|
1266
|
-
var
|
|
1719
|
+
var import_node_path16 = require("path");
|
|
1267
1720
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
1721
|
+
static getSettablePaths() {
|
|
1722
|
+
return {
|
|
1723
|
+
relativeDirPath: ".",
|
|
1724
|
+
relativeFilePath: ".cursorignore"
|
|
1725
|
+
};
|
|
1726
|
+
}
|
|
1268
1727
|
toRulesyncIgnore() {
|
|
1269
1728
|
return new RulesyncIgnore({
|
|
1270
1729
|
baseDir: ".",
|
|
@@ -1280,8 +1739,8 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
1280
1739
|
const body = rulesyncIgnore.getFileContent();
|
|
1281
1740
|
return new _CursorIgnore({
|
|
1282
1741
|
baseDir,
|
|
1283
|
-
relativeDirPath:
|
|
1284
|
-
relativeFilePath:
|
|
1742
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1743
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1285
1744
|
fileContent: body
|
|
1286
1745
|
});
|
|
1287
1746
|
}
|
|
@@ -1289,11 +1748,17 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
1289
1748
|
baseDir = ".",
|
|
1290
1749
|
validate = true
|
|
1291
1750
|
}) {
|
|
1292
|
-
const fileContent = await readFileContent(
|
|
1751
|
+
const fileContent = await readFileContent(
|
|
1752
|
+
(0, import_node_path16.join)(
|
|
1753
|
+
baseDir,
|
|
1754
|
+
this.getSettablePaths().relativeDirPath,
|
|
1755
|
+
this.getSettablePaths().relativeFilePath
|
|
1756
|
+
)
|
|
1757
|
+
);
|
|
1293
1758
|
return new _CursorIgnore({
|
|
1294
1759
|
baseDir,
|
|
1295
|
-
relativeDirPath:
|
|
1296
|
-
relativeFilePath:
|
|
1760
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1761
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1297
1762
|
fileContent,
|
|
1298
1763
|
validate
|
|
1299
1764
|
});
|
|
@@ -1301,8 +1766,14 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
1301
1766
|
};
|
|
1302
1767
|
|
|
1303
1768
|
// src/ignore/geminicli-ignore.ts
|
|
1304
|
-
var
|
|
1769
|
+
var import_node_path17 = require("path");
|
|
1305
1770
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
1771
|
+
static getSettablePaths() {
|
|
1772
|
+
return {
|
|
1773
|
+
relativeDirPath: ".",
|
|
1774
|
+
relativeFilePath: ".aiexclude"
|
|
1775
|
+
};
|
|
1776
|
+
}
|
|
1306
1777
|
toRulesyncIgnore() {
|
|
1307
1778
|
return this.toRulesyncIgnoreDefault();
|
|
1308
1779
|
}
|
|
@@ -1312,8 +1783,8 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
1312
1783
|
}) {
|
|
1313
1784
|
return new _GeminiCliIgnore({
|
|
1314
1785
|
baseDir,
|
|
1315
|
-
relativeDirPath:
|
|
1316
|
-
relativeFilePath:
|
|
1786
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1787
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1317
1788
|
fileContent: rulesyncIgnore.getFileContent()
|
|
1318
1789
|
});
|
|
1319
1790
|
}
|
|
@@ -1321,11 +1792,17 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
1321
1792
|
baseDir = ".",
|
|
1322
1793
|
validate = true
|
|
1323
1794
|
}) {
|
|
1324
|
-
const fileContent = await readFileContent(
|
|
1795
|
+
const fileContent = await readFileContent(
|
|
1796
|
+
(0, import_node_path17.join)(
|
|
1797
|
+
baseDir,
|
|
1798
|
+
this.getSettablePaths().relativeDirPath,
|
|
1799
|
+
this.getSettablePaths().relativeFilePath
|
|
1800
|
+
)
|
|
1801
|
+
);
|
|
1325
1802
|
return new _GeminiCliIgnore({
|
|
1326
1803
|
baseDir,
|
|
1327
|
-
relativeDirPath:
|
|
1328
|
-
relativeFilePath:
|
|
1804
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1805
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1329
1806
|
fileContent,
|
|
1330
1807
|
validate
|
|
1331
1808
|
});
|
|
@@ -1333,8 +1810,14 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
1333
1810
|
};
|
|
1334
1811
|
|
|
1335
1812
|
// src/ignore/junie-ignore.ts
|
|
1336
|
-
var
|
|
1813
|
+
var import_node_path18 = require("path");
|
|
1337
1814
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
1815
|
+
static getSettablePaths() {
|
|
1816
|
+
return {
|
|
1817
|
+
relativeDirPath: ".",
|
|
1818
|
+
relativeFilePath: ".junieignore"
|
|
1819
|
+
};
|
|
1820
|
+
}
|
|
1338
1821
|
toRulesyncIgnore() {
|
|
1339
1822
|
return this.toRulesyncIgnoreDefault();
|
|
1340
1823
|
}
|
|
@@ -1344,8 +1827,8 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
1344
1827
|
}) {
|
|
1345
1828
|
return new _JunieIgnore({
|
|
1346
1829
|
baseDir,
|
|
1347
|
-
relativeDirPath:
|
|
1348
|
-
relativeFilePath:
|
|
1830
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1831
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1349
1832
|
fileContent: rulesyncIgnore.getFileContent()
|
|
1350
1833
|
});
|
|
1351
1834
|
}
|
|
@@ -1353,11 +1836,17 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
1353
1836
|
baseDir = ".",
|
|
1354
1837
|
validate = true
|
|
1355
1838
|
}) {
|
|
1356
|
-
const fileContent = await readFileContent(
|
|
1839
|
+
const fileContent = await readFileContent(
|
|
1840
|
+
(0, import_node_path18.join)(
|
|
1841
|
+
baseDir,
|
|
1842
|
+
this.getSettablePaths().relativeDirPath,
|
|
1843
|
+
this.getSettablePaths().relativeFilePath
|
|
1844
|
+
)
|
|
1845
|
+
);
|
|
1357
1846
|
return new _JunieIgnore({
|
|
1358
1847
|
baseDir,
|
|
1359
|
-
relativeDirPath:
|
|
1360
|
-
relativeFilePath:
|
|
1848
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1849
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1361
1850
|
fileContent,
|
|
1362
1851
|
validate
|
|
1363
1852
|
});
|
|
@@ -1365,8 +1854,14 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
1365
1854
|
};
|
|
1366
1855
|
|
|
1367
1856
|
// src/ignore/kiro-ignore.ts
|
|
1368
|
-
var
|
|
1857
|
+
var import_node_path19 = require("path");
|
|
1369
1858
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
1859
|
+
static getSettablePaths() {
|
|
1860
|
+
return {
|
|
1861
|
+
relativeDirPath: ".",
|
|
1862
|
+
relativeFilePath: ".aiignore"
|
|
1863
|
+
};
|
|
1864
|
+
}
|
|
1370
1865
|
toRulesyncIgnore() {
|
|
1371
1866
|
return this.toRulesyncIgnoreDefault();
|
|
1372
1867
|
}
|
|
@@ -1376,8 +1871,8 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
1376
1871
|
}) {
|
|
1377
1872
|
return new _KiroIgnore({
|
|
1378
1873
|
baseDir,
|
|
1379
|
-
relativeDirPath:
|
|
1380
|
-
relativeFilePath:
|
|
1874
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1875
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1381
1876
|
fileContent: rulesyncIgnore.getFileContent()
|
|
1382
1877
|
});
|
|
1383
1878
|
}
|
|
@@ -1385,11 +1880,17 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
1385
1880
|
baseDir = ".",
|
|
1386
1881
|
validate = true
|
|
1387
1882
|
}) {
|
|
1388
|
-
const fileContent = await readFileContent(
|
|
1883
|
+
const fileContent = await readFileContent(
|
|
1884
|
+
(0, import_node_path19.join)(
|
|
1885
|
+
baseDir,
|
|
1886
|
+
this.getSettablePaths().relativeDirPath,
|
|
1887
|
+
this.getSettablePaths().relativeFilePath
|
|
1888
|
+
)
|
|
1889
|
+
);
|
|
1389
1890
|
return new _KiroIgnore({
|
|
1390
1891
|
baseDir,
|
|
1391
|
-
relativeDirPath:
|
|
1392
|
-
relativeFilePath:
|
|
1892
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1893
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1393
1894
|
fileContent,
|
|
1394
1895
|
validate
|
|
1395
1896
|
});
|
|
@@ -1397,8 +1898,14 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
1397
1898
|
};
|
|
1398
1899
|
|
|
1399
1900
|
// src/ignore/qwencode-ignore.ts
|
|
1400
|
-
var
|
|
1901
|
+
var import_node_path20 = require("path");
|
|
1401
1902
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
1903
|
+
static getSettablePaths() {
|
|
1904
|
+
return {
|
|
1905
|
+
relativeDirPath: ".",
|
|
1906
|
+
relativeFilePath: ".geminiignore"
|
|
1907
|
+
};
|
|
1908
|
+
}
|
|
1402
1909
|
toRulesyncIgnore() {
|
|
1403
1910
|
return this.toRulesyncIgnoreDefault();
|
|
1404
1911
|
}
|
|
@@ -1408,8 +1915,8 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
1408
1915
|
}) {
|
|
1409
1916
|
return new _QwencodeIgnore({
|
|
1410
1917
|
baseDir,
|
|
1411
|
-
relativeDirPath:
|
|
1412
|
-
relativeFilePath:
|
|
1918
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1919
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1413
1920
|
fileContent: rulesyncIgnore.getFileContent()
|
|
1414
1921
|
});
|
|
1415
1922
|
}
|
|
@@ -1417,11 +1924,17 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
1417
1924
|
baseDir = ".",
|
|
1418
1925
|
validate = true
|
|
1419
1926
|
}) {
|
|
1420
|
-
const fileContent = await readFileContent(
|
|
1927
|
+
const fileContent = await readFileContent(
|
|
1928
|
+
(0, import_node_path20.join)(
|
|
1929
|
+
baseDir,
|
|
1930
|
+
this.getSettablePaths().relativeDirPath,
|
|
1931
|
+
this.getSettablePaths().relativeFilePath
|
|
1932
|
+
)
|
|
1933
|
+
);
|
|
1421
1934
|
return new _QwencodeIgnore({
|
|
1422
1935
|
baseDir,
|
|
1423
|
-
relativeDirPath:
|
|
1424
|
-
relativeFilePath:
|
|
1936
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1937
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1425
1938
|
fileContent,
|
|
1426
1939
|
validate
|
|
1427
1940
|
});
|
|
@@ -1429,8 +1942,14 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
1429
1942
|
};
|
|
1430
1943
|
|
|
1431
1944
|
// src/ignore/roo-ignore.ts
|
|
1432
|
-
var
|
|
1945
|
+
var import_node_path21 = require("path");
|
|
1433
1946
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
1947
|
+
static getSettablePaths() {
|
|
1948
|
+
return {
|
|
1949
|
+
relativeDirPath: ".",
|
|
1950
|
+
relativeFilePath: ".rooignore"
|
|
1951
|
+
};
|
|
1952
|
+
}
|
|
1434
1953
|
toRulesyncIgnore() {
|
|
1435
1954
|
return this.toRulesyncIgnoreDefault();
|
|
1436
1955
|
}
|
|
@@ -1440,8 +1959,8 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
1440
1959
|
}) {
|
|
1441
1960
|
return new _RooIgnore({
|
|
1442
1961
|
baseDir,
|
|
1443
|
-
relativeDirPath:
|
|
1444
|
-
relativeFilePath:
|
|
1962
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1963
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1445
1964
|
fileContent: rulesyncIgnore.getFileContent()
|
|
1446
1965
|
});
|
|
1447
1966
|
}
|
|
@@ -1449,11 +1968,17 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
1449
1968
|
baseDir = ".",
|
|
1450
1969
|
validate = true
|
|
1451
1970
|
}) {
|
|
1452
|
-
const fileContent = await readFileContent(
|
|
1971
|
+
const fileContent = await readFileContent(
|
|
1972
|
+
(0, import_node_path21.join)(
|
|
1973
|
+
baseDir,
|
|
1974
|
+
this.getSettablePaths().relativeDirPath,
|
|
1975
|
+
this.getSettablePaths().relativeFilePath
|
|
1976
|
+
)
|
|
1977
|
+
);
|
|
1453
1978
|
return new _RooIgnore({
|
|
1454
1979
|
baseDir,
|
|
1455
|
-
relativeDirPath:
|
|
1456
|
-
relativeFilePath:
|
|
1980
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1981
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1457
1982
|
fileContent,
|
|
1458
1983
|
validate
|
|
1459
1984
|
});
|
|
@@ -1461,8 +1986,14 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
1461
1986
|
};
|
|
1462
1987
|
|
|
1463
1988
|
// src/ignore/windsurf-ignore.ts
|
|
1464
|
-
var
|
|
1989
|
+
var import_node_path22 = require("path");
|
|
1465
1990
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
1991
|
+
static getSettablePaths() {
|
|
1992
|
+
return {
|
|
1993
|
+
relativeDirPath: ".",
|
|
1994
|
+
relativeFilePath: ".codeiumignore"
|
|
1995
|
+
};
|
|
1996
|
+
}
|
|
1466
1997
|
toRulesyncIgnore() {
|
|
1467
1998
|
return this.toRulesyncIgnoreDefault();
|
|
1468
1999
|
}
|
|
@@ -1472,8 +2003,8 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
1472
2003
|
}) {
|
|
1473
2004
|
return new _WindsurfIgnore({
|
|
1474
2005
|
baseDir,
|
|
1475
|
-
relativeDirPath:
|
|
1476
|
-
relativeFilePath:
|
|
2006
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2007
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1477
2008
|
fileContent: rulesyncIgnore.getFileContent()
|
|
1478
2009
|
});
|
|
1479
2010
|
}
|
|
@@ -1481,11 +2012,17 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
1481
2012
|
baseDir = ".",
|
|
1482
2013
|
validate = true
|
|
1483
2014
|
}) {
|
|
1484
|
-
const fileContent = await readFileContent(
|
|
2015
|
+
const fileContent = await readFileContent(
|
|
2016
|
+
(0, import_node_path22.join)(
|
|
2017
|
+
baseDir,
|
|
2018
|
+
this.getSettablePaths().relativeDirPath,
|
|
2019
|
+
this.getSettablePaths().relativeFilePath
|
|
2020
|
+
)
|
|
2021
|
+
);
|
|
1485
2022
|
return new _WindsurfIgnore({
|
|
1486
2023
|
baseDir,
|
|
1487
|
-
relativeDirPath:
|
|
1488
|
-
relativeFilePath:
|
|
2024
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2025
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1489
2026
|
fileContent,
|
|
1490
2027
|
validate
|
|
1491
2028
|
});
|
|
@@ -1494,6 +2031,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
1494
2031
|
|
|
1495
2032
|
// src/ignore/ignore-processor.ts
|
|
1496
2033
|
var ignoreProcessorToolTargets = [
|
|
2034
|
+
"amazonqcli",
|
|
1497
2035
|
"augmentcode",
|
|
1498
2036
|
"cline",
|
|
1499
2037
|
"codexcli",
|
|
@@ -1505,7 +2043,7 @@ var ignoreProcessorToolTargets = [
|
|
|
1505
2043
|
"roo",
|
|
1506
2044
|
"windsurf"
|
|
1507
2045
|
];
|
|
1508
|
-
var IgnoreProcessorToolTargetSchema =
|
|
2046
|
+
var IgnoreProcessorToolTargetSchema = import_mini10.z.enum(ignoreProcessorToolTargets);
|
|
1509
2047
|
var IgnoreProcessor = class extends FeatureProcessor {
|
|
1510
2048
|
toolTarget;
|
|
1511
2049
|
constructor({
|
|
@@ -1546,6 +2084,8 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
1546
2084
|
}
|
|
1547
2085
|
async loadToolIgnores() {
|
|
1548
2086
|
switch (this.toolTarget) {
|
|
2087
|
+
case "amazonqcli":
|
|
2088
|
+
return [await AmazonqcliIgnore.fromFile({ baseDir: this.baseDir })];
|
|
1549
2089
|
case "augmentcode":
|
|
1550
2090
|
return [await AugmentcodeIgnore.fromFile({ baseDir: this.baseDir })];
|
|
1551
2091
|
case "cline":
|
|
@@ -1583,6 +2123,11 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
1583
2123
|
}
|
|
1584
2124
|
const toolIgnores = [rulesyncIgnore].map((rulesyncIgnore2) => {
|
|
1585
2125
|
switch (this.toolTarget) {
|
|
2126
|
+
case "amazonqcli":
|
|
2127
|
+
return AmazonqcliIgnore.fromRulesyncIgnore({
|
|
2128
|
+
baseDir: this.baseDir,
|
|
2129
|
+
rulesyncIgnore: rulesyncIgnore2
|
|
2130
|
+
});
|
|
1586
2131
|
case "augmentcode":
|
|
1587
2132
|
return AugmentcodeIgnore.fromRulesyncIgnore({
|
|
1588
2133
|
baseDir: this.baseDir,
|
|
@@ -1660,44 +2205,44 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
1660
2205
|
};
|
|
1661
2206
|
|
|
1662
2207
|
// src/mcp/mcp-processor.ts
|
|
1663
|
-
var
|
|
2208
|
+
var import_mini12 = require("zod/mini");
|
|
1664
2209
|
|
|
1665
2210
|
// src/mcp/amazonqcli-mcp.ts
|
|
1666
|
-
var
|
|
2211
|
+
var import_node_path24 = require("path");
|
|
1667
2212
|
|
|
1668
2213
|
// src/mcp/rulesync-mcp.ts
|
|
1669
|
-
var
|
|
2214
|
+
var import_node_path23 = require("path");
|
|
1670
2215
|
|
|
1671
2216
|
// src/types/mcp.ts
|
|
1672
|
-
var
|
|
1673
|
-
var McpTransportTypeSchema =
|
|
1674
|
-
var McpServerBaseSchema =
|
|
1675
|
-
type:
|
|
1676
|
-
command:
|
|
1677
|
-
args:
|
|
1678
|
-
url:
|
|
1679
|
-
httpUrl:
|
|
1680
|
-
env:
|
|
1681
|
-
disabled:
|
|
1682
|
-
networkTimeout:
|
|
1683
|
-
timeout:
|
|
1684
|
-
trust:
|
|
1685
|
-
cwd:
|
|
1686
|
-
transport:
|
|
1687
|
-
alwaysAllow:
|
|
1688
|
-
tools:
|
|
1689
|
-
kiroAutoApprove:
|
|
1690
|
-
kiroAutoBlock:
|
|
1691
|
-
headers:
|
|
2217
|
+
var import_mini11 = require("zod/mini");
|
|
2218
|
+
var McpTransportTypeSchema = import_mini11.z.enum(["stdio", "sse", "http"]);
|
|
2219
|
+
var McpServerBaseSchema = import_mini11.z.object({
|
|
2220
|
+
type: import_mini11.z.optional(import_mini11.z.enum(["stdio", "sse", "http"])),
|
|
2221
|
+
command: import_mini11.z.optional(import_mini11.z.union([import_mini11.z.string(), import_mini11.z.array(import_mini11.z.string())])),
|
|
2222
|
+
args: import_mini11.z.optional(import_mini11.z.array(import_mini11.z.string())),
|
|
2223
|
+
url: import_mini11.z.optional(import_mini11.z.string()),
|
|
2224
|
+
httpUrl: import_mini11.z.optional(import_mini11.z.string()),
|
|
2225
|
+
env: import_mini11.z.optional(import_mini11.z.record(import_mini11.z.string(), import_mini11.z.string())),
|
|
2226
|
+
disabled: import_mini11.z.optional(import_mini11.z.boolean()),
|
|
2227
|
+
networkTimeout: import_mini11.z.optional(import_mini11.z.number()),
|
|
2228
|
+
timeout: import_mini11.z.optional(import_mini11.z.number()),
|
|
2229
|
+
trust: import_mini11.z.optional(import_mini11.z.boolean()),
|
|
2230
|
+
cwd: import_mini11.z.optional(import_mini11.z.string()),
|
|
2231
|
+
transport: import_mini11.z.optional(McpTransportTypeSchema),
|
|
2232
|
+
alwaysAllow: import_mini11.z.optional(import_mini11.z.array(import_mini11.z.string())),
|
|
2233
|
+
tools: import_mini11.z.optional(import_mini11.z.array(import_mini11.z.string())),
|
|
2234
|
+
kiroAutoApprove: import_mini11.z.optional(import_mini11.z.array(import_mini11.z.string())),
|
|
2235
|
+
kiroAutoBlock: import_mini11.z.optional(import_mini11.z.array(import_mini11.z.string())),
|
|
2236
|
+
headers: import_mini11.z.optional(import_mini11.z.record(import_mini11.z.string(), import_mini11.z.string()))
|
|
1692
2237
|
});
|
|
1693
|
-
var RulesyncMcpServerSchema =
|
|
1694
|
-
targets:
|
|
2238
|
+
var RulesyncMcpServerSchema = import_mini11.z.extend(McpServerBaseSchema, {
|
|
2239
|
+
targets: import_mini11.z.optional(RulesyncTargetsSchema)
|
|
1695
2240
|
});
|
|
1696
|
-
var McpConfigSchema =
|
|
1697
|
-
mcpServers:
|
|
2241
|
+
var McpConfigSchema = import_mini11.z.object({
|
|
2242
|
+
mcpServers: import_mini11.z.record(import_mini11.z.string(), McpServerBaseSchema)
|
|
1698
2243
|
});
|
|
1699
|
-
var RulesyncMcpConfigSchema =
|
|
1700
|
-
mcpServers:
|
|
2244
|
+
var RulesyncMcpConfigSchema = import_mini11.z.object({
|
|
2245
|
+
mcpServers: import_mini11.z.record(import_mini11.z.string(), RulesyncMcpServerSchema)
|
|
1701
2246
|
});
|
|
1702
2247
|
|
|
1703
2248
|
// src/mcp/rulesync-mcp.ts
|
|
@@ -1713,15 +2258,23 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
1713
2258
|
}
|
|
1714
2259
|
}
|
|
1715
2260
|
}
|
|
2261
|
+
static getSettablePaths() {
|
|
2262
|
+
return {
|
|
2263
|
+
relativeDirPath: ".rulesync",
|
|
2264
|
+
relativeFilePath: ".mcp.json"
|
|
2265
|
+
};
|
|
2266
|
+
}
|
|
1716
2267
|
validate() {
|
|
1717
2268
|
return { success: true, error: null };
|
|
1718
2269
|
}
|
|
1719
2270
|
static async fromFile({ validate = true }) {
|
|
1720
|
-
const fileContent = await readFileContent(
|
|
2271
|
+
const fileContent = await readFileContent(
|
|
2272
|
+
(0, import_node_path23.join)(this.getSettablePaths().relativeDirPath, this.getSettablePaths().relativeFilePath)
|
|
2273
|
+
);
|
|
1721
2274
|
return new _RulesyncMcp({
|
|
1722
2275
|
baseDir: ".",
|
|
1723
|
-
relativeDirPath:
|
|
1724
|
-
relativeFilePath:
|
|
2276
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2277
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1725
2278
|
fileContent,
|
|
1726
2279
|
validate
|
|
1727
2280
|
});
|
|
@@ -1751,6 +2304,9 @@ var ToolMcp = class extends ToolFile {
|
|
|
1751
2304
|
getJson() {
|
|
1752
2305
|
return this.json;
|
|
1753
2306
|
}
|
|
2307
|
+
static getSettablePaths() {
|
|
2308
|
+
throw new Error("Please implement this method in the subclass.");
|
|
2309
|
+
}
|
|
1754
2310
|
toRulesyncMcpDefault() {
|
|
1755
2311
|
return new RulesyncMcp({
|
|
1756
2312
|
baseDir: this.baseDir,
|
|
@@ -1769,15 +2325,27 @@ var ToolMcp = class extends ToolFile {
|
|
|
1769
2325
|
|
|
1770
2326
|
// src/mcp/amazonqcli-mcp.ts
|
|
1771
2327
|
var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
2328
|
+
static getSettablePaths() {
|
|
2329
|
+
return {
|
|
2330
|
+
relativeDirPath: ".amazonq",
|
|
2331
|
+
relativeFilePath: "mcp.json"
|
|
2332
|
+
};
|
|
2333
|
+
}
|
|
1772
2334
|
static async fromFile({
|
|
1773
2335
|
baseDir = ".",
|
|
1774
2336
|
validate = true
|
|
1775
2337
|
}) {
|
|
1776
|
-
const fileContent = await readFileContent(
|
|
2338
|
+
const fileContent = await readFileContent(
|
|
2339
|
+
(0, import_node_path24.join)(
|
|
2340
|
+
baseDir,
|
|
2341
|
+
this.getSettablePaths().relativeDirPath,
|
|
2342
|
+
this.getSettablePaths().relativeFilePath
|
|
2343
|
+
)
|
|
2344
|
+
);
|
|
1777
2345
|
return new _AmazonqcliMcp({
|
|
1778
2346
|
baseDir,
|
|
1779
|
-
relativeDirPath:
|
|
1780
|
-
relativeFilePath:
|
|
2347
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2348
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1781
2349
|
fileContent,
|
|
1782
2350
|
validate
|
|
1783
2351
|
});
|
|
@@ -1789,8 +2357,8 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
1789
2357
|
}) {
|
|
1790
2358
|
return new _AmazonqcliMcp({
|
|
1791
2359
|
baseDir,
|
|
1792
|
-
relativeDirPath:
|
|
1793
|
-
relativeFilePath:
|
|
2360
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2361
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1794
2362
|
fileContent: rulesyncMcp.getFileContent(),
|
|
1795
2363
|
validate
|
|
1796
2364
|
});
|
|
@@ -1804,17 +2372,29 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
1804
2372
|
};
|
|
1805
2373
|
|
|
1806
2374
|
// src/mcp/claudecode-mcp.ts
|
|
1807
|
-
var
|
|
2375
|
+
var import_node_path25 = require("path");
|
|
1808
2376
|
var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
2377
|
+
static getSettablePaths() {
|
|
2378
|
+
return {
|
|
2379
|
+
relativeDirPath: ".",
|
|
2380
|
+
relativeFilePath: ".mcp.json"
|
|
2381
|
+
};
|
|
2382
|
+
}
|
|
1809
2383
|
static async fromFile({
|
|
1810
2384
|
baseDir = ".",
|
|
1811
2385
|
validate = true
|
|
1812
2386
|
}) {
|
|
1813
|
-
const fileContent = await readFileContent(
|
|
2387
|
+
const fileContent = await readFileContent(
|
|
2388
|
+
(0, import_node_path25.join)(
|
|
2389
|
+
baseDir,
|
|
2390
|
+
this.getSettablePaths().relativeDirPath,
|
|
2391
|
+
this.getSettablePaths().relativeFilePath
|
|
2392
|
+
)
|
|
2393
|
+
);
|
|
1814
2394
|
return new _ClaudecodeMcp({
|
|
1815
|
-
baseDir
|
|
1816
|
-
relativeDirPath:
|
|
1817
|
-
relativeFilePath:
|
|
2395
|
+
baseDir,
|
|
2396
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2397
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1818
2398
|
fileContent,
|
|
1819
2399
|
validate
|
|
1820
2400
|
});
|
|
@@ -1826,8 +2406,8 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
1826
2406
|
}) {
|
|
1827
2407
|
return new _ClaudecodeMcp({
|
|
1828
2408
|
baseDir,
|
|
1829
|
-
relativeDirPath:
|
|
1830
|
-
relativeFilePath:
|
|
2409
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2410
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1831
2411
|
fileContent: rulesyncMcp.getFileContent(),
|
|
1832
2412
|
validate
|
|
1833
2413
|
});
|
|
@@ -1841,17 +2421,29 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
1841
2421
|
};
|
|
1842
2422
|
|
|
1843
2423
|
// src/mcp/cline-mcp.ts
|
|
1844
|
-
var
|
|
2424
|
+
var import_node_path26 = require("path");
|
|
1845
2425
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
2426
|
+
static getSettablePaths() {
|
|
2427
|
+
return {
|
|
2428
|
+
relativeDirPath: ".cline",
|
|
2429
|
+
relativeFilePath: "mcp.json"
|
|
2430
|
+
};
|
|
2431
|
+
}
|
|
1846
2432
|
static async fromFile({
|
|
1847
2433
|
baseDir = ".",
|
|
1848
2434
|
validate = true
|
|
1849
2435
|
}) {
|
|
1850
|
-
const fileContent = await readFileContent(
|
|
2436
|
+
const fileContent = await readFileContent(
|
|
2437
|
+
(0, import_node_path26.join)(
|
|
2438
|
+
baseDir,
|
|
2439
|
+
this.getSettablePaths().relativeDirPath,
|
|
2440
|
+
this.getSettablePaths().relativeFilePath
|
|
2441
|
+
)
|
|
2442
|
+
);
|
|
1851
2443
|
return new _ClineMcp({
|
|
1852
|
-
baseDir
|
|
1853
|
-
relativeDirPath:
|
|
1854
|
-
relativeFilePath:
|
|
2444
|
+
baseDir,
|
|
2445
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2446
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1855
2447
|
fileContent,
|
|
1856
2448
|
validate
|
|
1857
2449
|
});
|
|
@@ -1863,8 +2455,8 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
1863
2455
|
}) {
|
|
1864
2456
|
return new _ClineMcp({
|
|
1865
2457
|
baseDir,
|
|
1866
|
-
relativeDirPath:
|
|
1867
|
-
relativeFilePath:
|
|
2458
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2459
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1868
2460
|
fileContent: rulesyncMcp.getFileContent(),
|
|
1869
2461
|
validate
|
|
1870
2462
|
});
|
|
@@ -1878,17 +2470,29 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
1878
2470
|
};
|
|
1879
2471
|
|
|
1880
2472
|
// src/mcp/copilot-mcp.ts
|
|
1881
|
-
var
|
|
2473
|
+
var import_node_path27 = require("path");
|
|
1882
2474
|
var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
1883
|
-
static
|
|
2475
|
+
static getSettablePaths() {
|
|
2476
|
+
return {
|
|
2477
|
+
relativeDirPath: ".vscode",
|
|
2478
|
+
relativeFilePath: "mcp.json"
|
|
2479
|
+
};
|
|
2480
|
+
}
|
|
2481
|
+
static async fromFile({
|
|
1884
2482
|
baseDir = ".",
|
|
1885
2483
|
validate = true
|
|
1886
2484
|
}) {
|
|
1887
|
-
const fileContent = await readFileContent(
|
|
2485
|
+
const fileContent = await readFileContent(
|
|
2486
|
+
(0, import_node_path27.join)(
|
|
2487
|
+
baseDir,
|
|
2488
|
+
this.getSettablePaths().relativeDirPath,
|
|
2489
|
+
this.getSettablePaths().relativeFilePath
|
|
2490
|
+
)
|
|
2491
|
+
);
|
|
1888
2492
|
return new _CopilotMcp({
|
|
1889
|
-
baseDir
|
|
1890
|
-
relativeDirPath:
|
|
1891
|
-
relativeFilePath:
|
|
2493
|
+
baseDir,
|
|
2494
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2495
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1892
2496
|
fileContent,
|
|
1893
2497
|
validate
|
|
1894
2498
|
});
|
|
@@ -1900,8 +2504,8 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
1900
2504
|
}) {
|
|
1901
2505
|
return new _CopilotMcp({
|
|
1902
2506
|
baseDir,
|
|
1903
|
-
relativeDirPath:
|
|
1904
|
-
relativeFilePath:
|
|
2507
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2508
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1905
2509
|
fileContent: rulesyncMcp.getFileContent(),
|
|
1906
2510
|
validate
|
|
1907
2511
|
});
|
|
@@ -1915,17 +2519,29 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
1915
2519
|
};
|
|
1916
2520
|
|
|
1917
2521
|
// src/mcp/cursor-mcp.ts
|
|
1918
|
-
var
|
|
2522
|
+
var import_node_path28 = require("path");
|
|
1919
2523
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
2524
|
+
static getSettablePaths() {
|
|
2525
|
+
return {
|
|
2526
|
+
relativeDirPath: ".cursor",
|
|
2527
|
+
relativeFilePath: "mcp.json"
|
|
2528
|
+
};
|
|
2529
|
+
}
|
|
1920
2530
|
static async fromFile({
|
|
1921
2531
|
baseDir = ".",
|
|
1922
2532
|
validate = true
|
|
1923
2533
|
}) {
|
|
1924
|
-
const fileContent = await readFileContent(
|
|
2534
|
+
const fileContent = await readFileContent(
|
|
2535
|
+
(0, import_node_path28.join)(
|
|
2536
|
+
baseDir,
|
|
2537
|
+
this.getSettablePaths().relativeDirPath,
|
|
2538
|
+
this.getSettablePaths().relativeFilePath
|
|
2539
|
+
)
|
|
2540
|
+
);
|
|
1925
2541
|
return new _CursorMcp({
|
|
1926
|
-
baseDir
|
|
1927
|
-
relativeDirPath:
|
|
1928
|
-
relativeFilePath:
|
|
2542
|
+
baseDir,
|
|
2543
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2544
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1929
2545
|
fileContent,
|
|
1930
2546
|
validate
|
|
1931
2547
|
});
|
|
@@ -1942,8 +2558,8 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
1942
2558
|
const fileContent = JSON.stringify(cursorConfig, null, 2);
|
|
1943
2559
|
return new _CursorMcp({
|
|
1944
2560
|
baseDir,
|
|
1945
|
-
relativeDirPath:
|
|
1946
|
-
relativeFilePath:
|
|
2561
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2562
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1947
2563
|
fileContent,
|
|
1948
2564
|
validate
|
|
1949
2565
|
});
|
|
@@ -1963,17 +2579,29 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
1963
2579
|
};
|
|
1964
2580
|
|
|
1965
2581
|
// src/mcp/roo-mcp.ts
|
|
1966
|
-
var
|
|
2582
|
+
var import_node_path29 = require("path");
|
|
1967
2583
|
var RooMcp = class _RooMcp extends ToolMcp {
|
|
2584
|
+
static getSettablePaths() {
|
|
2585
|
+
return {
|
|
2586
|
+
relativeDirPath: ".roo",
|
|
2587
|
+
relativeFilePath: "mcp.json"
|
|
2588
|
+
};
|
|
2589
|
+
}
|
|
1968
2590
|
static async fromFile({
|
|
1969
2591
|
baseDir = ".",
|
|
1970
2592
|
validate = true
|
|
1971
2593
|
}) {
|
|
1972
|
-
const fileContent = await readFileContent(
|
|
2594
|
+
const fileContent = await readFileContent(
|
|
2595
|
+
(0, import_node_path29.join)(
|
|
2596
|
+
baseDir,
|
|
2597
|
+
this.getSettablePaths().relativeDirPath,
|
|
2598
|
+
this.getSettablePaths().relativeFilePath
|
|
2599
|
+
)
|
|
2600
|
+
);
|
|
1973
2601
|
return new _RooMcp({
|
|
1974
|
-
baseDir
|
|
1975
|
-
relativeDirPath:
|
|
1976
|
-
relativeFilePath:
|
|
2602
|
+
baseDir,
|
|
2603
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2604
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1977
2605
|
fileContent,
|
|
1978
2606
|
validate
|
|
1979
2607
|
});
|
|
@@ -1986,8 +2614,8 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
1986
2614
|
const fileContent = rulesyncMcp.getFileContent();
|
|
1987
2615
|
return new _RooMcp({
|
|
1988
2616
|
baseDir,
|
|
1989
|
-
relativeDirPath:
|
|
1990
|
-
relativeFilePath:
|
|
2617
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2618
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1991
2619
|
fileContent,
|
|
1992
2620
|
validate
|
|
1993
2621
|
});
|
|
@@ -2009,7 +2637,7 @@ var mcpProcessorToolTargets = [
|
|
|
2009
2637
|
"cursor",
|
|
2010
2638
|
"roo"
|
|
2011
2639
|
];
|
|
2012
|
-
var McpProcessorToolTargetSchema =
|
|
2640
|
+
var McpProcessorToolTargetSchema = import_mini12.z.enum(mcpProcessorToolTargets);
|
|
2013
2641
|
var McpProcessor = class extends FeatureProcessor {
|
|
2014
2642
|
toolTarget;
|
|
2015
2643
|
constructor({
|
|
@@ -2168,26 +2796,187 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
2168
2796
|
};
|
|
2169
2797
|
|
|
2170
2798
|
// src/rules/rules-processor.ts
|
|
2171
|
-
var
|
|
2799
|
+
var import_node_path50 = require("path");
|
|
2172
2800
|
var import_fast_xml_parser = require("fast-xml-parser");
|
|
2173
|
-
var
|
|
2801
|
+
var import_mini18 = require("zod/mini");
|
|
2802
|
+
|
|
2803
|
+
// src/constants/paths.ts
|
|
2804
|
+
var import_node_path30 = require("path");
|
|
2805
|
+
var RULESYNC_DIR = ".rulesync";
|
|
2806
|
+
var RULESYNC_RULES_DIR = (0, import_node_path30.join)(".rulesync", "rules");
|
|
2807
|
+
var RULESYNC_RULES_DIR_LEGACY = ".rulesync";
|
|
2808
|
+
var RULESYNC_MCP_FILE = (0, import_node_path30.join)(".rulesync", ".mcp.json");
|
|
2809
|
+
var RULESYNC_SUBAGENTS_DIR = (0, import_node_path30.join)(".rulesync", "subagents");
|
|
2810
|
+
|
|
2811
|
+
// src/subagents/simulated-subagent.ts
|
|
2812
|
+
var import_node_path31 = require("path");
|
|
2813
|
+
var import_mini13 = require("zod/mini");
|
|
2814
|
+
|
|
2815
|
+
// src/subagents/tool-subagent.ts
|
|
2816
|
+
var ToolSubagent = class extends ToolFile {
|
|
2817
|
+
static getSettablePaths() {
|
|
2818
|
+
throw new Error("Please implement this method in the subclass.");
|
|
2819
|
+
}
|
|
2820
|
+
static async fromFile(_params) {
|
|
2821
|
+
throw new Error("Please implement this method in the subclass.");
|
|
2822
|
+
}
|
|
2823
|
+
static fromRulesyncSubagent(_params) {
|
|
2824
|
+
throw new Error("Please implement this method in the subclass.");
|
|
2825
|
+
}
|
|
2826
|
+
};
|
|
2827
|
+
|
|
2828
|
+
// src/subagents/simulated-subagent.ts
|
|
2829
|
+
var SimulatedSubagentFrontmatterSchema = import_mini13.z.object({
|
|
2830
|
+
name: import_mini13.z.string(),
|
|
2831
|
+
description: import_mini13.z.string()
|
|
2832
|
+
});
|
|
2833
|
+
var SimulatedSubagent = class extends ToolSubagent {
|
|
2834
|
+
frontmatter;
|
|
2835
|
+
body;
|
|
2836
|
+
constructor({ frontmatter, body, ...rest }) {
|
|
2837
|
+
if (rest.validate) {
|
|
2838
|
+
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
2839
|
+
if (!result.success) {
|
|
2840
|
+
throw result.error;
|
|
2841
|
+
}
|
|
2842
|
+
}
|
|
2843
|
+
super({
|
|
2844
|
+
...rest,
|
|
2845
|
+
fileContent: stringifyFrontmatter(body, frontmatter)
|
|
2846
|
+
});
|
|
2847
|
+
this.frontmatter = frontmatter;
|
|
2848
|
+
this.body = body;
|
|
2849
|
+
}
|
|
2850
|
+
getBody() {
|
|
2851
|
+
return this.body;
|
|
2852
|
+
}
|
|
2853
|
+
getFrontmatter() {
|
|
2854
|
+
return this.frontmatter;
|
|
2855
|
+
}
|
|
2856
|
+
toRulesyncSubagent() {
|
|
2857
|
+
throw new Error("Not implemented because it is a SIMULATED file.");
|
|
2858
|
+
}
|
|
2859
|
+
static fromRulesyncSubagentDefault({
|
|
2860
|
+
baseDir = ".",
|
|
2861
|
+
rulesyncSubagent,
|
|
2862
|
+
validate = true
|
|
2863
|
+
}) {
|
|
2864
|
+
const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
|
|
2865
|
+
const simulatedFrontmatter = {
|
|
2866
|
+
name: rulesyncFrontmatter.name,
|
|
2867
|
+
description: rulesyncFrontmatter.description
|
|
2868
|
+
};
|
|
2869
|
+
const body = rulesyncSubagent.getBody();
|
|
2870
|
+
return {
|
|
2871
|
+
baseDir,
|
|
2872
|
+
frontmatter: simulatedFrontmatter,
|
|
2873
|
+
body,
|
|
2874
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2875
|
+
relativeFilePath: rulesyncSubagent.getRelativeFilePath(),
|
|
2876
|
+
validate
|
|
2877
|
+
};
|
|
2878
|
+
}
|
|
2879
|
+
validate() {
|
|
2880
|
+
if (!this.frontmatter) {
|
|
2881
|
+
return { success: true, error: null };
|
|
2882
|
+
}
|
|
2883
|
+
const result = SimulatedSubagentFrontmatterSchema.safeParse(this.frontmatter);
|
|
2884
|
+
if (result.success) {
|
|
2885
|
+
return { success: true, error: null };
|
|
2886
|
+
} else {
|
|
2887
|
+
return { success: false, error: result.error };
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
static async fromFileDefault({
|
|
2891
|
+
baseDir = ".",
|
|
2892
|
+
relativeFilePath,
|
|
2893
|
+
validate = true
|
|
2894
|
+
}) {
|
|
2895
|
+
const filePath = (0, import_node_path31.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
2896
|
+
const fileContent = await readFileContent(filePath);
|
|
2897
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2898
|
+
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
2899
|
+
if (!result.success) {
|
|
2900
|
+
throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
|
|
2901
|
+
}
|
|
2902
|
+
return {
|
|
2903
|
+
baseDir,
|
|
2904
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2905
|
+
relativeFilePath: (0, import_node_path31.basename)(relativeFilePath),
|
|
2906
|
+
frontmatter: result.data,
|
|
2907
|
+
body: content.trim(),
|
|
2908
|
+
validate
|
|
2909
|
+
};
|
|
2910
|
+
}
|
|
2911
|
+
};
|
|
2912
|
+
|
|
2913
|
+
// src/subagents/codexcli-subagent.ts
|
|
2914
|
+
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
2915
|
+
static getSettablePaths() {
|
|
2916
|
+
return {
|
|
2917
|
+
relativeDirPath: ".codex/subagents"
|
|
2918
|
+
};
|
|
2919
|
+
}
|
|
2920
|
+
static async fromFile(params) {
|
|
2921
|
+
const baseParams = await this.fromFileDefault(params);
|
|
2922
|
+
return new _CodexCliSubagent(baseParams);
|
|
2923
|
+
}
|
|
2924
|
+
static fromRulesyncSubagent(params) {
|
|
2925
|
+
const baseParams = this.fromRulesyncSubagentDefault(params);
|
|
2926
|
+
return new _CodexCliSubagent(baseParams);
|
|
2927
|
+
}
|
|
2928
|
+
};
|
|
2929
|
+
|
|
2930
|
+
// src/subagents/copilot-subagent.ts
|
|
2931
|
+
var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
|
|
2932
|
+
static getSettablePaths() {
|
|
2933
|
+
return {
|
|
2934
|
+
relativeDirPath: ".copilot/subagents"
|
|
2935
|
+
};
|
|
2936
|
+
}
|
|
2937
|
+
static async fromFile(params) {
|
|
2938
|
+
const baseParams = await this.fromFileDefault(params);
|
|
2939
|
+
return new _CopilotSubagent(baseParams);
|
|
2940
|
+
}
|
|
2941
|
+
static fromRulesyncSubagent(params) {
|
|
2942
|
+
const baseParams = this.fromRulesyncSubagentDefault(params);
|
|
2943
|
+
return new _CopilotSubagent(baseParams);
|
|
2944
|
+
}
|
|
2945
|
+
};
|
|
2946
|
+
|
|
2947
|
+
// src/subagents/cursor-subagent.ts
|
|
2948
|
+
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
2949
|
+
static getSettablePaths() {
|
|
2950
|
+
return {
|
|
2951
|
+
relativeDirPath: ".cursor/subagents"
|
|
2952
|
+
};
|
|
2953
|
+
}
|
|
2954
|
+
static async fromFile(params) {
|
|
2955
|
+
const baseParams = await this.fromFileDefault(params);
|
|
2956
|
+
return new _CursorSubagent(baseParams);
|
|
2957
|
+
}
|
|
2958
|
+
static fromRulesyncSubagent(params) {
|
|
2959
|
+
const baseParams = this.fromRulesyncSubagentDefault(params);
|
|
2960
|
+
return new _CursorSubagent(baseParams);
|
|
2961
|
+
}
|
|
2962
|
+
};
|
|
2174
2963
|
|
|
2175
2964
|
// src/rules/agentsmd-rule.ts
|
|
2176
|
-
var
|
|
2965
|
+
var import_node_path33 = require("path");
|
|
2177
2966
|
|
|
2178
2967
|
// src/rules/rulesync-rule.ts
|
|
2179
|
-
var
|
|
2180
|
-
var
|
|
2181
|
-
var RulesyncRuleFrontmatterSchema =
|
|
2182
|
-
root:
|
|
2183
|
-
targets:
|
|
2184
|
-
description:
|
|
2185
|
-
globs:
|
|
2186
|
-
cursor:
|
|
2187
|
-
|
|
2188
|
-
alwaysApply:
|
|
2189
|
-
description:
|
|
2190
|
-
globs:
|
|
2968
|
+
var import_node_path32 = require("path");
|
|
2969
|
+
var import_mini14 = require("zod/mini");
|
|
2970
|
+
var RulesyncRuleFrontmatterSchema = import_mini14.z.object({
|
|
2971
|
+
root: import_mini14.z.optional(import_mini14.z.optional(import_mini14.z.boolean())),
|
|
2972
|
+
targets: import_mini14.z.optional(RulesyncTargetsSchema),
|
|
2973
|
+
description: import_mini14.z.optional(import_mini14.z.string()),
|
|
2974
|
+
globs: import_mini14.z.optional(import_mini14.z.array(import_mini14.z.string())),
|
|
2975
|
+
cursor: import_mini14.z.optional(
|
|
2976
|
+
import_mini14.z.object({
|
|
2977
|
+
alwaysApply: import_mini14.z.optional(import_mini14.z.boolean()),
|
|
2978
|
+
description: import_mini14.z.optional(import_mini14.z.string()),
|
|
2979
|
+
globs: import_mini14.z.optional(import_mini14.z.array(import_mini14.z.string()))
|
|
2191
2980
|
})
|
|
2192
2981
|
)
|
|
2193
2982
|
});
|
|
@@ -2208,6 +2997,16 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
2208
2997
|
this.frontmatter = frontmatter;
|
|
2209
2998
|
this.body = body;
|
|
2210
2999
|
}
|
|
3000
|
+
static getSettablePaths() {
|
|
3001
|
+
return {
|
|
3002
|
+
recommended: {
|
|
3003
|
+
relativeDirPath: ".rulesync/rules"
|
|
3004
|
+
},
|
|
3005
|
+
legacy: {
|
|
3006
|
+
relativeDirPath: ".rulesync"
|
|
3007
|
+
}
|
|
3008
|
+
};
|
|
3009
|
+
}
|
|
2211
3010
|
getFrontmatter() {
|
|
2212
3011
|
return this.frontmatter;
|
|
2213
3012
|
}
|
|
@@ -2226,7 +3025,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
2226
3025
|
relativeFilePath,
|
|
2227
3026
|
validate = true
|
|
2228
3027
|
}) {
|
|
2229
|
-
const filePath = (0,
|
|
3028
|
+
const filePath = (0, import_node_path32.join)(this.getSettablePaths().legacy.relativeDirPath, relativeFilePath);
|
|
2230
3029
|
const fileContent = await readFileContent(filePath);
|
|
2231
3030
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2232
3031
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2240,10 +3039,10 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
2240
3039
|
globs: result.data.globs ?? [],
|
|
2241
3040
|
cursor: result.data.cursor
|
|
2242
3041
|
};
|
|
2243
|
-
const filename = (0,
|
|
3042
|
+
const filename = (0, import_node_path32.basename)(filePath);
|
|
2244
3043
|
return new _RulesyncRule({
|
|
2245
3044
|
baseDir: ".",
|
|
2246
|
-
relativeDirPath:
|
|
3045
|
+
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
2247
3046
|
relativeFilePath: filename,
|
|
2248
3047
|
frontmatter: validatedFrontmatter,
|
|
2249
3048
|
body: content.trim(),
|
|
@@ -2254,7 +3053,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
2254
3053
|
relativeFilePath,
|
|
2255
3054
|
validate = true
|
|
2256
3055
|
}) {
|
|
2257
|
-
const filePath = (0,
|
|
3056
|
+
const filePath = (0, import_node_path32.join)(this.getSettablePaths().recommended.relativeDirPath, relativeFilePath);
|
|
2258
3057
|
const fileContent = await readFileContent(filePath);
|
|
2259
3058
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2260
3059
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2268,10 +3067,10 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
2268
3067
|
globs: result.data.globs ?? [],
|
|
2269
3068
|
cursor: result.data.cursor
|
|
2270
3069
|
};
|
|
2271
|
-
const filename = (0,
|
|
3070
|
+
const filename = (0, import_node_path32.basename)(filePath);
|
|
2272
3071
|
return new _RulesyncRule({
|
|
2273
3072
|
baseDir: ".",
|
|
2274
|
-
relativeDirPath:
|
|
3073
|
+
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
2275
3074
|
relativeFilePath: filename,
|
|
2276
3075
|
frontmatter: validatedFrontmatter,
|
|
2277
3076
|
body: content.trim(),
|
|
@@ -2341,17 +3140,28 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
2341
3140
|
root: root ?? false
|
|
2342
3141
|
});
|
|
2343
3142
|
}
|
|
3143
|
+
static getSettablePaths() {
|
|
3144
|
+
return {
|
|
3145
|
+
root: {
|
|
3146
|
+
relativeDirPath: ".",
|
|
3147
|
+
relativeFilePath: "AGENTS.md"
|
|
3148
|
+
},
|
|
3149
|
+
nonRoot: {
|
|
3150
|
+
relativeDirPath: ".agents/memories"
|
|
3151
|
+
}
|
|
3152
|
+
};
|
|
3153
|
+
}
|
|
2344
3154
|
static async fromFile({
|
|
2345
3155
|
baseDir = ".",
|
|
2346
3156
|
relativeFilePath,
|
|
2347
3157
|
validate = true
|
|
2348
3158
|
}) {
|
|
2349
3159
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
2350
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
2351
|
-
const fileContent = await readFileContent((0,
|
|
3160
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path33.join)(".agents/memories", relativeFilePath);
|
|
3161
|
+
const fileContent = await readFileContent((0, import_node_path33.join)(baseDir, relativePath));
|
|
2352
3162
|
return new _AgentsMdRule({
|
|
2353
3163
|
baseDir,
|
|
2354
|
-
relativeDirPath: isRoot ?
|
|
3164
|
+
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
2355
3165
|
relativeFilePath: isRoot ? "AGENTS.md" : relativeFilePath,
|
|
2356
3166
|
fileContent,
|
|
2357
3167
|
validate,
|
|
@@ -2367,7 +3177,9 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
2367
3177
|
this.buildToolRuleParamsDefault({
|
|
2368
3178
|
baseDir,
|
|
2369
3179
|
rulesyncRule,
|
|
2370
|
-
validate
|
|
3180
|
+
validate,
|
|
3181
|
+
rootPath: this.getSettablePaths().root,
|
|
3182
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
2371
3183
|
})
|
|
2372
3184
|
);
|
|
2373
3185
|
}
|
|
@@ -2380,17 +3192,26 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
2380
3192
|
};
|
|
2381
3193
|
|
|
2382
3194
|
// src/rules/amazonqcli-rule.ts
|
|
2383
|
-
var
|
|
3195
|
+
var import_node_path34 = require("path");
|
|
2384
3196
|
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
3197
|
+
static getSettablePaths() {
|
|
3198
|
+
return {
|
|
3199
|
+
nonRoot: {
|
|
3200
|
+
relativeDirPath: ".amazonq/rules"
|
|
3201
|
+
}
|
|
3202
|
+
};
|
|
3203
|
+
}
|
|
2385
3204
|
static async fromFile({
|
|
2386
3205
|
baseDir = ".",
|
|
2387
3206
|
relativeFilePath,
|
|
2388
3207
|
validate = true
|
|
2389
3208
|
}) {
|
|
2390
|
-
const fileContent = await readFileContent(
|
|
3209
|
+
const fileContent = await readFileContent(
|
|
3210
|
+
(0, import_node_path34.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
3211
|
+
);
|
|
2391
3212
|
return new _AmazonQCliRule({
|
|
2392
3213
|
baseDir,
|
|
2393
|
-
relativeDirPath:
|
|
3214
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
2394
3215
|
relativeFilePath,
|
|
2395
3216
|
fileContent,
|
|
2396
3217
|
validate,
|
|
@@ -2407,7 +3228,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
2407
3228
|
baseDir,
|
|
2408
3229
|
rulesyncRule,
|
|
2409
3230
|
validate,
|
|
2410
|
-
nonRootPath:
|
|
3231
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
2411
3232
|
})
|
|
2412
3233
|
);
|
|
2413
3234
|
}
|
|
@@ -2420,7 +3241,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
2420
3241
|
};
|
|
2421
3242
|
|
|
2422
3243
|
// src/rules/augmentcode-legacy-rule.ts
|
|
2423
|
-
var
|
|
3244
|
+
var import_node_path35 = require("path");
|
|
2424
3245
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
2425
3246
|
toRulesyncRule() {
|
|
2426
3247
|
const rulesyncFrontmatter = {
|
|
@@ -2438,6 +3259,17 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
2438
3259
|
validate: true
|
|
2439
3260
|
});
|
|
2440
3261
|
}
|
|
3262
|
+
static getSettablePaths() {
|
|
3263
|
+
return {
|
|
3264
|
+
root: {
|
|
3265
|
+
relativeDirPath: ".",
|
|
3266
|
+
relativeFilePath: ".augment-guidelines"
|
|
3267
|
+
},
|
|
3268
|
+
nonRoot: {
|
|
3269
|
+
relativeDirPath: ".augment/rules"
|
|
3270
|
+
}
|
|
3271
|
+
};
|
|
3272
|
+
}
|
|
2441
3273
|
static fromRulesyncRule({
|
|
2442
3274
|
baseDir = ".",
|
|
2443
3275
|
rulesyncRule,
|
|
@@ -2448,8 +3280,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
2448
3280
|
baseDir,
|
|
2449
3281
|
rulesyncRule,
|
|
2450
3282
|
validate,
|
|
2451
|
-
rootPath:
|
|
2452
|
-
nonRootPath:
|
|
3283
|
+
rootPath: this.getSettablePaths().root,
|
|
3284
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
2453
3285
|
})
|
|
2454
3286
|
);
|
|
2455
3287
|
}
|
|
@@ -2461,13 +3293,14 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
2461
3293
|
relativeFilePath,
|
|
2462
3294
|
validate = true
|
|
2463
3295
|
}) {
|
|
2464
|
-
const
|
|
2465
|
-
const
|
|
2466
|
-
const
|
|
3296
|
+
const settablePaths = this.getSettablePaths();
|
|
3297
|
+
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
3298
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path35.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
3299
|
+
const fileContent = await readFileContent((0, import_node_path35.join)(baseDir, relativePath));
|
|
2467
3300
|
return new _AugmentcodeLegacyRule({
|
|
2468
3301
|
baseDir,
|
|
2469
|
-
relativeDirPath: isRoot ?
|
|
2470
|
-
relativeFilePath: isRoot ?
|
|
3302
|
+
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
3303
|
+
relativeFilePath: isRoot ? settablePaths.root.relativeFilePath : relativeFilePath,
|
|
2471
3304
|
fileContent,
|
|
2472
3305
|
validate,
|
|
2473
3306
|
root: isRoot
|
|
@@ -2476,11 +3309,18 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
2476
3309
|
};
|
|
2477
3310
|
|
|
2478
3311
|
// src/rules/augmentcode-rule.ts
|
|
2479
|
-
var
|
|
3312
|
+
var import_node_path36 = require("path");
|
|
2480
3313
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
2481
3314
|
toRulesyncRule() {
|
|
2482
3315
|
return this.toRulesyncRuleDefault();
|
|
2483
3316
|
}
|
|
3317
|
+
static getSettablePaths() {
|
|
3318
|
+
return {
|
|
3319
|
+
nonRoot: {
|
|
3320
|
+
relativeDirPath: ".augment/rules"
|
|
3321
|
+
}
|
|
3322
|
+
};
|
|
3323
|
+
}
|
|
2484
3324
|
static fromRulesyncRule({
|
|
2485
3325
|
baseDir = ".",
|
|
2486
3326
|
rulesyncRule,
|
|
@@ -2491,7 +3331,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
2491
3331
|
baseDir,
|
|
2492
3332
|
rulesyncRule,
|
|
2493
3333
|
validate,
|
|
2494
|
-
nonRootPath:
|
|
3334
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
2495
3335
|
})
|
|
2496
3336
|
);
|
|
2497
3337
|
}
|
|
@@ -2500,11 +3340,13 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
2500
3340
|
relativeFilePath,
|
|
2501
3341
|
validate = true
|
|
2502
3342
|
}) {
|
|
2503
|
-
const fileContent = await readFileContent(
|
|
3343
|
+
const fileContent = await readFileContent(
|
|
3344
|
+
(0, import_node_path36.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
3345
|
+
);
|
|
2504
3346
|
const { body: content } = parseFrontmatter(fileContent);
|
|
2505
3347
|
return new _AugmentcodeRule({
|
|
2506
3348
|
baseDir,
|
|
2507
|
-
relativeDirPath:
|
|
3349
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
2508
3350
|
relativeFilePath,
|
|
2509
3351
|
fileContent: content.trim(),
|
|
2510
3352
|
validate
|
|
@@ -2513,23 +3355,34 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
2513
3355
|
validate() {
|
|
2514
3356
|
return { success: true, error: null };
|
|
2515
3357
|
}
|
|
2516
|
-
};
|
|
2517
|
-
|
|
2518
|
-
// src/rules/claudecode-rule.ts
|
|
2519
|
-
var
|
|
2520
|
-
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
3358
|
+
};
|
|
3359
|
+
|
|
3360
|
+
// src/rules/claudecode-rule.ts
|
|
3361
|
+
var import_node_path37 = require("path");
|
|
3362
|
+
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
3363
|
+
static getSettablePaths() {
|
|
3364
|
+
return {
|
|
3365
|
+
root: {
|
|
3366
|
+
relativeDirPath: ".",
|
|
3367
|
+
relativeFilePath: "CLAUDE.md"
|
|
3368
|
+
},
|
|
3369
|
+
nonRoot: {
|
|
3370
|
+
relativeDirPath: ".claude/memories"
|
|
3371
|
+
}
|
|
3372
|
+
};
|
|
3373
|
+
}
|
|
2521
3374
|
static async fromFile({
|
|
2522
3375
|
baseDir = ".",
|
|
2523
3376
|
relativeFilePath,
|
|
2524
3377
|
validate = true
|
|
2525
3378
|
}) {
|
|
2526
|
-
const isRoot = relativeFilePath ===
|
|
2527
|
-
const relativePath = isRoot ?
|
|
2528
|
-
const fileContent = await readFileContent((0,
|
|
3379
|
+
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
3380
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path37.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
3381
|
+
const fileContent = await readFileContent((0, import_node_path37.join)(baseDir, relativePath));
|
|
2529
3382
|
return new _ClaudecodeRule({
|
|
2530
3383
|
baseDir,
|
|
2531
|
-
relativeDirPath: isRoot ?
|
|
2532
|
-
relativeFilePath: isRoot ?
|
|
3384
|
+
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
3385
|
+
relativeFilePath: isRoot ? this.getSettablePaths().root.relativeFilePath : relativeFilePath,
|
|
2533
3386
|
fileContent,
|
|
2534
3387
|
validate,
|
|
2535
3388
|
root: isRoot
|
|
@@ -2545,8 +3398,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
2545
3398
|
baseDir,
|
|
2546
3399
|
rulesyncRule,
|
|
2547
3400
|
validate,
|
|
2548
|
-
rootPath:
|
|
2549
|
-
nonRootPath:
|
|
3401
|
+
rootPath: this.getSettablePaths().root,
|
|
3402
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
2550
3403
|
})
|
|
2551
3404
|
);
|
|
2552
3405
|
}
|
|
@@ -2559,12 +3412,19 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
2559
3412
|
};
|
|
2560
3413
|
|
|
2561
3414
|
// src/rules/cline-rule.ts
|
|
2562
|
-
var
|
|
2563
|
-
var
|
|
2564
|
-
var ClineRuleFrontmatterSchema =
|
|
2565
|
-
description:
|
|
3415
|
+
var import_node_path38 = require("path");
|
|
3416
|
+
var import_mini15 = require("zod/mini");
|
|
3417
|
+
var ClineRuleFrontmatterSchema = import_mini15.z.object({
|
|
3418
|
+
description: import_mini15.z.string()
|
|
2566
3419
|
});
|
|
2567
3420
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
3421
|
+
static getSettablePaths() {
|
|
3422
|
+
return {
|
|
3423
|
+
nonRoot: {
|
|
3424
|
+
relativeDirPath: ".clinerules"
|
|
3425
|
+
}
|
|
3426
|
+
};
|
|
3427
|
+
}
|
|
2568
3428
|
toRulesyncRule() {
|
|
2569
3429
|
return this.toRulesyncRuleDefault();
|
|
2570
3430
|
}
|
|
@@ -2578,7 +3438,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
2578
3438
|
baseDir,
|
|
2579
3439
|
rulesyncRule,
|
|
2580
3440
|
validate,
|
|
2581
|
-
nonRootPath:
|
|
3441
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
2582
3442
|
})
|
|
2583
3443
|
);
|
|
2584
3444
|
}
|
|
@@ -2590,10 +3450,12 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
2590
3450
|
relativeFilePath,
|
|
2591
3451
|
validate = true
|
|
2592
3452
|
}) {
|
|
2593
|
-
const fileContent = await readFileContent(
|
|
3453
|
+
const fileContent = await readFileContent(
|
|
3454
|
+
(0, import_node_path38.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
3455
|
+
);
|
|
2594
3456
|
return new _ClineRule({
|
|
2595
3457
|
baseDir,
|
|
2596
|
-
relativeDirPath:
|
|
3458
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
2597
3459
|
relativeFilePath,
|
|
2598
3460
|
fileContent,
|
|
2599
3461
|
validate
|
|
@@ -2602,19 +3464,30 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
2602
3464
|
};
|
|
2603
3465
|
|
|
2604
3466
|
// src/rules/codexcli-rule.ts
|
|
2605
|
-
var
|
|
3467
|
+
var import_node_path39 = require("path");
|
|
2606
3468
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
3469
|
+
static getSettablePaths() {
|
|
3470
|
+
return {
|
|
3471
|
+
root: {
|
|
3472
|
+
relativeDirPath: ".",
|
|
3473
|
+
relativeFilePath: "AGENTS.md"
|
|
3474
|
+
},
|
|
3475
|
+
nonRoot: {
|
|
3476
|
+
relativeDirPath: ".codex/memories"
|
|
3477
|
+
}
|
|
3478
|
+
};
|
|
3479
|
+
}
|
|
2607
3480
|
static async fromFile({
|
|
2608
3481
|
baseDir = ".",
|
|
2609
3482
|
relativeFilePath,
|
|
2610
3483
|
validate = true
|
|
2611
3484
|
}) {
|
|
2612
3485
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
2613
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
2614
|
-
const fileContent = await readFileContent((0,
|
|
3486
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path39.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
3487
|
+
const fileContent = await readFileContent((0, import_node_path39.join)(baseDir, relativePath));
|
|
2615
3488
|
return new _CodexcliRule({
|
|
2616
3489
|
baseDir,
|
|
2617
|
-
relativeDirPath: isRoot ?
|
|
3490
|
+
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
2618
3491
|
relativeFilePath: isRoot ? "AGENTS.md" : relativeFilePath,
|
|
2619
3492
|
fileContent,
|
|
2620
3493
|
validate,
|
|
@@ -2631,8 +3504,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
2631
3504
|
baseDir,
|
|
2632
3505
|
rulesyncRule,
|
|
2633
3506
|
validate,
|
|
2634
|
-
rootPath:
|
|
2635
|
-
nonRootPath:
|
|
3507
|
+
rootPath: this.getSettablePaths().root,
|
|
3508
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
2636
3509
|
})
|
|
2637
3510
|
);
|
|
2638
3511
|
}
|
|
@@ -2645,15 +3518,26 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
2645
3518
|
};
|
|
2646
3519
|
|
|
2647
3520
|
// src/rules/copilot-rule.ts
|
|
2648
|
-
var
|
|
2649
|
-
var
|
|
2650
|
-
var CopilotRuleFrontmatterSchema =
|
|
2651
|
-
description:
|
|
2652
|
-
applyTo:
|
|
3521
|
+
var import_node_path40 = require("path");
|
|
3522
|
+
var import_mini16 = require("zod/mini");
|
|
3523
|
+
var CopilotRuleFrontmatterSchema = import_mini16.z.object({
|
|
3524
|
+
description: import_mini16.z.optional(import_mini16.z.string()),
|
|
3525
|
+
applyTo: import_mini16.z.optional(import_mini16.z.string())
|
|
2653
3526
|
});
|
|
2654
3527
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
2655
3528
|
frontmatter;
|
|
2656
3529
|
body;
|
|
3530
|
+
static getSettablePaths() {
|
|
3531
|
+
return {
|
|
3532
|
+
root: {
|
|
3533
|
+
relativeDirPath: ".github",
|
|
3534
|
+
relativeFilePath: "copilot-instructions.md"
|
|
3535
|
+
},
|
|
3536
|
+
nonRoot: {
|
|
3537
|
+
relativeDirPath: ".github/instructions"
|
|
3538
|
+
}
|
|
3539
|
+
};
|
|
3540
|
+
}
|
|
2657
3541
|
constructor({ frontmatter, body, ...rest }) {
|
|
2658
3542
|
if (rest.validate) {
|
|
2659
3543
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2693,7 +3577,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
2693
3577
|
const root = rulesyncFrontmatter.root;
|
|
2694
3578
|
const copilotFrontmatter = {
|
|
2695
3579
|
description: rulesyncFrontmatter.description,
|
|
2696
|
-
applyTo: rulesyncFrontmatter.globs?.join(",")
|
|
3580
|
+
applyTo: rulesyncFrontmatter.globs?.length ? rulesyncFrontmatter.globs.join(",") : void 0
|
|
2697
3581
|
};
|
|
2698
3582
|
const body = rulesyncRule.getBody();
|
|
2699
3583
|
if (root) {
|
|
@@ -2701,8 +3585,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
2701
3585
|
baseDir,
|
|
2702
3586
|
frontmatter: copilotFrontmatter,
|
|
2703
3587
|
body,
|
|
2704
|
-
relativeDirPath:
|
|
2705
|
-
relativeFilePath:
|
|
3588
|
+
relativeDirPath: this.getSettablePaths().root.relativeDirPath,
|
|
3589
|
+
relativeFilePath: this.getSettablePaths().root.relativeFilePath,
|
|
2706
3590
|
validate,
|
|
2707
3591
|
root
|
|
2708
3592
|
});
|
|
@@ -2714,7 +3598,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
2714
3598
|
baseDir,
|
|
2715
3599
|
frontmatter: copilotFrontmatter,
|
|
2716
3600
|
body,
|
|
2717
|
-
relativeDirPath:
|
|
3601
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
2718
3602
|
relativeFilePath: newFileName,
|
|
2719
3603
|
validate,
|
|
2720
3604
|
root
|
|
@@ -2726,13 +3610,16 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
2726
3610
|
validate = true
|
|
2727
3611
|
}) {
|
|
2728
3612
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
2729
|
-
const relativePath = isRoot ?
|
|
2730
|
-
|
|
3613
|
+
const relativePath = isRoot ? (0, import_node_path40.join)(
|
|
3614
|
+
this.getSettablePaths().root.relativeDirPath,
|
|
3615
|
+
this.getSettablePaths().root.relativeFilePath
|
|
3616
|
+
) : (0, import_node_path40.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
3617
|
+
const fileContent = await readFileContent((0, import_node_path40.join)(baseDir, relativePath));
|
|
2731
3618
|
if (isRoot) {
|
|
2732
3619
|
return new _CopilotRule({
|
|
2733
3620
|
baseDir,
|
|
2734
|
-
relativeDirPath:
|
|
2735
|
-
relativeFilePath: isRoot ?
|
|
3621
|
+
relativeDirPath: this.getSettablePaths().root.relativeDirPath,
|
|
3622
|
+
relativeFilePath: isRoot ? this.getSettablePaths().root.relativeFilePath : relativeFilePath,
|
|
2736
3623
|
frontmatter: {
|
|
2737
3624
|
description: "",
|
|
2738
3625
|
applyTo: "**"
|
|
@@ -2746,13 +3633,13 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
2746
3633
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
2747
3634
|
if (!result.success) {
|
|
2748
3635
|
throw new Error(
|
|
2749
|
-
`Invalid frontmatter in ${(0,
|
|
3636
|
+
`Invalid frontmatter in ${(0, import_node_path40.join)(baseDir, relativeFilePath)}: ${result.error.message}`
|
|
2750
3637
|
);
|
|
2751
3638
|
}
|
|
2752
3639
|
return new _CopilotRule({
|
|
2753
3640
|
baseDir,
|
|
2754
|
-
relativeDirPath:
|
|
2755
|
-
relativeFilePath: relativeFilePath.replace(/\.md$/, ".instructions.md"),
|
|
3641
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
3642
|
+
relativeFilePath: relativeFilePath.endsWith(".instructions.md") ? relativeFilePath : relativeFilePath.replace(/\.md$/, ".instructions.md"),
|
|
2756
3643
|
frontmatter: result.data,
|
|
2757
3644
|
body: content.trim(),
|
|
2758
3645
|
validate,
|
|
@@ -2779,16 +3666,23 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
2779
3666
|
};
|
|
2780
3667
|
|
|
2781
3668
|
// src/rules/cursor-rule.ts
|
|
2782
|
-
var
|
|
2783
|
-
var
|
|
2784
|
-
var CursorRuleFrontmatterSchema =
|
|
2785
|
-
description:
|
|
2786
|
-
globs:
|
|
2787
|
-
alwaysApply:
|
|
3669
|
+
var import_node_path41 = require("path");
|
|
3670
|
+
var import_mini17 = require("zod/mini");
|
|
3671
|
+
var CursorRuleFrontmatterSchema = import_mini17.z.object({
|
|
3672
|
+
description: import_mini17.z.optional(import_mini17.z.string()),
|
|
3673
|
+
globs: import_mini17.z.optional(import_mini17.z.string()),
|
|
3674
|
+
alwaysApply: import_mini17.z.optional(import_mini17.z.boolean())
|
|
2788
3675
|
});
|
|
2789
3676
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
2790
3677
|
frontmatter;
|
|
2791
3678
|
body;
|
|
3679
|
+
static getSettablePaths() {
|
|
3680
|
+
return {
|
|
3681
|
+
nonRoot: {
|
|
3682
|
+
relativeDirPath: ".cursor/rules"
|
|
3683
|
+
}
|
|
3684
|
+
};
|
|
3685
|
+
}
|
|
2792
3686
|
constructor({ frontmatter, body, ...rest }) {
|
|
2793
3687
|
if (rest.validate) {
|
|
2794
3688
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2891,7 +3785,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
2891
3785
|
baseDir,
|
|
2892
3786
|
frontmatter: cursorFrontmatter,
|
|
2893
3787
|
body,
|
|
2894
|
-
relativeDirPath:
|
|
3788
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
2895
3789
|
relativeFilePath: newFileName,
|
|
2896
3790
|
validate
|
|
2897
3791
|
});
|
|
@@ -2901,18 +3795,20 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
2901
3795
|
relativeFilePath,
|
|
2902
3796
|
validate = true
|
|
2903
3797
|
}) {
|
|
2904
|
-
const fileContent = await readFileContent(
|
|
3798
|
+
const fileContent = await readFileContent(
|
|
3799
|
+
(0, import_node_path41.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
3800
|
+
);
|
|
2905
3801
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
2906
3802
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
2907
3803
|
if (!result.success) {
|
|
2908
3804
|
throw new Error(
|
|
2909
|
-
`Invalid frontmatter in ${(0,
|
|
3805
|
+
`Invalid frontmatter in ${(0, import_node_path41.join)(baseDir, relativeFilePath)}: ${result.error.message}`
|
|
2910
3806
|
);
|
|
2911
3807
|
}
|
|
2912
3808
|
return new _CursorRule({
|
|
2913
3809
|
baseDir,
|
|
2914
|
-
relativeDirPath:
|
|
2915
|
-
relativeFilePath: (0,
|
|
3810
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
3811
|
+
relativeFilePath: (0, import_node_path41.basename)(relativeFilePath),
|
|
2916
3812
|
frontmatter: result.data,
|
|
2917
3813
|
body: content.trim(),
|
|
2918
3814
|
validate
|
|
@@ -2938,19 +3834,30 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
2938
3834
|
};
|
|
2939
3835
|
|
|
2940
3836
|
// src/rules/geminicli-rule.ts
|
|
2941
|
-
var
|
|
3837
|
+
var import_node_path42 = require("path");
|
|
2942
3838
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
3839
|
+
static getSettablePaths() {
|
|
3840
|
+
return {
|
|
3841
|
+
root: {
|
|
3842
|
+
relativeDirPath: ".",
|
|
3843
|
+
relativeFilePath: "GEMINI.md"
|
|
3844
|
+
},
|
|
3845
|
+
nonRoot: {
|
|
3846
|
+
relativeDirPath: ".gemini/memories"
|
|
3847
|
+
}
|
|
3848
|
+
};
|
|
3849
|
+
}
|
|
2943
3850
|
static async fromFile({
|
|
2944
3851
|
baseDir = ".",
|
|
2945
3852
|
relativeFilePath,
|
|
2946
3853
|
validate = true
|
|
2947
3854
|
}) {
|
|
2948
3855
|
const isRoot = relativeFilePath === "GEMINI.md";
|
|
2949
|
-
const relativePath = isRoot ? "GEMINI.md" : (0,
|
|
2950
|
-
const fileContent = await readFileContent((0,
|
|
3856
|
+
const relativePath = isRoot ? "GEMINI.md" : (0, import_node_path42.join)(".gemini/memories", relativeFilePath);
|
|
3857
|
+
const fileContent = await readFileContent((0, import_node_path42.join)(baseDir, relativePath));
|
|
2951
3858
|
return new _GeminiCliRule({
|
|
2952
3859
|
baseDir,
|
|
2953
|
-
relativeDirPath: isRoot ?
|
|
3860
|
+
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
2954
3861
|
relativeFilePath: isRoot ? "GEMINI.md" : relativeFilePath,
|
|
2955
3862
|
fileContent,
|
|
2956
3863
|
validate,
|
|
@@ -2967,8 +3874,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
2967
3874
|
baseDir,
|
|
2968
3875
|
rulesyncRule,
|
|
2969
3876
|
validate,
|
|
2970
|
-
rootPath:
|
|
2971
|
-
nonRootPath:
|
|
3877
|
+
rootPath: this.getSettablePaths().root,
|
|
3878
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
2972
3879
|
})
|
|
2973
3880
|
);
|
|
2974
3881
|
}
|
|
@@ -2981,22 +3888,34 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
2981
3888
|
};
|
|
2982
3889
|
|
|
2983
3890
|
// src/rules/junie-rule.ts
|
|
2984
|
-
var
|
|
3891
|
+
var import_node_path43 = require("path");
|
|
2985
3892
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
3893
|
+
static getSettablePaths() {
|
|
3894
|
+
return {
|
|
3895
|
+
root: {
|
|
3896
|
+
relativeDirPath: ".junie",
|
|
3897
|
+
relativeFilePath: "guidelines.md"
|
|
3898
|
+
},
|
|
3899
|
+
nonRoot: {
|
|
3900
|
+
relativeDirPath: ".junie/memories"
|
|
3901
|
+
}
|
|
3902
|
+
};
|
|
3903
|
+
}
|
|
2986
3904
|
static async fromFile({
|
|
2987
3905
|
baseDir = ".",
|
|
2988
3906
|
relativeFilePath,
|
|
2989
3907
|
validate = true
|
|
2990
3908
|
}) {
|
|
2991
3909
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
2992
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
2993
|
-
const fileContent = await readFileContent((0,
|
|
3910
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path43.join)(".junie/memories", relativeFilePath);
|
|
3911
|
+
const fileContent = await readFileContent((0, import_node_path43.join)(baseDir, relativePath));
|
|
2994
3912
|
return new _JunieRule({
|
|
2995
3913
|
baseDir,
|
|
2996
|
-
relativeDirPath: isRoot ?
|
|
3914
|
+
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
2997
3915
|
relativeFilePath: isRoot ? "guidelines.md" : relativeFilePath,
|
|
2998
3916
|
fileContent,
|
|
2999
|
-
validate
|
|
3917
|
+
validate,
|
|
3918
|
+
root: isRoot
|
|
3000
3919
|
});
|
|
3001
3920
|
}
|
|
3002
3921
|
static fromRulesyncRule({
|
|
@@ -3009,8 +3928,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
3009
3928
|
baseDir,
|
|
3010
3929
|
rulesyncRule,
|
|
3011
3930
|
validate,
|
|
3012
|
-
rootPath:
|
|
3013
|
-
nonRootPath:
|
|
3931
|
+
rootPath: this.getSettablePaths().root,
|
|
3932
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
3014
3933
|
})
|
|
3015
3934
|
);
|
|
3016
3935
|
}
|
|
@@ -3023,17 +3942,26 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
3023
3942
|
};
|
|
3024
3943
|
|
|
3025
3944
|
// src/rules/kiro-rule.ts
|
|
3026
|
-
var
|
|
3945
|
+
var import_node_path44 = require("path");
|
|
3027
3946
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
3947
|
+
static getSettablePaths() {
|
|
3948
|
+
return {
|
|
3949
|
+
nonRoot: {
|
|
3950
|
+
relativeDirPath: ".kiro/steering"
|
|
3951
|
+
}
|
|
3952
|
+
};
|
|
3953
|
+
}
|
|
3028
3954
|
static async fromFile({
|
|
3029
3955
|
baseDir = ".",
|
|
3030
3956
|
relativeFilePath,
|
|
3031
3957
|
validate = true
|
|
3032
3958
|
}) {
|
|
3033
|
-
const fileContent = await readFileContent(
|
|
3959
|
+
const fileContent = await readFileContent(
|
|
3960
|
+
(0, import_node_path44.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
3961
|
+
);
|
|
3034
3962
|
return new _KiroRule({
|
|
3035
3963
|
baseDir,
|
|
3036
|
-
relativeDirPath:
|
|
3964
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
3037
3965
|
relativeFilePath,
|
|
3038
3966
|
fileContent,
|
|
3039
3967
|
validate,
|
|
@@ -3050,7 +3978,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
3050
3978
|
baseDir,
|
|
3051
3979
|
rulesyncRule,
|
|
3052
3980
|
validate,
|
|
3053
|
-
nonRootPath:
|
|
3981
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
3054
3982
|
})
|
|
3055
3983
|
);
|
|
3056
3984
|
}
|
|
@@ -3063,19 +3991,30 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
3063
3991
|
};
|
|
3064
3992
|
|
|
3065
3993
|
// src/rules/opencode-rule.ts
|
|
3066
|
-
var
|
|
3994
|
+
var import_node_path45 = require("path");
|
|
3067
3995
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
3996
|
+
static getSettablePaths() {
|
|
3997
|
+
return {
|
|
3998
|
+
root: {
|
|
3999
|
+
relativeDirPath: ".",
|
|
4000
|
+
relativeFilePath: "AGENTS.md"
|
|
4001
|
+
},
|
|
4002
|
+
nonRoot: {
|
|
4003
|
+
relativeDirPath: ".opencode/memories"
|
|
4004
|
+
}
|
|
4005
|
+
};
|
|
4006
|
+
}
|
|
3068
4007
|
static async fromFile({
|
|
3069
4008
|
baseDir = ".",
|
|
3070
4009
|
relativeFilePath,
|
|
3071
4010
|
validate = true
|
|
3072
4011
|
}) {
|
|
3073
4012
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
3074
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
3075
|
-
const fileContent = await readFileContent((0,
|
|
4013
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path45.join)(".opencode/memories", relativeFilePath);
|
|
4014
|
+
const fileContent = await readFileContent((0, import_node_path45.join)(baseDir, relativePath));
|
|
3076
4015
|
return new _OpenCodeRule({
|
|
3077
4016
|
baseDir,
|
|
3078
|
-
relativeDirPath: isRoot ?
|
|
4017
|
+
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
3079
4018
|
relativeFilePath: isRoot ? "AGENTS.md" : relativeFilePath,
|
|
3080
4019
|
validate,
|
|
3081
4020
|
root: isRoot,
|
|
@@ -3091,7 +4030,9 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
3091
4030
|
this.buildToolRuleParamsDefault({
|
|
3092
4031
|
baseDir,
|
|
3093
4032
|
rulesyncRule,
|
|
3094
|
-
validate
|
|
4033
|
+
validate,
|
|
4034
|
+
rootPath: this.getSettablePaths().root,
|
|
4035
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
3095
4036
|
})
|
|
3096
4037
|
);
|
|
3097
4038
|
}
|
|
@@ -3104,19 +4045,30 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
3104
4045
|
};
|
|
3105
4046
|
|
|
3106
4047
|
// src/rules/qwencode-rule.ts
|
|
3107
|
-
var
|
|
4048
|
+
var import_node_path46 = require("path");
|
|
3108
4049
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
4050
|
+
static getSettablePaths() {
|
|
4051
|
+
return {
|
|
4052
|
+
root: {
|
|
4053
|
+
relativeDirPath: ".",
|
|
4054
|
+
relativeFilePath: "QWEN.md"
|
|
4055
|
+
},
|
|
4056
|
+
nonRoot: {
|
|
4057
|
+
relativeDirPath: ".qwen/memories"
|
|
4058
|
+
}
|
|
4059
|
+
};
|
|
4060
|
+
}
|
|
3109
4061
|
static async fromFile({
|
|
3110
4062
|
baseDir = ".",
|
|
3111
4063
|
relativeFilePath,
|
|
3112
4064
|
validate = true
|
|
3113
4065
|
}) {
|
|
3114
4066
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
3115
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
3116
|
-
const fileContent = await readFileContent((0,
|
|
4067
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path46.join)(".qwen/memories", relativeFilePath);
|
|
4068
|
+
const fileContent = await readFileContent((0, import_node_path46.join)(baseDir, relativePath));
|
|
3117
4069
|
return new _QwencodeRule({
|
|
3118
4070
|
baseDir,
|
|
3119
|
-
relativeDirPath: isRoot ?
|
|
4071
|
+
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
3120
4072
|
relativeFilePath: isRoot ? "QWEN.md" : relativeFilePath,
|
|
3121
4073
|
fileContent,
|
|
3122
4074
|
validate,
|
|
@@ -3124,11 +4076,14 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
3124
4076
|
});
|
|
3125
4077
|
}
|
|
3126
4078
|
static fromRulesyncRule(params) {
|
|
3127
|
-
const { rulesyncRule } = params;
|
|
4079
|
+
const { baseDir = ".", rulesyncRule, validate = true } = params;
|
|
3128
4080
|
return new _QwencodeRule(
|
|
3129
4081
|
this.buildToolRuleParamsDefault({
|
|
4082
|
+
baseDir,
|
|
3130
4083
|
rulesyncRule,
|
|
3131
|
-
validate
|
|
4084
|
+
validate,
|
|
4085
|
+
rootPath: this.getSettablePaths().root,
|
|
4086
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
3132
4087
|
})
|
|
3133
4088
|
);
|
|
3134
4089
|
}
|
|
@@ -3141,17 +4096,26 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
3141
4096
|
};
|
|
3142
4097
|
|
|
3143
4098
|
// src/rules/roo-rule.ts
|
|
3144
|
-
var
|
|
4099
|
+
var import_node_path47 = require("path");
|
|
3145
4100
|
var RooRule = class _RooRule extends ToolRule {
|
|
4101
|
+
static getSettablePaths() {
|
|
4102
|
+
return {
|
|
4103
|
+
nonRoot: {
|
|
4104
|
+
relativeDirPath: ".roo/rules"
|
|
4105
|
+
}
|
|
4106
|
+
};
|
|
4107
|
+
}
|
|
3146
4108
|
static async fromFile({
|
|
3147
4109
|
baseDir = ".",
|
|
3148
4110
|
relativeFilePath,
|
|
3149
4111
|
validate = true
|
|
3150
4112
|
}) {
|
|
3151
|
-
const fileContent = await readFileContent(
|
|
4113
|
+
const fileContent = await readFileContent(
|
|
4114
|
+
(0, import_node_path47.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4115
|
+
);
|
|
3152
4116
|
return new _RooRule({
|
|
3153
4117
|
baseDir,
|
|
3154
|
-
relativeDirPath:
|
|
4118
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
3155
4119
|
relativeFilePath,
|
|
3156
4120
|
fileContent,
|
|
3157
4121
|
validate,
|
|
@@ -3168,7 +4132,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
3168
4132
|
baseDir,
|
|
3169
4133
|
rulesyncRule,
|
|
3170
4134
|
validate,
|
|
3171
|
-
nonRootPath:
|
|
4135
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
3172
4136
|
})
|
|
3173
4137
|
);
|
|
3174
4138
|
}
|
|
@@ -3196,7 +4160,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
3196
4160
|
};
|
|
3197
4161
|
|
|
3198
4162
|
// src/rules/warp-rule.ts
|
|
3199
|
-
var
|
|
4163
|
+
var import_node_path48 = require("path");
|
|
3200
4164
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
3201
4165
|
constructor({ fileContent, root, ...rest }) {
|
|
3202
4166
|
super({
|
|
@@ -3205,18 +4169,29 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
3205
4169
|
root: root ?? false
|
|
3206
4170
|
});
|
|
3207
4171
|
}
|
|
4172
|
+
static getSettablePaths() {
|
|
4173
|
+
return {
|
|
4174
|
+
root: {
|
|
4175
|
+
relativeDirPath: ".",
|
|
4176
|
+
relativeFilePath: "WARP.md"
|
|
4177
|
+
},
|
|
4178
|
+
nonRoot: {
|
|
4179
|
+
relativeDirPath: ".warp/memories"
|
|
4180
|
+
}
|
|
4181
|
+
};
|
|
4182
|
+
}
|
|
3208
4183
|
static async fromFile({
|
|
3209
4184
|
baseDir = ".",
|
|
3210
4185
|
relativeFilePath,
|
|
3211
4186
|
validate = true
|
|
3212
4187
|
}) {
|
|
3213
|
-
const isRoot = relativeFilePath ===
|
|
3214
|
-
const relativePath = isRoot ?
|
|
3215
|
-
const fileContent = await readFileContent((0,
|
|
4188
|
+
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
4189
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path48.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4190
|
+
const fileContent = await readFileContent((0, import_node_path48.join)(baseDir, relativePath));
|
|
3216
4191
|
return new _WarpRule({
|
|
3217
4192
|
baseDir,
|
|
3218
|
-
relativeDirPath: isRoot ?
|
|
3219
|
-
relativeFilePath: isRoot ?
|
|
4193
|
+
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
4194
|
+
relativeFilePath: isRoot ? this.getSettablePaths().root.relativeFilePath : relativeFilePath,
|
|
3220
4195
|
fileContent,
|
|
3221
4196
|
validate,
|
|
3222
4197
|
root: isRoot
|
|
@@ -3232,8 +4207,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
3232
4207
|
baseDir,
|
|
3233
4208
|
rulesyncRule,
|
|
3234
4209
|
validate,
|
|
3235
|
-
rootPath:
|
|
3236
|
-
nonRootPath:
|
|
4210
|
+
rootPath: this.getSettablePaths().root,
|
|
4211
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
3237
4212
|
})
|
|
3238
4213
|
);
|
|
3239
4214
|
}
|
|
@@ -3246,17 +4221,26 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
3246
4221
|
};
|
|
3247
4222
|
|
|
3248
4223
|
// src/rules/windsurf-rule.ts
|
|
3249
|
-
var
|
|
4224
|
+
var import_node_path49 = require("path");
|
|
3250
4225
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
4226
|
+
static getSettablePaths() {
|
|
4227
|
+
return {
|
|
4228
|
+
nonRoot: {
|
|
4229
|
+
relativeDirPath: ".windsurf/rules"
|
|
4230
|
+
}
|
|
4231
|
+
};
|
|
4232
|
+
}
|
|
3251
4233
|
static async fromFile({
|
|
3252
4234
|
baseDir = ".",
|
|
3253
4235
|
relativeFilePath,
|
|
3254
4236
|
validate = true
|
|
3255
4237
|
}) {
|
|
3256
|
-
const fileContent = await readFileContent(
|
|
4238
|
+
const fileContent = await readFileContent(
|
|
4239
|
+
(0, import_node_path49.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4240
|
+
);
|
|
3257
4241
|
return new _WindsurfRule({
|
|
3258
4242
|
baseDir,
|
|
3259
|
-
relativeDirPath:
|
|
4243
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
3260
4244
|
relativeFilePath,
|
|
3261
4245
|
fileContent,
|
|
3262
4246
|
validate
|
|
@@ -3272,7 +4256,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
3272
4256
|
baseDir,
|
|
3273
4257
|
rulesyncRule,
|
|
3274
4258
|
validate,
|
|
3275
|
-
nonRootPath:
|
|
4259
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
3276
4260
|
})
|
|
3277
4261
|
);
|
|
3278
4262
|
}
|
|
@@ -3304,15 +4288,21 @@ var rulesProcessorToolTargets = [
|
|
|
3304
4288
|
"warp",
|
|
3305
4289
|
"windsurf"
|
|
3306
4290
|
];
|
|
3307
|
-
var RulesProcessorToolTargetSchema =
|
|
4291
|
+
var RulesProcessorToolTargetSchema = import_mini18.z.enum(rulesProcessorToolTargets);
|
|
3308
4292
|
var RulesProcessor = class extends FeatureProcessor {
|
|
3309
4293
|
toolTarget;
|
|
4294
|
+
simulateCommands;
|
|
4295
|
+
simulateSubagents;
|
|
3310
4296
|
constructor({
|
|
3311
4297
|
baseDir = process.cwd(),
|
|
3312
|
-
toolTarget
|
|
4298
|
+
toolTarget,
|
|
4299
|
+
simulateCommands = false,
|
|
4300
|
+
simulateSubagents = false
|
|
3313
4301
|
}) {
|
|
3314
4302
|
super({ baseDir });
|
|
3315
4303
|
this.toolTarget = RulesProcessorToolTargetSchema.parse(toolTarget);
|
|
4304
|
+
this.simulateCommands = simulateCommands;
|
|
4305
|
+
this.simulateSubagents = simulateSubagents;
|
|
3316
4306
|
}
|
|
3317
4307
|
async convertRulesyncFilesToToolFiles(rulesyncFiles) {
|
|
3318
4308
|
const rulesyncRules = rulesyncFiles.filter(
|
|
@@ -3426,6 +4416,25 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3426
4416
|
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
3427
4417
|
}
|
|
3428
4418
|
});
|
|
4419
|
+
if (this.toolTarget === "cursor" && (this.simulateCommands || this.simulateSubagents)) {
|
|
4420
|
+
toolRules.push(
|
|
4421
|
+
new CursorRule({
|
|
4422
|
+
baseDir: this.baseDir,
|
|
4423
|
+
frontmatter: {
|
|
4424
|
+
alwaysApply: true
|
|
4425
|
+
},
|
|
4426
|
+
body: this.generateAdditionalConventionsSection({
|
|
4427
|
+
commands: { relativeDirPath: CursorCommand.getSettablePaths().relativeDirPath },
|
|
4428
|
+
subagents: {
|
|
4429
|
+
relativeDirPath: CursorSubagent.getSettablePaths().relativeDirPath
|
|
4430
|
+
}
|
|
4431
|
+
}),
|
|
4432
|
+
relativeDirPath: CursorRule.getSettablePaths().nonRoot.relativeDirPath,
|
|
4433
|
+
relativeFilePath: "additional-conventions.mdc",
|
|
4434
|
+
validate: true
|
|
4435
|
+
})
|
|
4436
|
+
);
|
|
4437
|
+
}
|
|
3429
4438
|
const rootRuleIndex = toolRules.findIndex((rule) => rule.isRoot());
|
|
3430
4439
|
if (rootRuleIndex === -1) {
|
|
3431
4440
|
return toolRules;
|
|
@@ -3455,14 +4464,24 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3455
4464
|
case "codexcli": {
|
|
3456
4465
|
const rootRule = toolRules[rootRuleIndex];
|
|
3457
4466
|
rootRule?.setFileContent(
|
|
3458
|
-
this.generateXmlReferencesSection(toolRules) +
|
|
4467
|
+
this.generateXmlReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
|
|
4468
|
+
commands: { relativeDirPath: CodexCliCommand.getSettablePaths().relativeDirPath },
|
|
4469
|
+
subagents: {
|
|
4470
|
+
relativeDirPath: CodexCliSubagent.getSettablePaths().relativeDirPath
|
|
4471
|
+
}
|
|
4472
|
+
}) + rootRule.getFileContent()
|
|
3459
4473
|
);
|
|
3460
4474
|
return toolRules;
|
|
3461
4475
|
}
|
|
3462
4476
|
case "copilot": {
|
|
3463
4477
|
const rootRule = toolRules[rootRuleIndex];
|
|
3464
4478
|
rootRule?.setFileContent(
|
|
3465
|
-
this.generateXmlReferencesSection(toolRules) +
|
|
4479
|
+
this.generateXmlReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
|
|
4480
|
+
commands: { relativeDirPath: CopilotCommand.getSettablePaths().relativeDirPath },
|
|
4481
|
+
subagents: {
|
|
4482
|
+
relativeDirPath: CopilotSubagent.getSettablePaths().relativeDirPath
|
|
4483
|
+
}
|
|
4484
|
+
}) + rootRule.getFileContent()
|
|
3466
4485
|
);
|
|
3467
4486
|
return toolRules;
|
|
3468
4487
|
}
|
|
@@ -3517,17 +4536,17 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3517
4536
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
3518
4537
|
*/
|
|
3519
4538
|
async loadRulesyncFiles() {
|
|
3520
|
-
const files = await findFilesByGlobs((0,
|
|
4539
|
+
const files = await findFilesByGlobs((0, import_node_path50.join)(RULESYNC_RULES_DIR, "*.md"));
|
|
3521
4540
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
3522
4541
|
return Promise.all(
|
|
3523
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0,
|
|
4542
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path50.basename)(file) }))
|
|
3524
4543
|
);
|
|
3525
4544
|
}
|
|
3526
4545
|
async loadRulesyncFilesLegacy() {
|
|
3527
|
-
const legacyFiles = await findFilesByGlobs((0,
|
|
4546
|
+
const legacyFiles = await findFilesByGlobs((0, import_node_path50.join)(RULESYNC_RULES_DIR_LEGACY, "*.md"));
|
|
3528
4547
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
3529
4548
|
return Promise.all(
|
|
3530
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0,
|
|
4549
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path50.basename)(file) }))
|
|
3531
4550
|
);
|
|
3532
4551
|
}
|
|
3533
4552
|
/**
|
|
@@ -3588,13 +4607,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3588
4607
|
return [];
|
|
3589
4608
|
}
|
|
3590
4609
|
const rootFilePaths = await findFilesByGlobs(
|
|
3591
|
-
(0,
|
|
4610
|
+
(0, import_node_path50.join)(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
|
|
3592
4611
|
);
|
|
3593
4612
|
return await Promise.all(
|
|
3594
4613
|
rootFilePaths.map(
|
|
3595
4614
|
(filePath) => root.fromFile({
|
|
3596
4615
|
baseDir: this.baseDir,
|
|
3597
|
-
relativeFilePath: (0,
|
|
4616
|
+
relativeFilePath: (0, import_node_path50.basename)(filePath)
|
|
3598
4617
|
})
|
|
3599
4618
|
)
|
|
3600
4619
|
);
|
|
@@ -3605,13 +4624,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3605
4624
|
return [];
|
|
3606
4625
|
}
|
|
3607
4626
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
3608
|
-
(0,
|
|
4627
|
+
(0, import_node_path50.join)(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
|
|
3609
4628
|
);
|
|
3610
4629
|
return await Promise.all(
|
|
3611
4630
|
nonRootFilePaths.map(
|
|
3612
4631
|
(filePath) => nonRoot.fromFile({
|
|
3613
4632
|
baseDir: this.baseDir,
|
|
3614
|
-
relativeFilePath: (0,
|
|
4633
|
+
relativeFilePath: (0, import_node_path50.basename)(filePath)
|
|
3615
4634
|
})
|
|
3616
4635
|
)
|
|
3617
4636
|
);
|
|
@@ -3623,28 +4642,30 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3623
4642
|
* Load AGENTS.md rule configuration
|
|
3624
4643
|
*/
|
|
3625
4644
|
async loadAgentsmdRules() {
|
|
4645
|
+
const settablePaths = AgentsMdRule.getSettablePaths();
|
|
3626
4646
|
return await this.loadToolRulesDefault({
|
|
3627
4647
|
root: {
|
|
3628
|
-
relativeDirPath:
|
|
3629
|
-
relativeFilePath:
|
|
4648
|
+
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
4649
|
+
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
3630
4650
|
fromFile: (params) => AgentsMdRule.fromFile(params)
|
|
3631
4651
|
},
|
|
3632
4652
|
nonRoot: {
|
|
3633
|
-
|
|
4653
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3634
4654
|
fromFile: (params) => AgentsMdRule.fromFile(params),
|
|
3635
4655
|
extension: "md"
|
|
3636
4656
|
}
|
|
3637
4657
|
});
|
|
3638
4658
|
}
|
|
3639
4659
|
async loadWarpRules() {
|
|
4660
|
+
const settablePaths = WarpRule.getSettablePaths();
|
|
3640
4661
|
return await this.loadToolRulesDefault({
|
|
3641
4662
|
root: {
|
|
3642
|
-
relativeDirPath:
|
|
3643
|
-
relativeFilePath:
|
|
4663
|
+
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
4664
|
+
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
3644
4665
|
fromFile: (params) => WarpRule.fromFile(params)
|
|
3645
4666
|
},
|
|
3646
4667
|
nonRoot: {
|
|
3647
|
-
|
|
4668
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3648
4669
|
fromFile: (params) => WarpRule.fromFile(params),
|
|
3649
4670
|
extension: "md"
|
|
3650
4671
|
}
|
|
@@ -3654,9 +4675,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3654
4675
|
* Load Amazon Q Developer CLI rule configurations from .amazonq/rules/ directory
|
|
3655
4676
|
*/
|
|
3656
4677
|
async loadAmazonqcliRules() {
|
|
4678
|
+
const settablePaths = AmazonQCliRule.getSettablePaths();
|
|
3657
4679
|
return await this.loadToolRulesDefault({
|
|
3658
4680
|
nonRoot: {
|
|
3659
|
-
|
|
4681
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3660
4682
|
fromFile: (params) => AmazonQCliRule.fromFile(params),
|
|
3661
4683
|
extension: "md"
|
|
3662
4684
|
}
|
|
@@ -3666,9 +4688,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3666
4688
|
* Load AugmentCode rule configurations from .augment/rules/ directory
|
|
3667
4689
|
*/
|
|
3668
4690
|
async loadAugmentcodeRules() {
|
|
4691
|
+
const settablePaths = AugmentcodeRule.getSettablePaths();
|
|
3669
4692
|
return await this.loadToolRulesDefault({
|
|
3670
4693
|
nonRoot: {
|
|
3671
|
-
|
|
4694
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3672
4695
|
fromFile: (params) => AugmentcodeRule.fromFile(params),
|
|
3673
4696
|
extension: "md"
|
|
3674
4697
|
}
|
|
@@ -3678,14 +4701,15 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3678
4701
|
* Load AugmentCode legacy rule configuration from .augment-guidelines file and .augment/rules/ directory
|
|
3679
4702
|
*/
|
|
3680
4703
|
async loadAugmentcodeLegacyRules() {
|
|
4704
|
+
const settablePaths = AugmentcodeLegacyRule.getSettablePaths();
|
|
3681
4705
|
return await this.loadToolRulesDefault({
|
|
3682
4706
|
root: {
|
|
3683
|
-
relativeDirPath:
|
|
3684
|
-
relativeFilePath:
|
|
4707
|
+
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
4708
|
+
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
3685
4709
|
fromFile: (params) => AugmentcodeLegacyRule.fromFile(params)
|
|
3686
4710
|
},
|
|
3687
4711
|
nonRoot: {
|
|
3688
|
-
|
|
4712
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3689
4713
|
fromFile: (params) => AugmentcodeLegacyRule.fromFile(params),
|
|
3690
4714
|
extension: "md"
|
|
3691
4715
|
}
|
|
@@ -3695,14 +4719,15 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3695
4719
|
* Load Claude Code rule configuration from CLAUDE.md file
|
|
3696
4720
|
*/
|
|
3697
4721
|
async loadClaudecodeRules() {
|
|
4722
|
+
const settablePaths = ClaudecodeRule.getSettablePaths();
|
|
3698
4723
|
return await this.loadToolRulesDefault({
|
|
3699
4724
|
root: {
|
|
3700
|
-
relativeDirPath:
|
|
3701
|
-
relativeFilePath:
|
|
4725
|
+
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
4726
|
+
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
3702
4727
|
fromFile: (params) => ClaudecodeRule.fromFile(params)
|
|
3703
4728
|
},
|
|
3704
4729
|
nonRoot: {
|
|
3705
|
-
|
|
4730
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3706
4731
|
fromFile: (params) => ClaudecodeRule.fromFile(params),
|
|
3707
4732
|
extension: "md"
|
|
3708
4733
|
}
|
|
@@ -3712,9 +4737,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3712
4737
|
* Load Cline rule configurations from .clinerules/ directory
|
|
3713
4738
|
*/
|
|
3714
4739
|
async loadClineRules() {
|
|
4740
|
+
const settablePaths = ClineRule.getSettablePaths();
|
|
3715
4741
|
return await this.loadToolRulesDefault({
|
|
3716
4742
|
nonRoot: {
|
|
3717
|
-
|
|
4743
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3718
4744
|
fromFile: (params) => ClineRule.fromFile(params),
|
|
3719
4745
|
extension: "md"
|
|
3720
4746
|
}
|
|
@@ -3724,14 +4750,15 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3724
4750
|
* Load OpenAI Codex CLI rule configuration from AGENTS.md and .codex/memories/*.md files
|
|
3725
4751
|
*/
|
|
3726
4752
|
async loadCodexcliRules() {
|
|
4753
|
+
const settablePaths = CodexcliRule.getSettablePaths();
|
|
3727
4754
|
return await this.loadToolRulesDefault({
|
|
3728
4755
|
root: {
|
|
3729
|
-
relativeDirPath:
|
|
3730
|
-
relativeFilePath:
|
|
4756
|
+
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
4757
|
+
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
3731
4758
|
fromFile: (params) => CodexcliRule.fromFile(params)
|
|
3732
4759
|
},
|
|
3733
4760
|
nonRoot: {
|
|
3734
|
-
|
|
4761
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3735
4762
|
fromFile: (params) => CodexcliRule.fromFile(params),
|
|
3736
4763
|
extension: "md"
|
|
3737
4764
|
}
|
|
@@ -3741,14 +4768,15 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3741
4768
|
* Load GitHub Copilot rule configuration from .github/copilot-instructions.md file
|
|
3742
4769
|
*/
|
|
3743
4770
|
async loadCopilotRules() {
|
|
4771
|
+
const settablePaths = CopilotRule.getSettablePaths();
|
|
3744
4772
|
return await this.loadToolRulesDefault({
|
|
3745
4773
|
root: {
|
|
3746
|
-
relativeDirPath:
|
|
3747
|
-
relativeFilePath:
|
|
4774
|
+
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
4775
|
+
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
3748
4776
|
fromFile: (params) => CopilotRule.fromFile(params)
|
|
3749
4777
|
},
|
|
3750
4778
|
nonRoot: {
|
|
3751
|
-
|
|
4779
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3752
4780
|
fromFile: (params) => CopilotRule.fromFile(params),
|
|
3753
4781
|
extension: "md"
|
|
3754
4782
|
}
|
|
@@ -3758,11 +4786,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3758
4786
|
* Load Cursor rule configurations from .cursor/rules/ directory
|
|
3759
4787
|
*/
|
|
3760
4788
|
async loadCursorRules() {
|
|
4789
|
+
const settablePaths = CursorRule.getSettablePaths();
|
|
3761
4790
|
return await this.loadToolRulesDefault({
|
|
3762
4791
|
nonRoot: {
|
|
3763
|
-
|
|
4792
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3764
4793
|
fromFile: (params) => CursorRule.fromFile(params),
|
|
3765
|
-
extension: "
|
|
4794
|
+
extension: "mdc"
|
|
3766
4795
|
}
|
|
3767
4796
|
});
|
|
3768
4797
|
}
|
|
@@ -3770,14 +4799,15 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3770
4799
|
* Load Gemini CLI rule configuration from GEMINI.md file
|
|
3771
4800
|
*/
|
|
3772
4801
|
async loadGeminicliRules() {
|
|
4802
|
+
const settablePaths = GeminiCliRule.getSettablePaths();
|
|
3773
4803
|
return await this.loadToolRulesDefault({
|
|
3774
4804
|
root: {
|
|
3775
|
-
relativeDirPath:
|
|
3776
|
-
relativeFilePath:
|
|
4805
|
+
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
4806
|
+
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
3777
4807
|
fromFile: (params) => GeminiCliRule.fromFile(params)
|
|
3778
4808
|
},
|
|
3779
4809
|
nonRoot: {
|
|
3780
|
-
|
|
4810
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3781
4811
|
fromFile: (params) => GeminiCliRule.fromFile(params),
|
|
3782
4812
|
extension: "md"
|
|
3783
4813
|
}
|
|
@@ -3787,14 +4817,15 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3787
4817
|
* Load JetBrains Junie rule configuration from .junie/guidelines.md file
|
|
3788
4818
|
*/
|
|
3789
4819
|
async loadJunieRules() {
|
|
4820
|
+
const settablePaths = JunieRule.getSettablePaths();
|
|
3790
4821
|
return await this.loadToolRulesDefault({
|
|
3791
4822
|
root: {
|
|
3792
|
-
relativeDirPath:
|
|
3793
|
-
relativeFilePath:
|
|
4823
|
+
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
4824
|
+
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
3794
4825
|
fromFile: (params) => JunieRule.fromFile(params)
|
|
3795
4826
|
},
|
|
3796
4827
|
nonRoot: {
|
|
3797
|
-
|
|
4828
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3798
4829
|
fromFile: (params) => JunieRule.fromFile(params),
|
|
3799
4830
|
extension: "md"
|
|
3800
4831
|
}
|
|
@@ -3804,9 +4835,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3804
4835
|
* Load Kiro rule configurations from .kiro/steering/ directory
|
|
3805
4836
|
*/
|
|
3806
4837
|
async loadKiroRules() {
|
|
4838
|
+
const settablePaths = KiroRule.getSettablePaths();
|
|
3807
4839
|
return await this.loadToolRulesDefault({
|
|
3808
4840
|
nonRoot: {
|
|
3809
|
-
|
|
4841
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3810
4842
|
fromFile: (params) => KiroRule.fromFile(params),
|
|
3811
4843
|
extension: "md"
|
|
3812
4844
|
}
|
|
@@ -3816,14 +4848,15 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3816
4848
|
* Load OpenCode rule configuration from AGENTS.md file and .opencode/memories/*.md files
|
|
3817
4849
|
*/
|
|
3818
4850
|
async loadOpencodeRules() {
|
|
4851
|
+
const settablePaths = OpenCodeRule.getSettablePaths();
|
|
3819
4852
|
return await this.loadToolRulesDefault({
|
|
3820
4853
|
root: {
|
|
3821
|
-
relativeDirPath:
|
|
3822
|
-
relativeFilePath:
|
|
4854
|
+
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
4855
|
+
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
3823
4856
|
fromFile: (params) => OpenCodeRule.fromFile(params)
|
|
3824
4857
|
},
|
|
3825
4858
|
nonRoot: {
|
|
3826
|
-
|
|
4859
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3827
4860
|
fromFile: (params) => OpenCodeRule.fromFile(params),
|
|
3828
4861
|
extension: "md"
|
|
3829
4862
|
}
|
|
@@ -3833,14 +4866,15 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3833
4866
|
* Load Qwen Code rule configuration from QWEN.md file and .qwen/memories/*.md files
|
|
3834
4867
|
*/
|
|
3835
4868
|
async loadQwencodeRules() {
|
|
4869
|
+
const settablePaths = QwencodeRule.getSettablePaths();
|
|
3836
4870
|
return await this.loadToolRulesDefault({
|
|
3837
4871
|
root: {
|
|
3838
|
-
relativeDirPath:
|
|
3839
|
-
relativeFilePath:
|
|
4872
|
+
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
4873
|
+
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
3840
4874
|
fromFile: (params) => QwencodeRule.fromFile(params)
|
|
3841
4875
|
},
|
|
3842
4876
|
nonRoot: {
|
|
3843
|
-
|
|
4877
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3844
4878
|
fromFile: (params) => QwencodeRule.fromFile(params),
|
|
3845
4879
|
extension: "md"
|
|
3846
4880
|
}
|
|
@@ -3850,9 +4884,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3850
4884
|
* Load Roo Code rule configurations from .roo/rules/ directory
|
|
3851
4885
|
*/
|
|
3852
4886
|
async loadRooRules() {
|
|
4887
|
+
const settablePaths = RooRule.getSettablePaths();
|
|
3853
4888
|
return await this.loadToolRulesDefault({
|
|
3854
4889
|
nonRoot: {
|
|
3855
|
-
|
|
4890
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3856
4891
|
fromFile: (params) => RooRule.fromFile(params),
|
|
3857
4892
|
extension: "md"
|
|
3858
4893
|
}
|
|
@@ -3862,9 +4897,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3862
4897
|
* Load Windsurf rule configurations from .windsurf/rules/ directory
|
|
3863
4898
|
*/
|
|
3864
4899
|
async loadWindsurfRules() {
|
|
4900
|
+
const settablePaths = WindsurfRule.getSettablePaths();
|
|
3865
4901
|
return await this.loadToolRulesDefault({
|
|
3866
4902
|
nonRoot: {
|
|
3867
|
-
|
|
4903
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3868
4904
|
fromFile: (params) => WindsurfRule.fromFile(params),
|
|
3869
4905
|
extension: "md"
|
|
3870
4906
|
}
|
|
@@ -3934,26 +4970,57 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3934
4970
|
}
|
|
3935
4971
|
return lines.join("\n") + "\n";
|
|
3936
4972
|
}
|
|
4973
|
+
generateAdditionalConventionsSection({
|
|
4974
|
+
commands,
|
|
4975
|
+
subagents
|
|
4976
|
+
}) {
|
|
4977
|
+
return `# Additional Conventions Beyond the Built-in Functions
|
|
4978
|
+
|
|
4979
|
+
As this project's AI coding tool, you must follow the additional conventions below, in addition to the built-in functions.
|
|
4980
|
+
|
|
4981
|
+
${this.simulateCommands ? `## Simulated Custom Slash Commands
|
|
4982
|
+
|
|
4983
|
+
Custom slash commands allow you to define frequently-used prompts as Markdown files that you can execute.
|
|
4984
|
+
|
|
4985
|
+
### Syntax
|
|
4986
|
+
|
|
4987
|
+
Users can use following syntax to invoke a custom command.
|
|
4988
|
+
|
|
4989
|
+
\`\`\`txt
|
|
4990
|
+
s/<command> [arguments]
|
|
4991
|
+
\`\`\`
|
|
4992
|
+
|
|
4993
|
+
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
4994
|
+
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
4995
|
+
|
|
4996
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path50.join)(commands.relativeDirPath, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : ""}
|
|
4997
|
+
|
|
4998
|
+
${this.simulateSubagents ? `## Simulated Subagents
|
|
4999
|
+
|
|
5000
|
+
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 simulated custom slash commands simply. Simulated subagents can be called by simulated custom slash commands.
|
|
5001
|
+
|
|
5002
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path50.join)(subagents.relativeDirPath, "{subagent}.md")}\`, and execute its contents as the block of operations.` : ""}`.trim();
|
|
5003
|
+
}
|
|
3937
5004
|
};
|
|
3938
5005
|
|
|
3939
5006
|
// src/subagents/subagents-processor.ts
|
|
3940
|
-
var
|
|
3941
|
-
var
|
|
5007
|
+
var import_node_path53 = require("path");
|
|
5008
|
+
var import_mini21 = require("zod/mini");
|
|
3942
5009
|
|
|
3943
5010
|
// src/subagents/claudecode-subagent.ts
|
|
3944
|
-
var
|
|
3945
|
-
var
|
|
5011
|
+
var import_node_path52 = require("path");
|
|
5012
|
+
var import_mini20 = require("zod/mini");
|
|
3946
5013
|
|
|
3947
5014
|
// src/subagents/rulesync-subagent.ts
|
|
3948
|
-
var
|
|
3949
|
-
var
|
|
3950
|
-
var RulesyncSubagentModelSchema =
|
|
3951
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
5015
|
+
var import_node_path51 = require("path");
|
|
5016
|
+
var import_mini19 = require("zod/mini");
|
|
5017
|
+
var RulesyncSubagentModelSchema = import_mini19.z.enum(["opus", "sonnet", "haiku", "inherit"]);
|
|
5018
|
+
var RulesyncSubagentFrontmatterSchema = import_mini19.z.object({
|
|
3952
5019
|
targets: RulesyncTargetsSchema,
|
|
3953
|
-
name:
|
|
3954
|
-
description:
|
|
3955
|
-
claudecode:
|
|
3956
|
-
|
|
5020
|
+
name: import_mini19.z.string(),
|
|
5021
|
+
description: import_mini19.z.string(),
|
|
5022
|
+
claudecode: import_mini19.z.optional(
|
|
5023
|
+
import_mini19.z.object({
|
|
3957
5024
|
model: RulesyncSubagentModelSchema
|
|
3958
5025
|
})
|
|
3959
5026
|
)
|
|
@@ -3974,6 +5041,11 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
3974
5041
|
this.frontmatter = frontmatter;
|
|
3975
5042
|
this.body = body;
|
|
3976
5043
|
}
|
|
5044
|
+
static getSettablePaths() {
|
|
5045
|
+
return {
|
|
5046
|
+
relativeDirPath: ".rulesync/subagents"
|
|
5047
|
+
};
|
|
5048
|
+
}
|
|
3977
5049
|
getFrontmatter() {
|
|
3978
5050
|
return this.frontmatter;
|
|
3979
5051
|
}
|
|
@@ -3994,16 +5066,16 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
3994
5066
|
static async fromFile({
|
|
3995
5067
|
relativeFilePath
|
|
3996
5068
|
}) {
|
|
3997
|
-
const fileContent = await readFileContent((0,
|
|
5069
|
+
const fileContent = await readFileContent((0, import_node_path51.join)(RULESYNC_SUBAGENTS_DIR, relativeFilePath));
|
|
3998
5070
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3999
5071
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
4000
5072
|
if (!result.success) {
|
|
4001
5073
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${result.error.message}`);
|
|
4002
5074
|
}
|
|
4003
|
-
const filename = (0,
|
|
5075
|
+
const filename = (0, import_node_path51.basename)(relativeFilePath);
|
|
4004
5076
|
return new _RulesyncSubagent({
|
|
4005
5077
|
baseDir: ".",
|
|
4006
|
-
relativeDirPath:
|
|
5078
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
4007
5079
|
relativeFilePath: filename,
|
|
4008
5080
|
frontmatter: result.data,
|
|
4009
5081
|
body: content.trim(),
|
|
@@ -4012,21 +5084,11 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
4012
5084
|
}
|
|
4013
5085
|
};
|
|
4014
5086
|
|
|
4015
|
-
// src/subagents/tool-subagent.ts
|
|
4016
|
-
var ToolSubagent = class extends ToolFile {
|
|
4017
|
-
static async fromFile(_params) {
|
|
4018
|
-
throw new Error("Please implement this method in the subclass.");
|
|
4019
|
-
}
|
|
4020
|
-
static fromRulesyncSubagent(_params) {
|
|
4021
|
-
throw new Error("Please implement this method in the subclass.");
|
|
4022
|
-
}
|
|
4023
|
-
};
|
|
4024
|
-
|
|
4025
5087
|
// src/subagents/claudecode-subagent.ts
|
|
4026
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
4027
|
-
name:
|
|
4028
|
-
description:
|
|
4029
|
-
model:
|
|
5088
|
+
var ClaudecodeSubagentFrontmatterSchema = import_mini20.z.object({
|
|
5089
|
+
name: import_mini20.z.string(),
|
|
5090
|
+
description: import_mini20.z.string(),
|
|
5091
|
+
model: import_mini20.z.optional(import_mini20.z.enum(["opus", "sonnet", "haiku", "inherit"]))
|
|
4030
5092
|
});
|
|
4031
5093
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
4032
5094
|
frontmatter;
|
|
@@ -4044,6 +5106,11 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
4044
5106
|
this.frontmatter = frontmatter;
|
|
4045
5107
|
this.body = body;
|
|
4046
5108
|
}
|
|
5109
|
+
static getSettablePaths() {
|
|
5110
|
+
return {
|
|
5111
|
+
relativeDirPath: ".claude/agents"
|
|
5112
|
+
};
|
|
5113
|
+
}
|
|
4047
5114
|
getFrontmatter() {
|
|
4048
5115
|
return this.frontmatter;
|
|
4049
5116
|
}
|
|
@@ -4111,7 +5178,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
4111
5178
|
relativeFilePath,
|
|
4112
5179
|
validate = true
|
|
4113
5180
|
}) {
|
|
4114
|
-
const fileContent = await readFileContent((0,
|
|
5181
|
+
const fileContent = await readFileContent((0, import_node_path52.join)(baseDir, ".claude/agents", relativeFilePath));
|
|
4115
5182
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
4116
5183
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
4117
5184
|
if (!result.success) {
|
|
@@ -4130,8 +5197,18 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
4130
5197
|
};
|
|
4131
5198
|
|
|
4132
5199
|
// src/subagents/subagents-processor.ts
|
|
4133
|
-
var subagentsProcessorToolTargets = [
|
|
4134
|
-
|
|
5200
|
+
var subagentsProcessorToolTargets = [
|
|
5201
|
+
"claudecode",
|
|
5202
|
+
"copilot",
|
|
5203
|
+
"cursor",
|
|
5204
|
+
"codexcli"
|
|
5205
|
+
];
|
|
5206
|
+
var subagentsProcessorToolTargetsSimulated = [
|
|
5207
|
+
"copilot",
|
|
5208
|
+
"cursor",
|
|
5209
|
+
"codexcli"
|
|
5210
|
+
];
|
|
5211
|
+
var SubagentsProcessorToolTargetSchema = import_mini21.z.enum(subagentsProcessorToolTargets);
|
|
4135
5212
|
var SubagentsProcessor = class extends FeatureProcessor {
|
|
4136
5213
|
toolTarget;
|
|
4137
5214
|
constructor({
|
|
@@ -4150,7 +5227,25 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4150
5227
|
case "claudecode":
|
|
4151
5228
|
return ClaudecodeSubagent.fromRulesyncSubagent({
|
|
4152
5229
|
baseDir: this.baseDir,
|
|
4153
|
-
relativeDirPath:
|
|
5230
|
+
relativeDirPath: RulesyncSubagent.getSettablePaths().relativeDirPath,
|
|
5231
|
+
rulesyncSubagent
|
|
5232
|
+
});
|
|
5233
|
+
case "copilot":
|
|
5234
|
+
return CopilotSubagent.fromRulesyncSubagent({
|
|
5235
|
+
baseDir: this.baseDir,
|
|
5236
|
+
relativeDirPath: RulesyncSubagent.getSettablePaths().relativeDirPath,
|
|
5237
|
+
rulesyncSubagent
|
|
5238
|
+
});
|
|
5239
|
+
case "cursor":
|
|
5240
|
+
return CursorSubagent.fromRulesyncSubagent({
|
|
5241
|
+
baseDir: this.baseDir,
|
|
5242
|
+
relativeDirPath: RulesyncSubagent.getSettablePaths().relativeDirPath,
|
|
5243
|
+
rulesyncSubagent
|
|
5244
|
+
});
|
|
5245
|
+
case "codexcli":
|
|
5246
|
+
return CodexCliSubagent.fromRulesyncSubagent({
|
|
5247
|
+
baseDir: this.baseDir,
|
|
5248
|
+
relativeDirPath: RulesyncSubagent.getSettablePaths().relativeDirPath,
|
|
4154
5249
|
rulesyncSubagent
|
|
4155
5250
|
});
|
|
4156
5251
|
default:
|
|
@@ -4163,9 +5258,16 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4163
5258
|
const toolSubagents = toolFiles.filter(
|
|
4164
5259
|
(file) => file instanceof ToolSubagent
|
|
4165
5260
|
);
|
|
4166
|
-
const rulesyncSubagents =
|
|
4167
|
-
|
|
4168
|
-
|
|
5261
|
+
const rulesyncSubagents = [];
|
|
5262
|
+
for (const toolSubagent of toolSubagents) {
|
|
5263
|
+
if (toolSubagent instanceof SimulatedSubagent) {
|
|
5264
|
+
logger.debug(
|
|
5265
|
+
`Skipping simulated subagent conversion: ${toolSubagent.getRelativeFilePath()}`
|
|
5266
|
+
);
|
|
5267
|
+
continue;
|
|
5268
|
+
}
|
|
5269
|
+
rulesyncSubagents.push(toolSubagent.toRulesyncSubagent());
|
|
5270
|
+
}
|
|
4169
5271
|
return rulesyncSubagents;
|
|
4170
5272
|
}
|
|
4171
5273
|
/**
|
|
@@ -4173,7 +5275,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4173
5275
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
4174
5276
|
*/
|
|
4175
5277
|
async loadRulesyncFiles() {
|
|
4176
|
-
const subagentsDir = (0,
|
|
5278
|
+
const subagentsDir = (0, import_node_path53.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
4177
5279
|
const dirExists = await directoryExists(subagentsDir);
|
|
4178
5280
|
if (!dirExists) {
|
|
4179
5281
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -4188,7 +5290,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4188
5290
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
4189
5291
|
const rulesyncSubagents = [];
|
|
4190
5292
|
for (const mdFile of mdFiles) {
|
|
4191
|
-
const filepath = (0,
|
|
5293
|
+
const filepath = (0, import_node_path53.join)(subagentsDir, mdFile);
|
|
4192
5294
|
try {
|
|
4193
5295
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
4194
5296
|
relativeFilePath: mdFile,
|
|
@@ -4216,6 +5318,12 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4216
5318
|
switch (this.toolTarget) {
|
|
4217
5319
|
case "claudecode":
|
|
4218
5320
|
return await this.loadClaudecodeSubagents();
|
|
5321
|
+
case "copilot":
|
|
5322
|
+
return await this.loadCopilotSubagents();
|
|
5323
|
+
case "cursor":
|
|
5324
|
+
return await this.loadCursorSubagents();
|
|
5325
|
+
case "codexcli":
|
|
5326
|
+
return await this.loadCodexCliSubagents();
|
|
4219
5327
|
default:
|
|
4220
5328
|
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
4221
5329
|
}
|
|
@@ -4225,16 +5333,43 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4225
5333
|
*/
|
|
4226
5334
|
async loadClaudecodeSubagents() {
|
|
4227
5335
|
return await this.loadToolSubagentsDefault({
|
|
4228
|
-
relativeDirPath:
|
|
5336
|
+
relativeDirPath: ClaudecodeSubagent.getSettablePaths().relativeDirPath,
|
|
4229
5337
|
fromFile: (relativeFilePath) => ClaudecodeSubagent.fromFile({ relativeFilePath })
|
|
4230
5338
|
});
|
|
4231
5339
|
}
|
|
5340
|
+
/**
|
|
5341
|
+
* Load Copilot subagent configurations from .copilot/subagents/ directory
|
|
5342
|
+
*/
|
|
5343
|
+
async loadCopilotSubagents() {
|
|
5344
|
+
return await this.loadToolSubagentsDefault({
|
|
5345
|
+
relativeDirPath: CopilotSubagent.getSettablePaths().relativeDirPath,
|
|
5346
|
+
fromFile: (relativeFilePath) => CopilotSubagent.fromFile({ relativeFilePath })
|
|
5347
|
+
});
|
|
5348
|
+
}
|
|
5349
|
+
/**
|
|
5350
|
+
* Load Cursor subagent configurations from .cursor/subagents/ directory
|
|
5351
|
+
*/
|
|
5352
|
+
async loadCursorSubagents() {
|
|
5353
|
+
return await this.loadToolSubagentsDefault({
|
|
5354
|
+
relativeDirPath: CursorSubagent.getSettablePaths().relativeDirPath,
|
|
5355
|
+
fromFile: (relativeFilePath) => CursorSubagent.fromFile({ relativeFilePath })
|
|
5356
|
+
});
|
|
5357
|
+
}
|
|
5358
|
+
/**
|
|
5359
|
+
* Load CodexCli subagent configurations from .codex/subagents/ directory
|
|
5360
|
+
*/
|
|
5361
|
+
async loadCodexCliSubagents() {
|
|
5362
|
+
return await this.loadToolSubagentsDefault({
|
|
5363
|
+
relativeDirPath: CodexCliSubagent.getSettablePaths().relativeDirPath,
|
|
5364
|
+
fromFile: (relativeFilePath) => CodexCliSubagent.fromFile({ relativeFilePath })
|
|
5365
|
+
});
|
|
5366
|
+
}
|
|
4232
5367
|
async loadToolSubagentsDefault({
|
|
4233
5368
|
relativeDirPath,
|
|
4234
5369
|
fromFile
|
|
4235
5370
|
}) {
|
|
4236
|
-
const paths = await findFilesByGlobs((0,
|
|
4237
|
-
const subagents = (await Promise.allSettled(paths.map((path2) => fromFile((0,
|
|
5371
|
+
const paths = await findFilesByGlobs((0, import_node_path53.join)(this.baseDir, relativeDirPath, "*.md"));
|
|
5372
|
+
const subagents = (await Promise.allSettled(paths.map((path2) => fromFile((0, import_node_path53.basename)(path2))))).filter((r) => r.status === "fulfilled").map((r) => r.value);
|
|
4238
5373
|
logger.info(`Successfully loaded ${subagents.length} ${relativeDirPath} subagents`);
|
|
4239
5374
|
return subagents;
|
|
4240
5375
|
}
|
|
@@ -4242,7 +5377,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4242
5377
|
* Implementation of abstract method from FeatureProcessor
|
|
4243
5378
|
* Return the tool targets that this processor supports
|
|
4244
5379
|
*/
|
|
4245
|
-
static getToolTargets(
|
|
5380
|
+
static getToolTargets({
|
|
5381
|
+
includeSimulated = false
|
|
5382
|
+
} = {}) {
|
|
5383
|
+
if (!includeSimulated) {
|
|
5384
|
+
return subagentsProcessorToolTargets.filter(
|
|
5385
|
+
(target) => !subagentsProcessorToolTargetsSimulated.includes(target)
|
|
5386
|
+
);
|
|
5387
|
+
}
|
|
4246
5388
|
return subagentsProcessorToolTargets;
|
|
4247
5389
|
}
|
|
4248
5390
|
};
|
|
@@ -4264,7 +5406,9 @@ async function generateCommand(options) {
|
|
|
4264
5406
|
for (const toolTarget of (0, import_es_toolkit.intersection)(config.getTargets(), RulesProcessor.getToolTargets())) {
|
|
4265
5407
|
const processor = new RulesProcessor({
|
|
4266
5408
|
baseDir,
|
|
4267
|
-
toolTarget
|
|
5409
|
+
toolTarget,
|
|
5410
|
+
simulateCommands: config.getExperimentalSimulateCommands(),
|
|
5411
|
+
simulateSubagents: config.getExperimentalSimulateSubagents()
|
|
4268
5412
|
});
|
|
4269
5413
|
if (config.getDelete()) {
|
|
4270
5414
|
const oldToolFiles = await processor.loadToolFiles();
|
|
@@ -4322,18 +5466,12 @@ async function generateCommand(options) {
|
|
|
4322
5466
|
let totalCommandOutputs = 0;
|
|
4323
5467
|
if (config.getFeatures().includes("commands")) {
|
|
4324
5468
|
logger.info("Generating command files...");
|
|
4325
|
-
const supportedCommandTargets = [
|
|
4326
|
-
"claudecode",
|
|
4327
|
-
"geminicli",
|
|
4328
|
-
"roo"
|
|
4329
|
-
];
|
|
4330
|
-
const commandSupportedTargets = config.getTargets().filter((target) => {
|
|
4331
|
-
return supportedCommandTargets.some((supportedTarget) => supportedTarget === target);
|
|
4332
|
-
});
|
|
4333
5469
|
for (const baseDir of config.getBaseDirs()) {
|
|
4334
5470
|
for (const toolTarget of (0, import_es_toolkit.intersection)(
|
|
4335
|
-
|
|
4336
|
-
CommandsProcessor.getToolTargets(
|
|
5471
|
+
config.getTargets(),
|
|
5472
|
+
CommandsProcessor.getToolTargets({
|
|
5473
|
+
includeSimulated: config.getExperimentalSimulateCommands()
|
|
5474
|
+
})
|
|
4337
5475
|
)) {
|
|
4338
5476
|
const processor = new CommandsProcessor({
|
|
4339
5477
|
baseDir,
|
|
@@ -4390,7 +5528,9 @@ async function generateCommand(options) {
|
|
|
4390
5528
|
for (const baseDir of config.getBaseDirs()) {
|
|
4391
5529
|
for (const toolTarget of (0, import_es_toolkit.intersection)(
|
|
4392
5530
|
config.getTargets(),
|
|
4393
|
-
SubagentsProcessor.getToolTargets(
|
|
5531
|
+
SubagentsProcessor.getToolTargets({
|
|
5532
|
+
includeSimulated: config.getExperimentalSimulateSubagents()
|
|
5533
|
+
})
|
|
4394
5534
|
)) {
|
|
4395
5535
|
const processor = new SubagentsProcessor({
|
|
4396
5536
|
baseDir,
|
|
@@ -4426,16 +5566,15 @@ async function generateCommand(options) {
|
|
|
4426
5566
|
}
|
|
4427
5567
|
|
|
4428
5568
|
// src/cli/commands/gitignore.ts
|
|
4429
|
-
var
|
|
5569
|
+
var import_node_path54 = require("path");
|
|
4430
5570
|
var gitignoreCommand = async () => {
|
|
4431
|
-
const gitignorePath = (0,
|
|
5571
|
+
const gitignorePath = (0, import_node_path54.join)(process.cwd(), ".gitignore");
|
|
4432
5572
|
const rulesFilesToIgnore = [
|
|
4433
5573
|
"# Generated by rulesync - AI tool configuration files",
|
|
4434
|
-
"**/.amazonq/
|
|
4435
|
-
"**/.amazonq/mcp.json",
|
|
5574
|
+
"**/.amazonq/",
|
|
4436
5575
|
"**/.github/copilot-instructions.md",
|
|
4437
5576
|
"**/.github/instructions/",
|
|
4438
|
-
"**/.cursor/
|
|
5577
|
+
"**/.cursor/",
|
|
4439
5578
|
"**/.cursorignore",
|
|
4440
5579
|
"**/.clinerules/",
|
|
4441
5580
|
"**/.clineignore",
|
|
@@ -4445,7 +5584,6 @@ var gitignoreCommand = async () => {
|
|
|
4445
5584
|
"**/.claude/agents/",
|
|
4446
5585
|
"**/AGENTS.md",
|
|
4447
5586
|
"**/.agents/",
|
|
4448
|
-
"**/.codexignore",
|
|
4449
5587
|
"**/.roo/rules/",
|
|
4450
5588
|
"**/.rooignore",
|
|
4451
5589
|
"**/.copilotignore",
|
|
@@ -4466,14 +5604,16 @@ var gitignoreCommand = async () => {
|
|
|
4466
5604
|
"**/.opencode/commands/",
|
|
4467
5605
|
"**/opencode.json",
|
|
4468
5606
|
"**/.mcp.json",
|
|
4469
|
-
"!.rulesync/.mcp.json",
|
|
4470
5607
|
"**/.cursor/mcp.json",
|
|
4471
5608
|
"**/.cline/mcp.json",
|
|
5609
|
+
"**/.roo/mcp.json",
|
|
4472
5610
|
"**/.vscode/mcp.json",
|
|
4473
|
-
"**/.
|
|
4474
|
-
"**/.
|
|
4475
|
-
"**/.
|
|
4476
|
-
"
|
|
5611
|
+
"**/.github/commands/",
|
|
5612
|
+
"**/.github/subagents/",
|
|
5613
|
+
"**/.warp/",
|
|
5614
|
+
"**/WARP.md",
|
|
5615
|
+
"**/.codexignore",
|
|
5616
|
+
"**/.codex/"
|
|
4477
5617
|
];
|
|
4478
5618
|
let gitignoreContent = "";
|
|
4479
5619
|
if (await fileExists(gitignorePath)) {
|
|
@@ -4577,7 +5717,8 @@ async function importCommand(options) {
|
|
|
4577
5717
|
}
|
|
4578
5718
|
let subagentsCreated = 0;
|
|
4579
5719
|
if (config.getFeatures().includes("subagents")) {
|
|
4580
|
-
|
|
5720
|
+
const supportedTargets = SubagentsProcessor.getToolTargets({ includeSimulated: false });
|
|
5721
|
+
if (supportedTargets.includes(tool)) {
|
|
4581
5722
|
const subagentsProcessor = new SubagentsProcessor({
|
|
4582
5723
|
baseDir: ".",
|
|
4583
5724
|
toolTarget: tool
|
|
@@ -4595,8 +5736,8 @@ async function importCommand(options) {
|
|
|
4595
5736
|
}
|
|
4596
5737
|
let commandsCreated = 0;
|
|
4597
5738
|
if (config.getFeatures().includes("commands")) {
|
|
4598
|
-
const supportedTargets = CommandsProcessor.getToolTargets();
|
|
4599
|
-
if (supportedTargets
|
|
5739
|
+
const supportedTargets = CommandsProcessor.getToolTargets({ includeSimulated: false });
|
|
5740
|
+
if (supportedTargets.includes(tool)) {
|
|
4600
5741
|
const commandsProcessor = new CommandsProcessor({
|
|
4601
5742
|
baseDir: ".",
|
|
4602
5743
|
toolTarget: tool
|
|
@@ -4615,7 +5756,7 @@ async function importCommand(options) {
|
|
|
4615
5756
|
}
|
|
4616
5757
|
|
|
4617
5758
|
// src/cli/commands/init.ts
|
|
4618
|
-
var
|
|
5759
|
+
var import_node_path55 = require("path");
|
|
4619
5760
|
async function initCommand() {
|
|
4620
5761
|
logger.info("Initializing rulesync...");
|
|
4621
5762
|
await ensureDir(RULESYNC_DIR);
|
|
@@ -4661,9 +5802,9 @@ globs: ["**/*"]
|
|
|
4661
5802
|
- Follow single responsibility principle
|
|
4662
5803
|
`
|
|
4663
5804
|
};
|
|
4664
|
-
const filepath = (0,
|
|
5805
|
+
const filepath = (0, import_node_path55.join)(RULESYNC_RULES_DIR, sampleFile.filename);
|
|
4665
5806
|
await ensureDir(RULESYNC_RULES_DIR);
|
|
4666
|
-
await ensureDir(
|
|
5807
|
+
await ensureDir(RulesyncCommand.getSettablePaths().relativeDirPath);
|
|
4667
5808
|
await ensureDir(RULESYNC_SUBAGENTS_DIR);
|
|
4668
5809
|
if (!await fileExists(filepath)) {
|
|
4669
5810
|
await writeFileContent(filepath, sampleFile.content);
|
|
@@ -4680,15 +5821,15 @@ var getVersion = async () => {
|
|
|
4680
5821
|
let packageJsonPath;
|
|
4681
5822
|
if (typeof import_meta !== "undefined" && import_meta.url) {
|
|
4682
5823
|
const __filename = (0, import_node_url.fileURLToPath)(import_meta.url);
|
|
4683
|
-
const __dirname = (0,
|
|
4684
|
-
packageJsonPath = (0,
|
|
5824
|
+
const __dirname = (0, import_node_path56.join)(__filename, "..");
|
|
5825
|
+
packageJsonPath = (0, import_node_path56.join)(__dirname, "../../package.json");
|
|
4685
5826
|
} else {
|
|
4686
|
-
packageJsonPath = (0,
|
|
5827
|
+
packageJsonPath = (0, import_node_path56.join)(process.cwd(), "package.json");
|
|
4687
5828
|
}
|
|
4688
5829
|
const packageJson = await readJsonFile(packageJsonPath);
|
|
4689
5830
|
return packageJson.version;
|
|
4690
5831
|
} catch {
|
|
4691
|
-
return "0.
|
|
5832
|
+
return "0.71.0";
|
|
4692
5833
|
}
|
|
4693
5834
|
};
|
|
4694
5835
|
var main = async () => {
|
|
@@ -4714,7 +5855,7 @@ var main = async () => {
|
|
|
4714
5855
|
(value) => {
|
|
4715
5856
|
return value.split(",").map((f) => f.trim());
|
|
4716
5857
|
}
|
|
4717
|
-
).option("--verbose", "Verbose output").action(async (options) => {
|
|
5858
|
+
).option("-V, --verbose", "Verbose output").action(async (options) => {
|
|
4718
5859
|
try {
|
|
4719
5860
|
await importCommand({
|
|
4720
5861
|
targets: options.targets,
|
|
@@ -4742,7 +5883,13 @@ var main = async () => {
|
|
|
4742
5883
|
).option("--delete", "Delete all existing files in output directories before generating").option(
|
|
4743
5884
|
"-b, --base-dir <paths>",
|
|
4744
5885
|
"Base directories to generate files (comma-separated for multiple paths)"
|
|
4745
|
-
).option("-
|
|
5886
|
+
).option("-V, --verbose", "Verbose output").option("-c, --config <path>", "Path to configuration file").option(
|
|
5887
|
+
"--experimental-simulate-commands",
|
|
5888
|
+
"Generate simulated commands (experimental feature). This feature is only available for copilot, cursor and codexcli."
|
|
5889
|
+
).option(
|
|
5890
|
+
"--experimental-simulate-subagents",
|
|
5891
|
+
"Generate simulated subagents (experimental feature). This feature is only available for copilot, cursor and codexcli."
|
|
5892
|
+
).action(async (options) => {
|
|
4746
5893
|
try {
|
|
4747
5894
|
await generateCommand({
|
|
4748
5895
|
targets: options.targets,
|
|
@@ -4750,7 +5897,9 @@ var main = async () => {
|
|
|
4750
5897
|
verbose: options.verbose,
|
|
4751
5898
|
delete: options.delete,
|
|
4752
5899
|
baseDirs: options.baseDirs,
|
|
4753
|
-
configPath: options.config
|
|
5900
|
+
configPath: options.config,
|
|
5901
|
+
experimentalSimulateCommands: options.experimentalSimulateCommands,
|
|
5902
|
+
experimentalSimulateSubagents: options.experimentalSimulateSubagents
|
|
4754
5903
|
});
|
|
4755
5904
|
} catch (error) {
|
|
4756
5905
|
logger.error(error instanceof Error ? error.message : String(error));
|