rulesync 0.70.0 → 0.71.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 +36 -4
- package/dist/index.cjs +1625 -469
- package/dist/index.js +1620 -464
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/cli/index.ts
|
|
4
|
-
import { join as
|
|
4
|
+
import { join as join55 } from "path";
|
|
5
5
|
import { fileURLToPath } from "url";
|
|
6
6
|
import { Command } from "commander";
|
|
7
7
|
|
|
@@ -230,7 +230,9 @@ async function initConfig() {
|
|
|
230
230
|
features: ["rules", "ignore", "mcp", "commands", "subagents"],
|
|
231
231
|
baseDirs: ["."],
|
|
232
232
|
delete: true,
|
|
233
|
-
verbose: false
|
|
233
|
+
verbose: false,
|
|
234
|
+
experimentalSimulateCommands: false,
|
|
235
|
+
experimentalSimulateSubagents: false
|
|
234
236
|
},
|
|
235
237
|
null,
|
|
236
238
|
2
|
|
@@ -243,8 +245,8 @@ async function initConfig() {
|
|
|
243
245
|
import { intersection } from "es-toolkit";
|
|
244
246
|
|
|
245
247
|
// src/commands/commands-processor.ts
|
|
246
|
-
import { basename as
|
|
247
|
-
import { z as
|
|
248
|
+
import { basename as basename10, join as join10 } from "path";
|
|
249
|
+
import { z as z8 } from "zod/mini";
|
|
248
250
|
|
|
249
251
|
// src/types/feature-processor.ts
|
|
250
252
|
var FeatureProcessor = class {
|
|
@@ -255,7 +257,7 @@ var FeatureProcessor = class {
|
|
|
255
257
|
/**
|
|
256
258
|
* Return tool targets that this feature supports.
|
|
257
259
|
*/
|
|
258
|
-
static getToolTargets() {
|
|
260
|
+
static getToolTargets(_params = {}) {
|
|
259
261
|
throw new Error("Not implemented");
|
|
260
262
|
}
|
|
261
263
|
/**
|
|
@@ -276,7 +278,7 @@ var FeatureProcessor = class {
|
|
|
276
278
|
};
|
|
277
279
|
|
|
278
280
|
// src/commands/claudecode-command.ts
|
|
279
|
-
import { basename as basename3, join as
|
|
281
|
+
import { basename as basename3, join as join3 } from "path";
|
|
280
282
|
import { z as z4 } from "zod/mini";
|
|
281
283
|
|
|
282
284
|
// src/utils/frontmatter.ts
|
|
@@ -307,6 +309,9 @@ function deepRemoveNullishValue(value) {
|
|
|
307
309
|
return value;
|
|
308
310
|
}
|
|
309
311
|
function deepRemoveNullishObject(obj) {
|
|
312
|
+
if (!obj || typeof obj !== "object") {
|
|
313
|
+
return {};
|
|
314
|
+
}
|
|
310
315
|
const result = {};
|
|
311
316
|
for (const [key, val] of Object.entries(obj)) {
|
|
312
317
|
const cleaned = deepRemoveNullishValue(val);
|
|
@@ -326,18 +331,9 @@ function parseFrontmatter(content) {
|
|
|
326
331
|
}
|
|
327
332
|
|
|
328
333
|
// src/commands/rulesync-command.ts
|
|
329
|
-
import { basename as basename2, join as
|
|
334
|
+
import { basename as basename2, join as join2 } from "path";
|
|
330
335
|
import { z as z3 } from "zod/mini";
|
|
331
336
|
|
|
332
|
-
// src/constants/paths.ts
|
|
333
|
-
import { join as join2 } from "path";
|
|
334
|
-
var RULESYNC_DIR = ".rulesync";
|
|
335
|
-
var RULESYNC_RULES_DIR = join2(".rulesync", "rules");
|
|
336
|
-
var RULESYNC_RULES_DIR_LEGACY = ".rulesync";
|
|
337
|
-
var RULESYNC_MCP_FILE = join2(".rulesync", ".mcp.json");
|
|
338
|
-
var RULESYNC_COMMANDS_DIR = join2(".rulesync", "commands");
|
|
339
|
-
var RULESYNC_SUBAGENTS_DIR = join2(".rulesync", "subagents");
|
|
340
|
-
|
|
341
337
|
// src/types/ai-file.ts
|
|
342
338
|
import path from "path";
|
|
343
339
|
var AiFile = class {
|
|
@@ -433,6 +429,11 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
433
429
|
this.frontmatter = frontmatter;
|
|
434
430
|
this.body = body;
|
|
435
431
|
}
|
|
432
|
+
static getSettablePaths() {
|
|
433
|
+
return {
|
|
434
|
+
relativeDirPath: ".rulesync/commands"
|
|
435
|
+
};
|
|
436
|
+
}
|
|
436
437
|
getFrontmatter() {
|
|
437
438
|
return this.frontmatter;
|
|
438
439
|
}
|
|
@@ -453,7 +454,9 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
453
454
|
static async fromFile({
|
|
454
455
|
relativeFilePath
|
|
455
456
|
}) {
|
|
456
|
-
const fileContent = await readFileContent(
|
|
457
|
+
const fileContent = await readFileContent(
|
|
458
|
+
join2(_RulesyncCommand.getSettablePaths().relativeDirPath, relativeFilePath)
|
|
459
|
+
);
|
|
457
460
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
458
461
|
const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
|
|
459
462
|
if (!result.success) {
|
|
@@ -462,7 +465,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
462
465
|
const filename = basename2(relativeFilePath);
|
|
463
466
|
return new _RulesyncCommand({
|
|
464
467
|
baseDir: ".",
|
|
465
|
-
relativeDirPath:
|
|
468
|
+
relativeDirPath: _RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
466
469
|
relativeFilePath: filename,
|
|
467
470
|
frontmatter: result.data,
|
|
468
471
|
body: content.trim(),
|
|
@@ -473,6 +476,9 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
473
476
|
|
|
474
477
|
// src/commands/tool-command.ts
|
|
475
478
|
var ToolCommand = class extends AiFile {
|
|
479
|
+
static getSettablePaths() {
|
|
480
|
+
throw new Error("Please implement this method in the subclass.");
|
|
481
|
+
}
|
|
476
482
|
/**
|
|
477
483
|
* Load a command from a tool-specific file path.
|
|
478
484
|
*
|
|
@@ -526,6 +532,11 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
526
532
|
this.frontmatter = frontmatter;
|
|
527
533
|
this.body = body;
|
|
528
534
|
}
|
|
535
|
+
static getSettablePaths() {
|
|
536
|
+
return {
|
|
537
|
+
relativeDirPath: ".claude/commands"
|
|
538
|
+
};
|
|
539
|
+
}
|
|
529
540
|
getBody() {
|
|
530
541
|
return this.body;
|
|
531
542
|
}
|
|
@@ -542,7 +553,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
542
553
|
baseDir: this.baseDir,
|
|
543
554
|
frontmatter: rulesyncFrontmatter,
|
|
544
555
|
body: this.body,
|
|
545
|
-
relativeDirPath:
|
|
556
|
+
relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
546
557
|
relativeFilePath: this.relativeFilePath,
|
|
547
558
|
fileContent,
|
|
548
559
|
validate: true
|
|
@@ -562,7 +573,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
562
573
|
baseDir,
|
|
563
574
|
frontmatter: claudecodeFrontmatter,
|
|
564
575
|
body,
|
|
565
|
-
relativeDirPath:
|
|
576
|
+
relativeDirPath: _ClaudecodeCommand.getSettablePaths().relativeDirPath,
|
|
566
577
|
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
567
578
|
validate
|
|
568
579
|
});
|
|
@@ -583,7 +594,11 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
583
594
|
relativeFilePath,
|
|
584
595
|
validate = true
|
|
585
596
|
}) {
|
|
586
|
-
const filePath =
|
|
597
|
+
const filePath = join3(
|
|
598
|
+
baseDir,
|
|
599
|
+
_ClaudecodeCommand.getSettablePaths().relativeDirPath,
|
|
600
|
+
relativeFilePath
|
|
601
|
+
);
|
|
587
602
|
const fileContent = await readFileContent(filePath);
|
|
588
603
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
589
604
|
const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -592,7 +607,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
592
607
|
}
|
|
593
608
|
return new _ClaudecodeCommand({
|
|
594
609
|
baseDir,
|
|
595
|
-
relativeDirPath:
|
|
610
|
+
relativeDirPath: _ClaudecodeCommand.getSettablePaths().relativeDirPath,
|
|
596
611
|
relativeFilePath: basename3(relativeFilePath),
|
|
597
612
|
frontmatter: result.data,
|
|
598
613
|
body: content.trim(),
|
|
@@ -601,13 +616,236 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
601
616
|
}
|
|
602
617
|
};
|
|
603
618
|
|
|
619
|
+
// src/commands/codexcli-command.ts
|
|
620
|
+
import { basename as basename5, join as join5 } from "path";
|
|
621
|
+
|
|
622
|
+
// src/commands/simulated-command.ts
|
|
623
|
+
import { basename as basename4, join as join4 } from "path";
|
|
624
|
+
import { z as z5 } from "zod/mini";
|
|
625
|
+
var SimulatedCommandFrontmatterSchema = z5.object({
|
|
626
|
+
description: z5.string()
|
|
627
|
+
});
|
|
628
|
+
var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
629
|
+
frontmatter;
|
|
630
|
+
body;
|
|
631
|
+
constructor({ frontmatter, body, ...rest }) {
|
|
632
|
+
if (rest.validate) {
|
|
633
|
+
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
634
|
+
if (!result.success) {
|
|
635
|
+
throw result.error;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
super({
|
|
639
|
+
...rest,
|
|
640
|
+
fileContent: stringifyFrontmatter(body, frontmatter)
|
|
641
|
+
});
|
|
642
|
+
this.frontmatter = frontmatter;
|
|
643
|
+
this.body = body;
|
|
644
|
+
}
|
|
645
|
+
getBody() {
|
|
646
|
+
return this.body;
|
|
647
|
+
}
|
|
648
|
+
getFrontmatter() {
|
|
649
|
+
return this.frontmatter;
|
|
650
|
+
}
|
|
651
|
+
toRulesyncCommand() {
|
|
652
|
+
throw new Error("Not implemented because it is a SIMULATED file.");
|
|
653
|
+
}
|
|
654
|
+
static fromRulesyncCommandDefault({
|
|
655
|
+
baseDir = ".",
|
|
656
|
+
rulesyncCommand,
|
|
657
|
+
validate = true
|
|
658
|
+
}) {
|
|
659
|
+
const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
|
|
660
|
+
const claudecodeFrontmatter = {
|
|
661
|
+
description: rulesyncFrontmatter.description
|
|
662
|
+
};
|
|
663
|
+
const body = rulesyncCommand.getBody();
|
|
664
|
+
return {
|
|
665
|
+
baseDir,
|
|
666
|
+
frontmatter: claudecodeFrontmatter,
|
|
667
|
+
body,
|
|
668
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
669
|
+
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
670
|
+
validate
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
validate() {
|
|
674
|
+
if (!this.frontmatter) {
|
|
675
|
+
return { success: true, error: null };
|
|
676
|
+
}
|
|
677
|
+
const result = SimulatedCommandFrontmatterSchema.safeParse(this.frontmatter);
|
|
678
|
+
if (result.success) {
|
|
679
|
+
return { success: true, error: null };
|
|
680
|
+
} else {
|
|
681
|
+
return { success: false, error: result.error };
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
static async fromFileDefault({
|
|
685
|
+
baseDir = ".",
|
|
686
|
+
relativeFilePath,
|
|
687
|
+
validate = true
|
|
688
|
+
}) {
|
|
689
|
+
const filePath = join4(
|
|
690
|
+
baseDir,
|
|
691
|
+
_SimulatedCommand.getSettablePaths().relativeDirPath,
|
|
692
|
+
relativeFilePath
|
|
693
|
+
);
|
|
694
|
+
const fileContent = await readFileContent(filePath);
|
|
695
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
696
|
+
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
697
|
+
if (!result.success) {
|
|
698
|
+
throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
|
|
699
|
+
}
|
|
700
|
+
return {
|
|
701
|
+
baseDir,
|
|
702
|
+
relativeDirPath: _SimulatedCommand.getSettablePaths().relativeDirPath,
|
|
703
|
+
relativeFilePath: basename4(relativeFilePath),
|
|
704
|
+
frontmatter: result.data,
|
|
705
|
+
body: content.trim(),
|
|
706
|
+
validate
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
};
|
|
710
|
+
|
|
711
|
+
// src/commands/codexcli-command.ts
|
|
712
|
+
var CodexCliCommand = class _CodexCliCommand extends SimulatedCommand {
|
|
713
|
+
static getSettablePaths() {
|
|
714
|
+
return {
|
|
715
|
+
relativeDirPath: ".codex/commands"
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
static fromRulesyncCommand({
|
|
719
|
+
baseDir = ".",
|
|
720
|
+
rulesyncCommand,
|
|
721
|
+
validate = true
|
|
722
|
+
}) {
|
|
723
|
+
return new _CodexCliCommand(
|
|
724
|
+
this.fromRulesyncCommandDefault({ baseDir, rulesyncCommand, validate })
|
|
725
|
+
);
|
|
726
|
+
}
|
|
727
|
+
static async fromFile({
|
|
728
|
+
baseDir = ".",
|
|
729
|
+
relativeFilePath,
|
|
730
|
+
validate = true
|
|
731
|
+
}) {
|
|
732
|
+
const filePath = join5(
|
|
733
|
+
baseDir,
|
|
734
|
+
_CodexCliCommand.getSettablePaths().relativeDirPath,
|
|
735
|
+
relativeFilePath
|
|
736
|
+
);
|
|
737
|
+
const fileContent = await readFileContent(filePath);
|
|
738
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
739
|
+
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
740
|
+
if (!result.success) {
|
|
741
|
+
throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
|
|
742
|
+
}
|
|
743
|
+
return new _CodexCliCommand({
|
|
744
|
+
baseDir,
|
|
745
|
+
relativeDirPath: _CodexCliCommand.getSettablePaths().relativeDirPath,
|
|
746
|
+
relativeFilePath: basename5(relativeFilePath),
|
|
747
|
+
frontmatter: result.data,
|
|
748
|
+
body: content.trim(),
|
|
749
|
+
validate
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
};
|
|
753
|
+
|
|
754
|
+
// src/commands/copilot-command.ts
|
|
755
|
+
import { basename as basename6, join as join6 } from "path";
|
|
756
|
+
var CopilotCommand = class _CopilotCommand extends SimulatedCommand {
|
|
757
|
+
static getSettablePaths() {
|
|
758
|
+
return {
|
|
759
|
+
relativeDirPath: ".copilot/commands"
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
static fromRulesyncCommand({
|
|
763
|
+
baseDir = ".",
|
|
764
|
+
rulesyncCommand,
|
|
765
|
+
validate = true
|
|
766
|
+
}) {
|
|
767
|
+
return new _CopilotCommand(
|
|
768
|
+
this.fromRulesyncCommandDefault({ baseDir, rulesyncCommand, validate })
|
|
769
|
+
);
|
|
770
|
+
}
|
|
771
|
+
static async fromFile({
|
|
772
|
+
baseDir = ".",
|
|
773
|
+
relativeFilePath,
|
|
774
|
+
validate = true
|
|
775
|
+
}) {
|
|
776
|
+
const filePath = join6(
|
|
777
|
+
baseDir,
|
|
778
|
+
_CopilotCommand.getSettablePaths().relativeDirPath,
|
|
779
|
+
relativeFilePath
|
|
780
|
+
);
|
|
781
|
+
const fileContent = await readFileContent(filePath);
|
|
782
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
783
|
+
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
784
|
+
if (!result.success) {
|
|
785
|
+
throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
|
|
786
|
+
}
|
|
787
|
+
return new _CopilotCommand({
|
|
788
|
+
baseDir,
|
|
789
|
+
relativeDirPath: _CopilotCommand.getSettablePaths().relativeDirPath,
|
|
790
|
+
relativeFilePath: basename6(relativeFilePath),
|
|
791
|
+
frontmatter: result.data,
|
|
792
|
+
body: content.trim(),
|
|
793
|
+
validate
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
};
|
|
797
|
+
|
|
798
|
+
// src/commands/cursor-command.ts
|
|
799
|
+
import { basename as basename7, join as join7 } from "path";
|
|
800
|
+
var CursorCommand = class _CursorCommand extends SimulatedCommand {
|
|
801
|
+
static getSettablePaths() {
|
|
802
|
+
return {
|
|
803
|
+
relativeDirPath: ".cursor/commands"
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
static fromRulesyncCommand({
|
|
807
|
+
baseDir = ".",
|
|
808
|
+
rulesyncCommand,
|
|
809
|
+
validate = true
|
|
810
|
+
}) {
|
|
811
|
+
return new _CursorCommand(
|
|
812
|
+
this.fromRulesyncCommandDefault({ baseDir, rulesyncCommand, validate })
|
|
813
|
+
);
|
|
814
|
+
}
|
|
815
|
+
static async fromFile({
|
|
816
|
+
baseDir = ".",
|
|
817
|
+
relativeFilePath,
|
|
818
|
+
validate = true
|
|
819
|
+
}) {
|
|
820
|
+
const filePath = join7(
|
|
821
|
+
baseDir,
|
|
822
|
+
_CursorCommand.getSettablePaths().relativeDirPath,
|
|
823
|
+
relativeFilePath
|
|
824
|
+
);
|
|
825
|
+
const fileContent = await readFileContent(filePath);
|
|
826
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
827
|
+
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
828
|
+
if (!result.success) {
|
|
829
|
+
throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
|
|
830
|
+
}
|
|
831
|
+
return new _CursorCommand({
|
|
832
|
+
baseDir,
|
|
833
|
+
relativeDirPath: _CursorCommand.getSettablePaths().relativeDirPath,
|
|
834
|
+
relativeFilePath: basename7(relativeFilePath),
|
|
835
|
+
frontmatter: result.data,
|
|
836
|
+
body: content.trim(),
|
|
837
|
+
validate
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
};
|
|
841
|
+
|
|
604
842
|
// src/commands/geminicli-command.ts
|
|
605
|
-
import { basename as
|
|
843
|
+
import { basename as basename8, join as join8 } from "path";
|
|
606
844
|
import { parse as parseToml } from "smol-toml";
|
|
607
|
-
import { z as
|
|
608
|
-
var GeminiCliCommandFrontmatterSchema =
|
|
609
|
-
description:
|
|
610
|
-
prompt:
|
|
845
|
+
import { z as z6 } from "zod/mini";
|
|
846
|
+
var GeminiCliCommandFrontmatterSchema = z6.object({
|
|
847
|
+
description: z6.optional(z6.string()),
|
|
848
|
+
prompt: z6.string()
|
|
611
849
|
});
|
|
612
850
|
var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
613
851
|
frontmatter;
|
|
@@ -618,6 +856,11 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
618
856
|
this.frontmatter = parsed;
|
|
619
857
|
this.body = parsed.prompt;
|
|
620
858
|
}
|
|
859
|
+
static getSettablePaths() {
|
|
860
|
+
return {
|
|
861
|
+
relativeDirPath: ".gemini/commands"
|
|
862
|
+
};
|
|
863
|
+
}
|
|
621
864
|
parseTomlContent(content) {
|
|
622
865
|
try {
|
|
623
866
|
const parsed = parseToml(content);
|
|
@@ -660,7 +903,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
660
903
|
baseDir: this.baseDir,
|
|
661
904
|
frontmatter: rulesyncFrontmatter,
|
|
662
905
|
body: this.body,
|
|
663
|
-
relativeDirPath:
|
|
906
|
+
relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
664
907
|
relativeFilePath: this.relativeFilePath,
|
|
665
908
|
fileContent,
|
|
666
909
|
validate: true
|
|
@@ -682,7 +925,7 @@ ${geminiFrontmatter.prompt}
|
|
|
682
925
|
"""`;
|
|
683
926
|
return new _GeminiCliCommand({
|
|
684
927
|
baseDir,
|
|
685
|
-
relativeDirPath:
|
|
928
|
+
relativeDirPath: _GeminiCliCommand.getSettablePaths().relativeDirPath,
|
|
686
929
|
relativeFilePath: rulesyncCommand.getRelativeFilePath().replace(".md", ".toml"),
|
|
687
930
|
fileContent: tomlContent,
|
|
688
931
|
validate
|
|
@@ -693,12 +936,16 @@ ${geminiFrontmatter.prompt}
|
|
|
693
936
|
relativeFilePath,
|
|
694
937
|
validate = true
|
|
695
938
|
}) {
|
|
696
|
-
const filePath =
|
|
939
|
+
const filePath = join8(
|
|
940
|
+
baseDir,
|
|
941
|
+
_GeminiCliCommand.getSettablePaths().relativeDirPath,
|
|
942
|
+
relativeFilePath
|
|
943
|
+
);
|
|
697
944
|
const fileContent = await readFileContent(filePath);
|
|
698
945
|
return new _GeminiCliCommand({
|
|
699
946
|
baseDir,
|
|
700
|
-
relativeDirPath:
|
|
701
|
-
relativeFilePath:
|
|
947
|
+
relativeDirPath: _GeminiCliCommand.getSettablePaths().relativeDirPath,
|
|
948
|
+
relativeFilePath: basename8(relativeFilePath),
|
|
702
949
|
fileContent,
|
|
703
950
|
validate
|
|
704
951
|
});
|
|
@@ -714,15 +961,20 @@ ${geminiFrontmatter.prompt}
|
|
|
714
961
|
};
|
|
715
962
|
|
|
716
963
|
// src/commands/roo-command.ts
|
|
717
|
-
import { basename as
|
|
718
|
-
import { optional, z as
|
|
719
|
-
var RooCommandFrontmatterSchema =
|
|
720
|
-
description:
|
|
721
|
-
"argument-hint": optional(
|
|
964
|
+
import { basename as basename9, join as join9 } from "path";
|
|
965
|
+
import { optional, z as z7 } from "zod/mini";
|
|
966
|
+
var RooCommandFrontmatterSchema = z7.object({
|
|
967
|
+
description: z7.string(),
|
|
968
|
+
"argument-hint": optional(z7.string())
|
|
722
969
|
});
|
|
723
970
|
var RooCommand = class _RooCommand extends ToolCommand {
|
|
724
971
|
frontmatter;
|
|
725
972
|
body;
|
|
973
|
+
static getSettablePaths() {
|
|
974
|
+
return {
|
|
975
|
+
relativeDirPath: ".roo/commands"
|
|
976
|
+
};
|
|
977
|
+
}
|
|
726
978
|
constructor({ frontmatter, body, ...rest }) {
|
|
727
979
|
if (rest.validate) {
|
|
728
980
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -753,7 +1005,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
753
1005
|
baseDir: this.baseDir,
|
|
754
1006
|
frontmatter: rulesyncFrontmatter,
|
|
755
1007
|
body: this.body,
|
|
756
|
-
relativeDirPath:
|
|
1008
|
+
relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
757
1009
|
relativeFilePath: this.relativeFilePath,
|
|
758
1010
|
fileContent,
|
|
759
1011
|
validate: true
|
|
@@ -774,7 +1026,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
774
1026
|
baseDir,
|
|
775
1027
|
frontmatter: rooFrontmatter,
|
|
776
1028
|
body,
|
|
777
|
-
relativeDirPath:
|
|
1029
|
+
relativeDirPath: _RooCommand.getSettablePaths().relativeDirPath,
|
|
778
1030
|
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
779
1031
|
fileContent,
|
|
780
1032
|
validate
|
|
@@ -796,7 +1048,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
796
1048
|
relativeFilePath,
|
|
797
1049
|
validate = true
|
|
798
1050
|
}) {
|
|
799
|
-
const filePath =
|
|
1051
|
+
const filePath = join9(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
800
1052
|
const fileContent = await readFileContent(filePath);
|
|
801
1053
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
802
1054
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -805,8 +1057,8 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
805
1057
|
}
|
|
806
1058
|
return new _RooCommand({
|
|
807
1059
|
baseDir,
|
|
808
|
-
relativeDirPath:
|
|
809
|
-
relativeFilePath:
|
|
1060
|
+
relativeDirPath: _RooCommand.getSettablePaths().relativeDirPath,
|
|
1061
|
+
relativeFilePath: basename9(relativeFilePath),
|
|
810
1062
|
frontmatter: result.data,
|
|
811
1063
|
body: content.trim(),
|
|
812
1064
|
fileContent,
|
|
@@ -816,8 +1068,16 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
816
1068
|
};
|
|
817
1069
|
|
|
818
1070
|
// src/commands/commands-processor.ts
|
|
819
|
-
var commandsProcessorToolTargets = [
|
|
820
|
-
|
|
1071
|
+
var commandsProcessorToolTargets = [
|
|
1072
|
+
"claudecode",
|
|
1073
|
+
"geminicli",
|
|
1074
|
+
"roo",
|
|
1075
|
+
"copilot",
|
|
1076
|
+
"cursor",
|
|
1077
|
+
"codexcli"
|
|
1078
|
+
];
|
|
1079
|
+
var CommandsProcessorToolTargetSchema = z8.enum(commandsProcessorToolTargets);
|
|
1080
|
+
var commandsProcessorToolTargetsSimulated = ["copilot", "cursor", "codexcli"];
|
|
821
1081
|
var CommandsProcessor = class extends FeatureProcessor {
|
|
822
1082
|
toolTarget;
|
|
823
1083
|
constructor({
|
|
@@ -848,6 +1108,21 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
848
1108
|
baseDir: this.baseDir,
|
|
849
1109
|
rulesyncCommand
|
|
850
1110
|
});
|
|
1111
|
+
case "copilot":
|
|
1112
|
+
return CopilotCommand.fromRulesyncCommand({
|
|
1113
|
+
baseDir: this.baseDir,
|
|
1114
|
+
rulesyncCommand
|
|
1115
|
+
});
|
|
1116
|
+
case "cursor":
|
|
1117
|
+
return CursorCommand.fromRulesyncCommand({
|
|
1118
|
+
baseDir: this.baseDir,
|
|
1119
|
+
rulesyncCommand
|
|
1120
|
+
});
|
|
1121
|
+
case "codexcli":
|
|
1122
|
+
return CodexCliCommand.fromRulesyncCommand({
|
|
1123
|
+
baseDir: this.baseDir,
|
|
1124
|
+
rulesyncCommand
|
|
1125
|
+
});
|
|
851
1126
|
default:
|
|
852
1127
|
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
853
1128
|
}
|
|
@@ -868,10 +1143,12 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
868
1143
|
* Load and parse rulesync command files from .rulesync/commands/ directory
|
|
869
1144
|
*/
|
|
870
1145
|
async loadRulesyncFiles() {
|
|
871
|
-
const rulesyncCommandPaths = await findFilesByGlobs(
|
|
1146
|
+
const rulesyncCommandPaths = await findFilesByGlobs(
|
|
1147
|
+
join10(RulesyncCommand.getSettablePaths().relativeDirPath, "*.md")
|
|
1148
|
+
);
|
|
872
1149
|
const rulesyncCommands = (await Promise.allSettled(
|
|
873
1150
|
rulesyncCommandPaths.map(
|
|
874
|
-
(path2) => RulesyncCommand.fromFile({ relativeFilePath:
|
|
1151
|
+
(path2) => RulesyncCommand.fromFile({ relativeFilePath: basename10(path2) })
|
|
875
1152
|
)
|
|
876
1153
|
)).filter((result) => result.status === "fulfilled").map((result) => result.value);
|
|
877
1154
|
logger.info(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
@@ -889,6 +1166,12 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
889
1166
|
return await this.loadGeminicliCommands();
|
|
890
1167
|
case "roo":
|
|
891
1168
|
return await this.loadRooCommands();
|
|
1169
|
+
case "copilot":
|
|
1170
|
+
return await this.loadCopilotCommands();
|
|
1171
|
+
case "cursor":
|
|
1172
|
+
return await this.loadCursorCommands();
|
|
1173
|
+
case "codexcli":
|
|
1174
|
+
return await this.loadCodexcliCommands();
|
|
892
1175
|
default:
|
|
893
1176
|
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
894
1177
|
}
|
|
@@ -899,17 +1182,23 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
899
1182
|
extension
|
|
900
1183
|
}) {
|
|
901
1184
|
const commandFilePaths = await findFilesByGlobs(
|
|
902
|
-
|
|
1185
|
+
join10(this.baseDir, relativeDirPath, `*.${extension}`)
|
|
903
1186
|
);
|
|
904
1187
|
const toolCommands = (await Promise.allSettled(
|
|
905
1188
|
commandFilePaths.map((path2) => {
|
|
906
1189
|
switch (toolTarget) {
|
|
907
1190
|
case "claudecode":
|
|
908
|
-
return ClaudecodeCommand.fromFile({ relativeFilePath:
|
|
1191
|
+
return ClaudecodeCommand.fromFile({ relativeFilePath: basename10(path2) });
|
|
909
1192
|
case "geminicli":
|
|
910
|
-
return GeminiCliCommand.fromFile({ relativeFilePath:
|
|
1193
|
+
return GeminiCliCommand.fromFile({ relativeFilePath: basename10(path2) });
|
|
911
1194
|
case "roo":
|
|
912
|
-
return RooCommand.fromFile({ relativeFilePath:
|
|
1195
|
+
return RooCommand.fromFile({ relativeFilePath: basename10(path2) });
|
|
1196
|
+
case "copilot":
|
|
1197
|
+
return CopilotCommand.fromFile({ relativeFilePath: basename10(path2) });
|
|
1198
|
+
case "cursor":
|
|
1199
|
+
return CursorCommand.fromFile({ relativeFilePath: basename10(path2) });
|
|
1200
|
+
case "codexcli":
|
|
1201
|
+
return CodexCliCommand.fromFile({ relativeFilePath: basename10(path2) });
|
|
913
1202
|
default:
|
|
914
1203
|
throw new Error(`Unsupported tool target: ${toolTarget}`);
|
|
915
1204
|
}
|
|
@@ -918,13 +1207,33 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
918
1207
|
logger.info(`Successfully loaded ${toolCommands.length} ${relativeDirPath} commands`);
|
|
919
1208
|
return toolCommands;
|
|
920
1209
|
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Load Claude Code command configurations from .claude/commands/ directory
|
|
1212
|
+
*/
|
|
1213
|
+
async loadCopilotCommands() {
|
|
1214
|
+
return await this.loadToolCommandDefault({
|
|
1215
|
+
toolTarget: "copilot",
|
|
1216
|
+
relativeDirPath: CopilotCommand.getSettablePaths().relativeDirPath,
|
|
1217
|
+
extension: "md"
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
921
1220
|
/**
|
|
922
1221
|
* Load Claude Code command configurations from .claude/commands/ directory
|
|
923
1222
|
*/
|
|
924
1223
|
async loadClaudecodeCommands() {
|
|
925
1224
|
return await this.loadToolCommandDefault({
|
|
926
1225
|
toolTarget: "claudecode",
|
|
927
|
-
relativeDirPath:
|
|
1226
|
+
relativeDirPath: ClaudecodeCommand.getSettablePaths().relativeDirPath,
|
|
1227
|
+
extension: "md"
|
|
1228
|
+
});
|
|
1229
|
+
}
|
|
1230
|
+
/**
|
|
1231
|
+
* Load Gemini CLI command configurations from .gemini/commands/ directory
|
|
1232
|
+
*/
|
|
1233
|
+
async loadCursorCommands() {
|
|
1234
|
+
return await this.loadToolCommandDefault({
|
|
1235
|
+
toolTarget: "cursor",
|
|
1236
|
+
relativeDirPath: CursorCommand.getSettablePaths().relativeDirPath,
|
|
928
1237
|
extension: "md"
|
|
929
1238
|
});
|
|
930
1239
|
}
|
|
@@ -934,7 +1243,17 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
934
1243
|
async loadGeminicliCommands() {
|
|
935
1244
|
return await this.loadToolCommandDefault({
|
|
936
1245
|
toolTarget: "geminicli",
|
|
937
|
-
relativeDirPath:
|
|
1246
|
+
relativeDirPath: GeminiCliCommand.getSettablePaths().relativeDirPath,
|
|
1247
|
+
extension: "md"
|
|
1248
|
+
});
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Load Roo Code command configurations from .roo/commands/ directory
|
|
1252
|
+
*/
|
|
1253
|
+
async loadCodexcliCommands() {
|
|
1254
|
+
return await this.loadToolCommandDefault({
|
|
1255
|
+
toolTarget: "codexcli",
|
|
1256
|
+
relativeDirPath: CodexCliCommand.getSettablePaths().relativeDirPath,
|
|
938
1257
|
extension: "md"
|
|
939
1258
|
});
|
|
940
1259
|
}
|
|
@@ -944,7 +1263,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
944
1263
|
async loadRooCommands() {
|
|
945
1264
|
return await this.loadToolCommandDefault({
|
|
946
1265
|
toolTarget: "roo",
|
|
947
|
-
relativeDirPath:
|
|
1266
|
+
relativeDirPath: RooCommand.getSettablePaths().relativeDirPath,
|
|
948
1267
|
extension: "md"
|
|
949
1268
|
});
|
|
950
1269
|
}
|
|
@@ -952,7 +1271,14 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
952
1271
|
* Implementation of abstract method from FeatureProcessor
|
|
953
1272
|
* Return the tool targets that this processor supports
|
|
954
1273
|
*/
|
|
955
|
-
static getToolTargets(
|
|
1274
|
+
static getToolTargets({
|
|
1275
|
+
includeSimulated = false
|
|
1276
|
+
} = {}) {
|
|
1277
|
+
if (!includeSimulated) {
|
|
1278
|
+
return commandsProcessorToolTargets.filter(
|
|
1279
|
+
(target) => !commandsProcessorToolTargetsSimulated.includes(target)
|
|
1280
|
+
);
|
|
1281
|
+
}
|
|
956
1282
|
return commandsProcessorToolTargets;
|
|
957
1283
|
}
|
|
958
1284
|
};
|
|
@@ -961,12 +1287,12 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
961
1287
|
import { loadConfig } from "c12";
|
|
962
1288
|
|
|
963
1289
|
// src/types/features.ts
|
|
964
|
-
import { z as
|
|
1290
|
+
import { z as z9 } from "zod/mini";
|
|
965
1291
|
var ALL_FEATURES = ["rules", "ignore", "mcp", "subagents", "commands"];
|
|
966
1292
|
var ALL_FEATURES_WITH_WILDCARD = [...ALL_FEATURES, "*"];
|
|
967
|
-
var FeatureSchema =
|
|
968
|
-
var FeaturesSchema2 =
|
|
969
|
-
var RulesyncFeaturesSchema =
|
|
1293
|
+
var FeatureSchema = z9.enum(ALL_FEATURES);
|
|
1294
|
+
var FeaturesSchema2 = z9.array(FeatureSchema);
|
|
1295
|
+
var RulesyncFeaturesSchema = z9.array(z9.enum(ALL_FEATURES_WITH_WILDCARD));
|
|
970
1296
|
|
|
971
1297
|
// src/config/config.ts
|
|
972
1298
|
var Config = class {
|
|
@@ -975,12 +1301,24 @@ var Config = class {
|
|
|
975
1301
|
features;
|
|
976
1302
|
verbose;
|
|
977
1303
|
delete;
|
|
978
|
-
|
|
1304
|
+
experimentalSimulateCommands;
|
|
1305
|
+
experimentalSimulateSubagents;
|
|
1306
|
+
constructor({
|
|
1307
|
+
baseDirs,
|
|
1308
|
+
targets,
|
|
1309
|
+
features,
|
|
1310
|
+
verbose,
|
|
1311
|
+
delete: isDelete,
|
|
1312
|
+
experimentalSimulateCommands,
|
|
1313
|
+
experimentalSimulateSubagents
|
|
1314
|
+
}) {
|
|
979
1315
|
this.baseDirs = baseDirs;
|
|
980
1316
|
this.targets = targets;
|
|
981
1317
|
this.features = features;
|
|
982
1318
|
this.verbose = verbose;
|
|
983
1319
|
this.delete = isDelete;
|
|
1320
|
+
this.experimentalSimulateCommands = experimentalSimulateCommands;
|
|
1321
|
+
this.experimentalSimulateSubagents = experimentalSimulateSubagents;
|
|
984
1322
|
}
|
|
985
1323
|
getBaseDirs() {
|
|
986
1324
|
return this.baseDirs;
|
|
@@ -1003,6 +1341,12 @@ var Config = class {
|
|
|
1003
1341
|
getDelete() {
|
|
1004
1342
|
return this.delete;
|
|
1005
1343
|
}
|
|
1344
|
+
getExperimentalSimulateCommands() {
|
|
1345
|
+
return this.experimentalSimulateCommands;
|
|
1346
|
+
}
|
|
1347
|
+
getExperimentalSimulateSubagents() {
|
|
1348
|
+
return this.experimentalSimulateSubagents;
|
|
1349
|
+
}
|
|
1006
1350
|
};
|
|
1007
1351
|
|
|
1008
1352
|
// src/config/config-resolver.ts
|
|
@@ -1012,7 +1356,9 @@ var defaults = {
|
|
|
1012
1356
|
verbose: false,
|
|
1013
1357
|
delete: false,
|
|
1014
1358
|
baseDirs: ["."],
|
|
1015
|
-
configPath: "rulesync.jsonc"
|
|
1359
|
+
configPath: "rulesync.jsonc",
|
|
1360
|
+
experimentalSimulateCommands: false,
|
|
1361
|
+
experimentalSimulateSubagents: false
|
|
1016
1362
|
};
|
|
1017
1363
|
var ConfigResolver = class {
|
|
1018
1364
|
static async resolve({
|
|
@@ -1021,7 +1367,9 @@ var ConfigResolver = class {
|
|
|
1021
1367
|
verbose,
|
|
1022
1368
|
delete: isDelete,
|
|
1023
1369
|
baseDirs,
|
|
1024
|
-
configPath = defaults.configPath
|
|
1370
|
+
configPath = defaults.configPath,
|
|
1371
|
+
experimentalSimulateCommands,
|
|
1372
|
+
experimentalSimulateSubagents
|
|
1025
1373
|
}) {
|
|
1026
1374
|
if (!fileExists(configPath)) {
|
|
1027
1375
|
return new Config({
|
|
@@ -1029,7 +1377,9 @@ var ConfigResolver = class {
|
|
|
1029
1377
|
features: features ?? defaults.features,
|
|
1030
1378
|
verbose: verbose ?? defaults.verbose,
|
|
1031
1379
|
delete: isDelete ?? defaults.delete,
|
|
1032
|
-
baseDirs: baseDirs ?? defaults.baseDirs
|
|
1380
|
+
baseDirs: baseDirs ?? defaults.baseDirs,
|
|
1381
|
+
experimentalSimulateCommands: experimentalSimulateCommands ?? defaults.experimentalSimulateCommands,
|
|
1382
|
+
experimentalSimulateSubagents: experimentalSimulateSubagents ?? defaults.experimentalSimulateSubagents
|
|
1033
1383
|
});
|
|
1034
1384
|
}
|
|
1035
1385
|
const loadOptions = {
|
|
@@ -1049,17 +1399,19 @@ var ConfigResolver = class {
|
|
|
1049
1399
|
features: features ?? configByFile.features ?? defaults.features,
|
|
1050
1400
|
verbose: verbose ?? configByFile.verbose ?? defaults.verbose,
|
|
1051
1401
|
delete: isDelete ?? configByFile.delete ?? defaults.delete,
|
|
1052
|
-
baseDirs: baseDirs ?? configByFile.baseDirs ?? defaults.baseDirs
|
|
1402
|
+
baseDirs: baseDirs ?? configByFile.baseDirs ?? defaults.baseDirs,
|
|
1403
|
+
experimentalSimulateCommands: experimentalSimulateCommands ?? configByFile.experimentalSimulateCommands ?? defaults.experimentalSimulateCommands,
|
|
1404
|
+
experimentalSimulateSubagents: experimentalSimulateSubagents ?? configByFile.experimentalSimulateSubagents ?? defaults.experimentalSimulateSubagents
|
|
1053
1405
|
};
|
|
1054
1406
|
return new Config(configParams);
|
|
1055
1407
|
}
|
|
1056
1408
|
};
|
|
1057
1409
|
|
|
1058
1410
|
// src/ignore/ignore-processor.ts
|
|
1059
|
-
import { z as
|
|
1411
|
+
import { z as z10 } from "zod/mini";
|
|
1060
1412
|
|
|
1061
|
-
// src/ignore/
|
|
1062
|
-
import { join as
|
|
1413
|
+
// src/ignore/amazonqcli-ignore.ts
|
|
1414
|
+
import { join as join11 } from "path";
|
|
1063
1415
|
|
|
1064
1416
|
// src/types/tool-file.ts
|
|
1065
1417
|
var ToolFile = class extends AiFile {
|
|
@@ -1070,12 +1422,18 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
1070
1422
|
validate() {
|
|
1071
1423
|
return { success: true, error: null };
|
|
1072
1424
|
}
|
|
1425
|
+
static getSettablePaths() {
|
|
1426
|
+
return {
|
|
1427
|
+
relativeDirPath: ".",
|
|
1428
|
+
relativeFilePath: ".rulesyncignore"
|
|
1429
|
+
};
|
|
1430
|
+
}
|
|
1073
1431
|
static async fromFile() {
|
|
1074
|
-
const fileContent = await readFileContent(
|
|
1432
|
+
const fileContent = await readFileContent(this.getSettablePaths().relativeFilePath);
|
|
1075
1433
|
return new _RulesyncIgnore({
|
|
1076
1434
|
baseDir: ".",
|
|
1077
|
-
relativeDirPath:
|
|
1078
|
-
relativeFilePath:
|
|
1435
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1436
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1079
1437
|
fileContent
|
|
1080
1438
|
});
|
|
1081
1439
|
}
|
|
@@ -1098,6 +1456,9 @@ var ToolIgnore = class extends ToolFile {
|
|
|
1098
1456
|
}
|
|
1099
1457
|
}
|
|
1100
1458
|
}
|
|
1459
|
+
static getSettablePaths() {
|
|
1460
|
+
throw new Error("Please implement this method in the subclass.");
|
|
1461
|
+
}
|
|
1101
1462
|
getPatterns() {
|
|
1102
1463
|
return this.patterns;
|
|
1103
1464
|
}
|
|
@@ -1120,8 +1481,70 @@ var ToolIgnore = class extends ToolFile {
|
|
|
1120
1481
|
}
|
|
1121
1482
|
};
|
|
1122
1483
|
|
|
1484
|
+
// src/ignore/amazonqcli-ignore.ts
|
|
1485
|
+
var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
1486
|
+
static getSettablePaths() {
|
|
1487
|
+
return {
|
|
1488
|
+
relativeDirPath: ".",
|
|
1489
|
+
relativeFilePath: ".amazonqignore"
|
|
1490
|
+
};
|
|
1491
|
+
}
|
|
1492
|
+
/**
|
|
1493
|
+
* Convert to RulesyncIgnore format
|
|
1494
|
+
*/
|
|
1495
|
+
toRulesyncIgnore() {
|
|
1496
|
+
return this.toRulesyncIgnoreDefault();
|
|
1497
|
+
}
|
|
1498
|
+
/**
|
|
1499
|
+
* Create AmazonqcliIgnore from RulesyncIgnore
|
|
1500
|
+
* Supports conversion from unified rulesync format to Amazon Q CLI specific format
|
|
1501
|
+
*/
|
|
1502
|
+
static fromRulesyncIgnore({
|
|
1503
|
+
baseDir = ".",
|
|
1504
|
+
rulesyncIgnore
|
|
1505
|
+
}) {
|
|
1506
|
+
const body = rulesyncIgnore.getFileContent();
|
|
1507
|
+
return new _AmazonqcliIgnore({
|
|
1508
|
+
baseDir,
|
|
1509
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1510
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1511
|
+
fileContent: body
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
/**
|
|
1515
|
+
* Create AmazonqcliIgnore from file path
|
|
1516
|
+
* Supports both proposed .q-ignore and .amazonqignore formats
|
|
1517
|
+
*/
|
|
1518
|
+
static async fromFile({
|
|
1519
|
+
baseDir = ".",
|
|
1520
|
+
validate = true
|
|
1521
|
+
}) {
|
|
1522
|
+
const fileContent = await readFileContent(
|
|
1523
|
+
join11(
|
|
1524
|
+
baseDir,
|
|
1525
|
+
this.getSettablePaths().relativeDirPath,
|
|
1526
|
+
this.getSettablePaths().relativeFilePath
|
|
1527
|
+
)
|
|
1528
|
+
);
|
|
1529
|
+
return new _AmazonqcliIgnore({
|
|
1530
|
+
baseDir,
|
|
1531
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1532
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1533
|
+
fileContent,
|
|
1534
|
+
validate
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
};
|
|
1538
|
+
|
|
1123
1539
|
// src/ignore/augmentcode-ignore.ts
|
|
1540
|
+
import { join as join12 } from "path";
|
|
1124
1541
|
var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
1542
|
+
static getSettablePaths() {
|
|
1543
|
+
return {
|
|
1544
|
+
relativeDirPath: ".",
|
|
1545
|
+
relativeFilePath: ".augmentignore"
|
|
1546
|
+
};
|
|
1547
|
+
}
|
|
1125
1548
|
/**
|
|
1126
1549
|
* Convert to RulesyncIgnore format
|
|
1127
1550
|
*/
|
|
@@ -1138,8 +1561,8 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
1138
1561
|
}) {
|
|
1139
1562
|
return new _AugmentcodeIgnore({
|
|
1140
1563
|
baseDir,
|
|
1141
|
-
relativeDirPath:
|
|
1142
|
-
relativeFilePath:
|
|
1564
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1565
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1143
1566
|
fileContent: rulesyncIgnore.getFileContent()
|
|
1144
1567
|
});
|
|
1145
1568
|
}
|
|
@@ -1151,11 +1574,17 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
1151
1574
|
baseDir = ".",
|
|
1152
1575
|
validate = true
|
|
1153
1576
|
}) {
|
|
1154
|
-
const fileContent = await readFileContent(
|
|
1577
|
+
const fileContent = await readFileContent(
|
|
1578
|
+
join12(
|
|
1579
|
+
baseDir,
|
|
1580
|
+
this.getSettablePaths().relativeDirPath,
|
|
1581
|
+
this.getSettablePaths().relativeFilePath
|
|
1582
|
+
)
|
|
1583
|
+
);
|
|
1155
1584
|
return new _AugmentcodeIgnore({
|
|
1156
1585
|
baseDir,
|
|
1157
|
-
relativeDirPath:
|
|
1158
|
-
relativeFilePath:
|
|
1586
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1587
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1159
1588
|
fileContent,
|
|
1160
1589
|
validate
|
|
1161
1590
|
});
|
|
@@ -1163,8 +1592,14 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
1163
1592
|
};
|
|
1164
1593
|
|
|
1165
1594
|
// src/ignore/cline-ignore.ts
|
|
1166
|
-
import { join as
|
|
1595
|
+
import { join as join13 } from "path";
|
|
1167
1596
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
1597
|
+
static getSettablePaths() {
|
|
1598
|
+
return {
|
|
1599
|
+
relativeDirPath: ".",
|
|
1600
|
+
relativeFilePath: ".clineignore"
|
|
1601
|
+
};
|
|
1602
|
+
}
|
|
1168
1603
|
/**
|
|
1169
1604
|
* Convert ClineIgnore to RulesyncIgnore format
|
|
1170
1605
|
*/
|
|
@@ -1181,8 +1616,8 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
1181
1616
|
const body = rulesyncIgnore.getFileContent();
|
|
1182
1617
|
return new _ClineIgnore({
|
|
1183
1618
|
baseDir,
|
|
1184
|
-
relativeDirPath:
|
|
1185
|
-
relativeFilePath:
|
|
1619
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1620
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1186
1621
|
fileContent: body
|
|
1187
1622
|
});
|
|
1188
1623
|
}
|
|
@@ -1193,11 +1628,17 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
1193
1628
|
baseDir = ".",
|
|
1194
1629
|
validate = true
|
|
1195
1630
|
}) {
|
|
1196
|
-
const fileContent = await readFileContent(
|
|
1631
|
+
const fileContent = await readFileContent(
|
|
1632
|
+
join13(
|
|
1633
|
+
baseDir,
|
|
1634
|
+
this.getSettablePaths().relativeDirPath,
|
|
1635
|
+
this.getSettablePaths().relativeFilePath
|
|
1636
|
+
)
|
|
1637
|
+
);
|
|
1197
1638
|
return new _ClineIgnore({
|
|
1198
1639
|
baseDir,
|
|
1199
|
-
relativeDirPath:
|
|
1200
|
-
relativeFilePath:
|
|
1640
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1641
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1201
1642
|
fileContent,
|
|
1202
1643
|
validate
|
|
1203
1644
|
});
|
|
@@ -1205,8 +1646,14 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
1205
1646
|
};
|
|
1206
1647
|
|
|
1207
1648
|
// src/ignore/codexcli-ignore.ts
|
|
1208
|
-
import { join as
|
|
1649
|
+
import { join as join14 } from "path";
|
|
1209
1650
|
var CodexcliIgnore = class _CodexcliIgnore extends ToolIgnore {
|
|
1651
|
+
static getSettablePaths() {
|
|
1652
|
+
return {
|
|
1653
|
+
relativeDirPath: ".",
|
|
1654
|
+
relativeFilePath: ".codexignore"
|
|
1655
|
+
};
|
|
1656
|
+
}
|
|
1210
1657
|
toRulesyncIgnore() {
|
|
1211
1658
|
return this.toRulesyncIgnoreDefault();
|
|
1212
1659
|
}
|
|
@@ -1217,8 +1664,8 @@ var CodexcliIgnore = class _CodexcliIgnore extends ToolIgnore {
|
|
|
1217
1664
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
1218
1665
|
return new _CodexcliIgnore({
|
|
1219
1666
|
baseDir,
|
|
1220
|
-
relativeDirPath:
|
|
1221
|
-
relativeFilePath:
|
|
1667
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1668
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1222
1669
|
fileContent,
|
|
1223
1670
|
validate: true
|
|
1224
1671
|
// Skip validation to allow empty patterns
|
|
@@ -1228,11 +1675,17 @@ var CodexcliIgnore = class _CodexcliIgnore extends ToolIgnore {
|
|
|
1228
1675
|
baseDir = ".",
|
|
1229
1676
|
validate = true
|
|
1230
1677
|
}) {
|
|
1231
|
-
const fileContent = await readFileContent(
|
|
1678
|
+
const fileContent = await readFileContent(
|
|
1679
|
+
join14(
|
|
1680
|
+
baseDir,
|
|
1681
|
+
this.getSettablePaths().relativeDirPath,
|
|
1682
|
+
this.getSettablePaths().relativeFilePath
|
|
1683
|
+
)
|
|
1684
|
+
);
|
|
1232
1685
|
return new _CodexcliIgnore({
|
|
1233
1686
|
baseDir,
|
|
1234
|
-
relativeDirPath:
|
|
1235
|
-
relativeFilePath:
|
|
1687
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1688
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1236
1689
|
fileContent,
|
|
1237
1690
|
validate
|
|
1238
1691
|
});
|
|
@@ -1240,8 +1693,14 @@ var CodexcliIgnore = class _CodexcliIgnore extends ToolIgnore {
|
|
|
1240
1693
|
};
|
|
1241
1694
|
|
|
1242
1695
|
// src/ignore/cursor-ignore.ts
|
|
1243
|
-
import { join as
|
|
1696
|
+
import { join as join15 } from "path";
|
|
1244
1697
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
1698
|
+
static getSettablePaths() {
|
|
1699
|
+
return {
|
|
1700
|
+
relativeDirPath: ".",
|
|
1701
|
+
relativeFilePath: ".cursorignore"
|
|
1702
|
+
};
|
|
1703
|
+
}
|
|
1245
1704
|
toRulesyncIgnore() {
|
|
1246
1705
|
return new RulesyncIgnore({
|
|
1247
1706
|
baseDir: ".",
|
|
@@ -1257,8 +1716,8 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
1257
1716
|
const body = rulesyncIgnore.getFileContent();
|
|
1258
1717
|
return new _CursorIgnore({
|
|
1259
1718
|
baseDir,
|
|
1260
|
-
relativeDirPath:
|
|
1261
|
-
relativeFilePath:
|
|
1719
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1720
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1262
1721
|
fileContent: body
|
|
1263
1722
|
});
|
|
1264
1723
|
}
|
|
@@ -1266,11 +1725,17 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
1266
1725
|
baseDir = ".",
|
|
1267
1726
|
validate = true
|
|
1268
1727
|
}) {
|
|
1269
|
-
const fileContent = await readFileContent(
|
|
1728
|
+
const fileContent = await readFileContent(
|
|
1729
|
+
join15(
|
|
1730
|
+
baseDir,
|
|
1731
|
+
this.getSettablePaths().relativeDirPath,
|
|
1732
|
+
this.getSettablePaths().relativeFilePath
|
|
1733
|
+
)
|
|
1734
|
+
);
|
|
1270
1735
|
return new _CursorIgnore({
|
|
1271
1736
|
baseDir,
|
|
1272
|
-
relativeDirPath:
|
|
1273
|
-
relativeFilePath:
|
|
1737
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1738
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1274
1739
|
fileContent,
|
|
1275
1740
|
validate
|
|
1276
1741
|
});
|
|
@@ -1278,8 +1743,14 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
1278
1743
|
};
|
|
1279
1744
|
|
|
1280
1745
|
// src/ignore/geminicli-ignore.ts
|
|
1281
|
-
import { join as
|
|
1746
|
+
import { join as join16 } from "path";
|
|
1282
1747
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
1748
|
+
static getSettablePaths() {
|
|
1749
|
+
return {
|
|
1750
|
+
relativeDirPath: ".",
|
|
1751
|
+
relativeFilePath: ".aiexclude"
|
|
1752
|
+
};
|
|
1753
|
+
}
|
|
1283
1754
|
toRulesyncIgnore() {
|
|
1284
1755
|
return this.toRulesyncIgnoreDefault();
|
|
1285
1756
|
}
|
|
@@ -1289,8 +1760,8 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
1289
1760
|
}) {
|
|
1290
1761
|
return new _GeminiCliIgnore({
|
|
1291
1762
|
baseDir,
|
|
1292
|
-
relativeDirPath:
|
|
1293
|
-
relativeFilePath:
|
|
1763
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1764
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1294
1765
|
fileContent: rulesyncIgnore.getFileContent()
|
|
1295
1766
|
});
|
|
1296
1767
|
}
|
|
@@ -1298,11 +1769,17 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
1298
1769
|
baseDir = ".",
|
|
1299
1770
|
validate = true
|
|
1300
1771
|
}) {
|
|
1301
|
-
const fileContent = await readFileContent(
|
|
1772
|
+
const fileContent = await readFileContent(
|
|
1773
|
+
join16(
|
|
1774
|
+
baseDir,
|
|
1775
|
+
this.getSettablePaths().relativeDirPath,
|
|
1776
|
+
this.getSettablePaths().relativeFilePath
|
|
1777
|
+
)
|
|
1778
|
+
);
|
|
1302
1779
|
return new _GeminiCliIgnore({
|
|
1303
1780
|
baseDir,
|
|
1304
|
-
relativeDirPath:
|
|
1305
|
-
relativeFilePath:
|
|
1781
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1782
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1306
1783
|
fileContent,
|
|
1307
1784
|
validate
|
|
1308
1785
|
});
|
|
@@ -1310,8 +1787,14 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
1310
1787
|
};
|
|
1311
1788
|
|
|
1312
1789
|
// src/ignore/junie-ignore.ts
|
|
1313
|
-
import { join as
|
|
1790
|
+
import { join as join17 } from "path";
|
|
1314
1791
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
1792
|
+
static getSettablePaths() {
|
|
1793
|
+
return {
|
|
1794
|
+
relativeDirPath: ".",
|
|
1795
|
+
relativeFilePath: ".junieignore"
|
|
1796
|
+
};
|
|
1797
|
+
}
|
|
1315
1798
|
toRulesyncIgnore() {
|
|
1316
1799
|
return this.toRulesyncIgnoreDefault();
|
|
1317
1800
|
}
|
|
@@ -1321,8 +1804,8 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
1321
1804
|
}) {
|
|
1322
1805
|
return new _JunieIgnore({
|
|
1323
1806
|
baseDir,
|
|
1324
|
-
relativeDirPath:
|
|
1325
|
-
relativeFilePath:
|
|
1807
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1808
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1326
1809
|
fileContent: rulesyncIgnore.getFileContent()
|
|
1327
1810
|
});
|
|
1328
1811
|
}
|
|
@@ -1330,11 +1813,17 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
1330
1813
|
baseDir = ".",
|
|
1331
1814
|
validate = true
|
|
1332
1815
|
}) {
|
|
1333
|
-
const fileContent = await readFileContent(
|
|
1816
|
+
const fileContent = await readFileContent(
|
|
1817
|
+
join17(
|
|
1818
|
+
baseDir,
|
|
1819
|
+
this.getSettablePaths().relativeDirPath,
|
|
1820
|
+
this.getSettablePaths().relativeFilePath
|
|
1821
|
+
)
|
|
1822
|
+
);
|
|
1334
1823
|
return new _JunieIgnore({
|
|
1335
1824
|
baseDir,
|
|
1336
|
-
relativeDirPath:
|
|
1337
|
-
relativeFilePath:
|
|
1825
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1826
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1338
1827
|
fileContent,
|
|
1339
1828
|
validate
|
|
1340
1829
|
});
|
|
@@ -1342,8 +1831,14 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
1342
1831
|
};
|
|
1343
1832
|
|
|
1344
1833
|
// src/ignore/kiro-ignore.ts
|
|
1345
|
-
import { join as
|
|
1834
|
+
import { join as join18 } from "path";
|
|
1346
1835
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
1836
|
+
static getSettablePaths() {
|
|
1837
|
+
return {
|
|
1838
|
+
relativeDirPath: ".",
|
|
1839
|
+
relativeFilePath: ".aiignore"
|
|
1840
|
+
};
|
|
1841
|
+
}
|
|
1347
1842
|
toRulesyncIgnore() {
|
|
1348
1843
|
return this.toRulesyncIgnoreDefault();
|
|
1349
1844
|
}
|
|
@@ -1353,8 +1848,8 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
1353
1848
|
}) {
|
|
1354
1849
|
return new _KiroIgnore({
|
|
1355
1850
|
baseDir,
|
|
1356
|
-
relativeDirPath:
|
|
1357
|
-
relativeFilePath:
|
|
1851
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1852
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1358
1853
|
fileContent: rulesyncIgnore.getFileContent()
|
|
1359
1854
|
});
|
|
1360
1855
|
}
|
|
@@ -1362,11 +1857,17 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
1362
1857
|
baseDir = ".",
|
|
1363
1858
|
validate = true
|
|
1364
1859
|
}) {
|
|
1365
|
-
const fileContent = await readFileContent(
|
|
1860
|
+
const fileContent = await readFileContent(
|
|
1861
|
+
join18(
|
|
1862
|
+
baseDir,
|
|
1863
|
+
this.getSettablePaths().relativeDirPath,
|
|
1864
|
+
this.getSettablePaths().relativeFilePath
|
|
1865
|
+
)
|
|
1866
|
+
);
|
|
1366
1867
|
return new _KiroIgnore({
|
|
1367
1868
|
baseDir,
|
|
1368
|
-
relativeDirPath:
|
|
1369
|
-
relativeFilePath:
|
|
1869
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1870
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1370
1871
|
fileContent,
|
|
1371
1872
|
validate
|
|
1372
1873
|
});
|
|
@@ -1374,8 +1875,14 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
1374
1875
|
};
|
|
1375
1876
|
|
|
1376
1877
|
// src/ignore/qwencode-ignore.ts
|
|
1377
|
-
import { join as
|
|
1878
|
+
import { join as join19 } from "path";
|
|
1378
1879
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
1880
|
+
static getSettablePaths() {
|
|
1881
|
+
return {
|
|
1882
|
+
relativeDirPath: ".",
|
|
1883
|
+
relativeFilePath: ".geminiignore"
|
|
1884
|
+
};
|
|
1885
|
+
}
|
|
1379
1886
|
toRulesyncIgnore() {
|
|
1380
1887
|
return this.toRulesyncIgnoreDefault();
|
|
1381
1888
|
}
|
|
@@ -1385,8 +1892,8 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
1385
1892
|
}) {
|
|
1386
1893
|
return new _QwencodeIgnore({
|
|
1387
1894
|
baseDir,
|
|
1388
|
-
relativeDirPath:
|
|
1389
|
-
relativeFilePath:
|
|
1895
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1896
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1390
1897
|
fileContent: rulesyncIgnore.getFileContent()
|
|
1391
1898
|
});
|
|
1392
1899
|
}
|
|
@@ -1394,11 +1901,17 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
1394
1901
|
baseDir = ".",
|
|
1395
1902
|
validate = true
|
|
1396
1903
|
}) {
|
|
1397
|
-
const fileContent = await readFileContent(
|
|
1904
|
+
const fileContent = await readFileContent(
|
|
1905
|
+
join19(
|
|
1906
|
+
baseDir,
|
|
1907
|
+
this.getSettablePaths().relativeDirPath,
|
|
1908
|
+
this.getSettablePaths().relativeFilePath
|
|
1909
|
+
)
|
|
1910
|
+
);
|
|
1398
1911
|
return new _QwencodeIgnore({
|
|
1399
1912
|
baseDir,
|
|
1400
|
-
relativeDirPath:
|
|
1401
|
-
relativeFilePath:
|
|
1913
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1914
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1402
1915
|
fileContent,
|
|
1403
1916
|
validate
|
|
1404
1917
|
});
|
|
@@ -1406,8 +1919,14 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
1406
1919
|
};
|
|
1407
1920
|
|
|
1408
1921
|
// src/ignore/roo-ignore.ts
|
|
1409
|
-
import { join as
|
|
1922
|
+
import { join as join20 } from "path";
|
|
1410
1923
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
1924
|
+
static getSettablePaths() {
|
|
1925
|
+
return {
|
|
1926
|
+
relativeDirPath: ".",
|
|
1927
|
+
relativeFilePath: ".rooignore"
|
|
1928
|
+
};
|
|
1929
|
+
}
|
|
1411
1930
|
toRulesyncIgnore() {
|
|
1412
1931
|
return this.toRulesyncIgnoreDefault();
|
|
1413
1932
|
}
|
|
@@ -1417,8 +1936,8 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
1417
1936
|
}) {
|
|
1418
1937
|
return new _RooIgnore({
|
|
1419
1938
|
baseDir,
|
|
1420
|
-
relativeDirPath:
|
|
1421
|
-
relativeFilePath:
|
|
1939
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1940
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1422
1941
|
fileContent: rulesyncIgnore.getFileContent()
|
|
1423
1942
|
});
|
|
1424
1943
|
}
|
|
@@ -1426,11 +1945,17 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
1426
1945
|
baseDir = ".",
|
|
1427
1946
|
validate = true
|
|
1428
1947
|
}) {
|
|
1429
|
-
const fileContent = await readFileContent(
|
|
1948
|
+
const fileContent = await readFileContent(
|
|
1949
|
+
join20(
|
|
1950
|
+
baseDir,
|
|
1951
|
+
this.getSettablePaths().relativeDirPath,
|
|
1952
|
+
this.getSettablePaths().relativeFilePath
|
|
1953
|
+
)
|
|
1954
|
+
);
|
|
1430
1955
|
return new _RooIgnore({
|
|
1431
1956
|
baseDir,
|
|
1432
|
-
relativeDirPath:
|
|
1433
|
-
relativeFilePath:
|
|
1957
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1958
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1434
1959
|
fileContent,
|
|
1435
1960
|
validate
|
|
1436
1961
|
});
|
|
@@ -1438,8 +1963,14 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
1438
1963
|
};
|
|
1439
1964
|
|
|
1440
1965
|
// src/ignore/windsurf-ignore.ts
|
|
1441
|
-
import { join as
|
|
1966
|
+
import { join as join21 } from "path";
|
|
1442
1967
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
1968
|
+
static getSettablePaths() {
|
|
1969
|
+
return {
|
|
1970
|
+
relativeDirPath: ".",
|
|
1971
|
+
relativeFilePath: ".codeiumignore"
|
|
1972
|
+
};
|
|
1973
|
+
}
|
|
1443
1974
|
toRulesyncIgnore() {
|
|
1444
1975
|
return this.toRulesyncIgnoreDefault();
|
|
1445
1976
|
}
|
|
@@ -1449,8 +1980,8 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
1449
1980
|
}) {
|
|
1450
1981
|
return new _WindsurfIgnore({
|
|
1451
1982
|
baseDir,
|
|
1452
|
-
relativeDirPath:
|
|
1453
|
-
relativeFilePath:
|
|
1983
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1984
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1454
1985
|
fileContent: rulesyncIgnore.getFileContent()
|
|
1455
1986
|
});
|
|
1456
1987
|
}
|
|
@@ -1458,11 +1989,17 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
1458
1989
|
baseDir = ".",
|
|
1459
1990
|
validate = true
|
|
1460
1991
|
}) {
|
|
1461
|
-
const fileContent = await readFileContent(
|
|
1992
|
+
const fileContent = await readFileContent(
|
|
1993
|
+
join21(
|
|
1994
|
+
baseDir,
|
|
1995
|
+
this.getSettablePaths().relativeDirPath,
|
|
1996
|
+
this.getSettablePaths().relativeFilePath
|
|
1997
|
+
)
|
|
1998
|
+
);
|
|
1462
1999
|
return new _WindsurfIgnore({
|
|
1463
2000
|
baseDir,
|
|
1464
|
-
relativeDirPath:
|
|
1465
|
-
relativeFilePath:
|
|
2001
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2002
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1466
2003
|
fileContent,
|
|
1467
2004
|
validate
|
|
1468
2005
|
});
|
|
@@ -1471,6 +2008,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
1471
2008
|
|
|
1472
2009
|
// src/ignore/ignore-processor.ts
|
|
1473
2010
|
var ignoreProcessorToolTargets = [
|
|
2011
|
+
"amazonqcli",
|
|
1474
2012
|
"augmentcode",
|
|
1475
2013
|
"cline",
|
|
1476
2014
|
"codexcli",
|
|
@@ -1482,7 +2020,7 @@ var ignoreProcessorToolTargets = [
|
|
|
1482
2020
|
"roo",
|
|
1483
2021
|
"windsurf"
|
|
1484
2022
|
];
|
|
1485
|
-
var IgnoreProcessorToolTargetSchema =
|
|
2023
|
+
var IgnoreProcessorToolTargetSchema = z10.enum(ignoreProcessorToolTargets);
|
|
1486
2024
|
var IgnoreProcessor = class extends FeatureProcessor {
|
|
1487
2025
|
toolTarget;
|
|
1488
2026
|
constructor({
|
|
@@ -1523,6 +2061,8 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
1523
2061
|
}
|
|
1524
2062
|
async loadToolIgnores() {
|
|
1525
2063
|
switch (this.toolTarget) {
|
|
2064
|
+
case "amazonqcli":
|
|
2065
|
+
return [await AmazonqcliIgnore.fromFile({ baseDir: this.baseDir })];
|
|
1526
2066
|
case "augmentcode":
|
|
1527
2067
|
return [await AugmentcodeIgnore.fromFile({ baseDir: this.baseDir })];
|
|
1528
2068
|
case "cline":
|
|
@@ -1560,6 +2100,11 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
1560
2100
|
}
|
|
1561
2101
|
const toolIgnores = [rulesyncIgnore].map((rulesyncIgnore2) => {
|
|
1562
2102
|
switch (this.toolTarget) {
|
|
2103
|
+
case "amazonqcli":
|
|
2104
|
+
return AmazonqcliIgnore.fromRulesyncIgnore({
|
|
2105
|
+
baseDir: this.baseDir,
|
|
2106
|
+
rulesyncIgnore: rulesyncIgnore2
|
|
2107
|
+
});
|
|
1563
2108
|
case "augmentcode":
|
|
1564
2109
|
return AugmentcodeIgnore.fromRulesyncIgnore({
|
|
1565
2110
|
baseDir: this.baseDir,
|
|
@@ -1637,44 +2182,44 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
1637
2182
|
};
|
|
1638
2183
|
|
|
1639
2184
|
// src/mcp/mcp-processor.ts
|
|
1640
|
-
import { z as
|
|
2185
|
+
import { z as z12 } from "zod/mini";
|
|
1641
2186
|
|
|
1642
2187
|
// src/mcp/amazonqcli-mcp.ts
|
|
1643
|
-
import { join as
|
|
2188
|
+
import { join as join23 } from "path";
|
|
1644
2189
|
|
|
1645
2190
|
// src/mcp/rulesync-mcp.ts
|
|
1646
|
-
import { join as
|
|
2191
|
+
import { join as join22 } from "path";
|
|
1647
2192
|
|
|
1648
2193
|
// src/types/mcp.ts
|
|
1649
|
-
import { z as
|
|
1650
|
-
var McpTransportTypeSchema =
|
|
1651
|
-
var McpServerBaseSchema =
|
|
1652
|
-
type:
|
|
1653
|
-
command:
|
|
1654
|
-
args:
|
|
1655
|
-
url:
|
|
1656
|
-
httpUrl:
|
|
1657
|
-
env:
|
|
1658
|
-
disabled:
|
|
1659
|
-
networkTimeout:
|
|
1660
|
-
timeout:
|
|
1661
|
-
trust:
|
|
1662
|
-
cwd:
|
|
1663
|
-
transport:
|
|
1664
|
-
alwaysAllow:
|
|
1665
|
-
tools:
|
|
1666
|
-
kiroAutoApprove:
|
|
1667
|
-
kiroAutoBlock:
|
|
1668
|
-
headers:
|
|
2194
|
+
import { z as z11 } from "zod/mini";
|
|
2195
|
+
var McpTransportTypeSchema = z11.enum(["stdio", "sse", "http"]);
|
|
2196
|
+
var McpServerBaseSchema = z11.object({
|
|
2197
|
+
type: z11.optional(z11.enum(["stdio", "sse", "http"])),
|
|
2198
|
+
command: z11.optional(z11.union([z11.string(), z11.array(z11.string())])),
|
|
2199
|
+
args: z11.optional(z11.array(z11.string())),
|
|
2200
|
+
url: z11.optional(z11.string()),
|
|
2201
|
+
httpUrl: z11.optional(z11.string()),
|
|
2202
|
+
env: z11.optional(z11.record(z11.string(), z11.string())),
|
|
2203
|
+
disabled: z11.optional(z11.boolean()),
|
|
2204
|
+
networkTimeout: z11.optional(z11.number()),
|
|
2205
|
+
timeout: z11.optional(z11.number()),
|
|
2206
|
+
trust: z11.optional(z11.boolean()),
|
|
2207
|
+
cwd: z11.optional(z11.string()),
|
|
2208
|
+
transport: z11.optional(McpTransportTypeSchema),
|
|
2209
|
+
alwaysAllow: z11.optional(z11.array(z11.string())),
|
|
2210
|
+
tools: z11.optional(z11.array(z11.string())),
|
|
2211
|
+
kiroAutoApprove: z11.optional(z11.array(z11.string())),
|
|
2212
|
+
kiroAutoBlock: z11.optional(z11.array(z11.string())),
|
|
2213
|
+
headers: z11.optional(z11.record(z11.string(), z11.string()))
|
|
1669
2214
|
});
|
|
1670
|
-
var RulesyncMcpServerSchema =
|
|
1671
|
-
targets:
|
|
2215
|
+
var RulesyncMcpServerSchema = z11.extend(McpServerBaseSchema, {
|
|
2216
|
+
targets: z11.optional(RulesyncTargetsSchema)
|
|
1672
2217
|
});
|
|
1673
|
-
var McpConfigSchema =
|
|
1674
|
-
mcpServers:
|
|
2218
|
+
var McpConfigSchema = z11.object({
|
|
2219
|
+
mcpServers: z11.record(z11.string(), McpServerBaseSchema)
|
|
1675
2220
|
});
|
|
1676
|
-
var RulesyncMcpConfigSchema =
|
|
1677
|
-
mcpServers:
|
|
2221
|
+
var RulesyncMcpConfigSchema = z11.object({
|
|
2222
|
+
mcpServers: z11.record(z11.string(), RulesyncMcpServerSchema)
|
|
1678
2223
|
});
|
|
1679
2224
|
|
|
1680
2225
|
// src/mcp/rulesync-mcp.ts
|
|
@@ -1690,15 +2235,23 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
1690
2235
|
}
|
|
1691
2236
|
}
|
|
1692
2237
|
}
|
|
2238
|
+
static getSettablePaths() {
|
|
2239
|
+
return {
|
|
2240
|
+
relativeDirPath: ".rulesync",
|
|
2241
|
+
relativeFilePath: ".mcp.json"
|
|
2242
|
+
};
|
|
2243
|
+
}
|
|
1693
2244
|
validate() {
|
|
1694
2245
|
return { success: true, error: null };
|
|
1695
2246
|
}
|
|
1696
2247
|
static async fromFile({ validate = true }) {
|
|
1697
|
-
const fileContent = await readFileContent(
|
|
2248
|
+
const fileContent = await readFileContent(
|
|
2249
|
+
join22(this.getSettablePaths().relativeDirPath, this.getSettablePaths().relativeFilePath)
|
|
2250
|
+
);
|
|
1698
2251
|
return new _RulesyncMcp({
|
|
1699
2252
|
baseDir: ".",
|
|
1700
|
-
relativeDirPath:
|
|
1701
|
-
relativeFilePath:
|
|
2253
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2254
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1702
2255
|
fileContent,
|
|
1703
2256
|
validate
|
|
1704
2257
|
});
|
|
@@ -1728,6 +2281,9 @@ var ToolMcp = class extends ToolFile {
|
|
|
1728
2281
|
getJson() {
|
|
1729
2282
|
return this.json;
|
|
1730
2283
|
}
|
|
2284
|
+
static getSettablePaths() {
|
|
2285
|
+
throw new Error("Please implement this method in the subclass.");
|
|
2286
|
+
}
|
|
1731
2287
|
toRulesyncMcpDefault() {
|
|
1732
2288
|
return new RulesyncMcp({
|
|
1733
2289
|
baseDir: this.baseDir,
|
|
@@ -1746,15 +2302,27 @@ var ToolMcp = class extends ToolFile {
|
|
|
1746
2302
|
|
|
1747
2303
|
// src/mcp/amazonqcli-mcp.ts
|
|
1748
2304
|
var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
2305
|
+
static getSettablePaths() {
|
|
2306
|
+
return {
|
|
2307
|
+
relativeDirPath: ".amazonq",
|
|
2308
|
+
relativeFilePath: "mcp.json"
|
|
2309
|
+
};
|
|
2310
|
+
}
|
|
1749
2311
|
static async fromFile({
|
|
1750
2312
|
baseDir = ".",
|
|
1751
2313
|
validate = true
|
|
1752
2314
|
}) {
|
|
1753
|
-
const fileContent = await readFileContent(
|
|
2315
|
+
const fileContent = await readFileContent(
|
|
2316
|
+
join23(
|
|
2317
|
+
baseDir,
|
|
2318
|
+
this.getSettablePaths().relativeDirPath,
|
|
2319
|
+
this.getSettablePaths().relativeFilePath
|
|
2320
|
+
)
|
|
2321
|
+
);
|
|
1754
2322
|
return new _AmazonqcliMcp({
|
|
1755
2323
|
baseDir,
|
|
1756
|
-
relativeDirPath:
|
|
1757
|
-
relativeFilePath:
|
|
2324
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2325
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1758
2326
|
fileContent,
|
|
1759
2327
|
validate
|
|
1760
2328
|
});
|
|
@@ -1766,8 +2334,8 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
1766
2334
|
}) {
|
|
1767
2335
|
return new _AmazonqcliMcp({
|
|
1768
2336
|
baseDir,
|
|
1769
|
-
relativeDirPath:
|
|
1770
|
-
relativeFilePath:
|
|
2337
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2338
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1771
2339
|
fileContent: rulesyncMcp.getFileContent(),
|
|
1772
2340
|
validate
|
|
1773
2341
|
});
|
|
@@ -1781,17 +2349,29 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
1781
2349
|
};
|
|
1782
2350
|
|
|
1783
2351
|
// src/mcp/claudecode-mcp.ts
|
|
1784
|
-
import { join as
|
|
2352
|
+
import { join as join24 } from "path";
|
|
1785
2353
|
var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
2354
|
+
static getSettablePaths() {
|
|
2355
|
+
return {
|
|
2356
|
+
relativeDirPath: ".",
|
|
2357
|
+
relativeFilePath: ".mcp.json"
|
|
2358
|
+
};
|
|
2359
|
+
}
|
|
1786
2360
|
static async fromFile({
|
|
1787
2361
|
baseDir = ".",
|
|
1788
2362
|
validate = true
|
|
1789
2363
|
}) {
|
|
1790
|
-
const fileContent = await readFileContent(
|
|
2364
|
+
const fileContent = await readFileContent(
|
|
2365
|
+
join24(
|
|
2366
|
+
baseDir,
|
|
2367
|
+
this.getSettablePaths().relativeDirPath,
|
|
2368
|
+
this.getSettablePaths().relativeFilePath
|
|
2369
|
+
)
|
|
2370
|
+
);
|
|
1791
2371
|
return new _ClaudecodeMcp({
|
|
1792
|
-
baseDir
|
|
1793
|
-
relativeDirPath:
|
|
1794
|
-
relativeFilePath:
|
|
2372
|
+
baseDir,
|
|
2373
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2374
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1795
2375
|
fileContent,
|
|
1796
2376
|
validate
|
|
1797
2377
|
});
|
|
@@ -1803,8 +2383,8 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
1803
2383
|
}) {
|
|
1804
2384
|
return new _ClaudecodeMcp({
|
|
1805
2385
|
baseDir,
|
|
1806
|
-
relativeDirPath:
|
|
1807
|
-
relativeFilePath:
|
|
2386
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2387
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1808
2388
|
fileContent: rulesyncMcp.getFileContent(),
|
|
1809
2389
|
validate
|
|
1810
2390
|
});
|
|
@@ -1818,17 +2398,29 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
1818
2398
|
};
|
|
1819
2399
|
|
|
1820
2400
|
// src/mcp/cline-mcp.ts
|
|
1821
|
-
import { join as
|
|
2401
|
+
import { join as join25 } from "path";
|
|
1822
2402
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
2403
|
+
static getSettablePaths() {
|
|
2404
|
+
return {
|
|
2405
|
+
relativeDirPath: ".cline",
|
|
2406
|
+
relativeFilePath: "mcp.json"
|
|
2407
|
+
};
|
|
2408
|
+
}
|
|
1823
2409
|
static async fromFile({
|
|
1824
2410
|
baseDir = ".",
|
|
1825
2411
|
validate = true
|
|
1826
2412
|
}) {
|
|
1827
|
-
const fileContent = await readFileContent(
|
|
2413
|
+
const fileContent = await readFileContent(
|
|
2414
|
+
join25(
|
|
2415
|
+
baseDir,
|
|
2416
|
+
this.getSettablePaths().relativeDirPath,
|
|
2417
|
+
this.getSettablePaths().relativeFilePath
|
|
2418
|
+
)
|
|
2419
|
+
);
|
|
1828
2420
|
return new _ClineMcp({
|
|
1829
|
-
baseDir
|
|
1830
|
-
relativeDirPath:
|
|
1831
|
-
relativeFilePath:
|
|
2421
|
+
baseDir,
|
|
2422
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2423
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1832
2424
|
fileContent,
|
|
1833
2425
|
validate
|
|
1834
2426
|
});
|
|
@@ -1840,8 +2432,8 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
1840
2432
|
}) {
|
|
1841
2433
|
return new _ClineMcp({
|
|
1842
2434
|
baseDir,
|
|
1843
|
-
relativeDirPath:
|
|
1844
|
-
relativeFilePath:
|
|
2435
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2436
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1845
2437
|
fileContent: rulesyncMcp.getFileContent(),
|
|
1846
2438
|
validate
|
|
1847
2439
|
});
|
|
@@ -1855,17 +2447,29 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
1855
2447
|
};
|
|
1856
2448
|
|
|
1857
2449
|
// src/mcp/copilot-mcp.ts
|
|
1858
|
-
import { join as
|
|
2450
|
+
import { join as join26 } from "path";
|
|
1859
2451
|
var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
1860
|
-
static
|
|
2452
|
+
static getSettablePaths() {
|
|
2453
|
+
return {
|
|
2454
|
+
relativeDirPath: ".vscode",
|
|
2455
|
+
relativeFilePath: "mcp.json"
|
|
2456
|
+
};
|
|
2457
|
+
}
|
|
2458
|
+
static async fromFile({
|
|
1861
2459
|
baseDir = ".",
|
|
1862
2460
|
validate = true
|
|
1863
2461
|
}) {
|
|
1864
|
-
const fileContent = await readFileContent(
|
|
2462
|
+
const fileContent = await readFileContent(
|
|
2463
|
+
join26(
|
|
2464
|
+
baseDir,
|
|
2465
|
+
this.getSettablePaths().relativeDirPath,
|
|
2466
|
+
this.getSettablePaths().relativeFilePath
|
|
2467
|
+
)
|
|
2468
|
+
);
|
|
1865
2469
|
return new _CopilotMcp({
|
|
1866
|
-
baseDir
|
|
1867
|
-
relativeDirPath:
|
|
1868
|
-
relativeFilePath:
|
|
2470
|
+
baseDir,
|
|
2471
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2472
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1869
2473
|
fileContent,
|
|
1870
2474
|
validate
|
|
1871
2475
|
});
|
|
@@ -1877,8 +2481,8 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
1877
2481
|
}) {
|
|
1878
2482
|
return new _CopilotMcp({
|
|
1879
2483
|
baseDir,
|
|
1880
|
-
relativeDirPath:
|
|
1881
|
-
relativeFilePath:
|
|
2484
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2485
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1882
2486
|
fileContent: rulesyncMcp.getFileContent(),
|
|
1883
2487
|
validate
|
|
1884
2488
|
});
|
|
@@ -1892,17 +2496,29 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
1892
2496
|
};
|
|
1893
2497
|
|
|
1894
2498
|
// src/mcp/cursor-mcp.ts
|
|
1895
|
-
import { join as
|
|
2499
|
+
import { join as join27 } from "path";
|
|
1896
2500
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
2501
|
+
static getSettablePaths() {
|
|
2502
|
+
return {
|
|
2503
|
+
relativeDirPath: ".cursor",
|
|
2504
|
+
relativeFilePath: "mcp.json"
|
|
2505
|
+
};
|
|
2506
|
+
}
|
|
1897
2507
|
static async fromFile({
|
|
1898
2508
|
baseDir = ".",
|
|
1899
2509
|
validate = true
|
|
1900
2510
|
}) {
|
|
1901
|
-
const fileContent = await readFileContent(
|
|
2511
|
+
const fileContent = await readFileContent(
|
|
2512
|
+
join27(
|
|
2513
|
+
baseDir,
|
|
2514
|
+
this.getSettablePaths().relativeDirPath,
|
|
2515
|
+
this.getSettablePaths().relativeFilePath
|
|
2516
|
+
)
|
|
2517
|
+
);
|
|
1902
2518
|
return new _CursorMcp({
|
|
1903
|
-
baseDir
|
|
1904
|
-
relativeDirPath:
|
|
1905
|
-
relativeFilePath:
|
|
2519
|
+
baseDir,
|
|
2520
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2521
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1906
2522
|
fileContent,
|
|
1907
2523
|
validate
|
|
1908
2524
|
});
|
|
@@ -1919,8 +2535,8 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
1919
2535
|
const fileContent = JSON.stringify(cursorConfig, null, 2);
|
|
1920
2536
|
return new _CursorMcp({
|
|
1921
2537
|
baseDir,
|
|
1922
|
-
relativeDirPath:
|
|
1923
|
-
relativeFilePath:
|
|
2538
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2539
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1924
2540
|
fileContent,
|
|
1925
2541
|
validate
|
|
1926
2542
|
});
|
|
@@ -1940,17 +2556,29 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
1940
2556
|
};
|
|
1941
2557
|
|
|
1942
2558
|
// src/mcp/roo-mcp.ts
|
|
1943
|
-
import { join as
|
|
2559
|
+
import { join as join28 } from "path";
|
|
1944
2560
|
var RooMcp = class _RooMcp extends ToolMcp {
|
|
2561
|
+
static getSettablePaths() {
|
|
2562
|
+
return {
|
|
2563
|
+
relativeDirPath: ".roo",
|
|
2564
|
+
relativeFilePath: "mcp.json"
|
|
2565
|
+
};
|
|
2566
|
+
}
|
|
1945
2567
|
static async fromFile({
|
|
1946
2568
|
baseDir = ".",
|
|
1947
2569
|
validate = true
|
|
1948
2570
|
}) {
|
|
1949
|
-
const fileContent = await readFileContent(
|
|
2571
|
+
const fileContent = await readFileContent(
|
|
2572
|
+
join28(
|
|
2573
|
+
baseDir,
|
|
2574
|
+
this.getSettablePaths().relativeDirPath,
|
|
2575
|
+
this.getSettablePaths().relativeFilePath
|
|
2576
|
+
)
|
|
2577
|
+
);
|
|
1950
2578
|
return new _RooMcp({
|
|
1951
|
-
baseDir
|
|
1952
|
-
relativeDirPath:
|
|
1953
|
-
relativeFilePath:
|
|
2579
|
+
baseDir,
|
|
2580
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2581
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1954
2582
|
fileContent,
|
|
1955
2583
|
validate
|
|
1956
2584
|
});
|
|
@@ -1963,8 +2591,8 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
1963
2591
|
const fileContent = rulesyncMcp.getFileContent();
|
|
1964
2592
|
return new _RooMcp({
|
|
1965
2593
|
baseDir,
|
|
1966
|
-
relativeDirPath:
|
|
1967
|
-
relativeFilePath:
|
|
2594
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2595
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1968
2596
|
fileContent,
|
|
1969
2597
|
validate
|
|
1970
2598
|
});
|
|
@@ -1986,7 +2614,7 @@ var mcpProcessorToolTargets = [
|
|
|
1986
2614
|
"cursor",
|
|
1987
2615
|
"roo"
|
|
1988
2616
|
];
|
|
1989
|
-
var McpProcessorToolTargetSchema =
|
|
2617
|
+
var McpProcessorToolTargetSchema = z12.enum(mcpProcessorToolTargets);
|
|
1990
2618
|
var McpProcessor = class extends FeatureProcessor {
|
|
1991
2619
|
toolTarget;
|
|
1992
2620
|
constructor({
|
|
@@ -2145,26 +2773,187 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
2145
2773
|
};
|
|
2146
2774
|
|
|
2147
2775
|
// src/rules/rules-processor.ts
|
|
2148
|
-
import { basename as
|
|
2776
|
+
import { basename as basename14, join as join49 } from "path";
|
|
2149
2777
|
import { XMLBuilder } from "fast-xml-parser";
|
|
2150
|
-
import { z as
|
|
2778
|
+
import { z as z18 } from "zod/mini";
|
|
2779
|
+
|
|
2780
|
+
// src/constants/paths.ts
|
|
2781
|
+
import { join as join29 } from "path";
|
|
2782
|
+
var RULESYNC_DIR = ".rulesync";
|
|
2783
|
+
var RULESYNC_RULES_DIR = join29(".rulesync", "rules");
|
|
2784
|
+
var RULESYNC_RULES_DIR_LEGACY = ".rulesync";
|
|
2785
|
+
var RULESYNC_MCP_FILE = join29(".rulesync", ".mcp.json");
|
|
2786
|
+
var RULESYNC_SUBAGENTS_DIR = join29(".rulesync", "subagents");
|
|
2787
|
+
|
|
2788
|
+
// src/subagents/simulated-subagent.ts
|
|
2789
|
+
import { basename as basename11, join as join30 } from "path";
|
|
2790
|
+
import { z as z13 } from "zod/mini";
|
|
2791
|
+
|
|
2792
|
+
// src/subagents/tool-subagent.ts
|
|
2793
|
+
var ToolSubagent = class extends ToolFile {
|
|
2794
|
+
static getSettablePaths() {
|
|
2795
|
+
throw new Error("Please implement this method in the subclass.");
|
|
2796
|
+
}
|
|
2797
|
+
static async fromFile(_params) {
|
|
2798
|
+
throw new Error("Please implement this method in the subclass.");
|
|
2799
|
+
}
|
|
2800
|
+
static fromRulesyncSubagent(_params) {
|
|
2801
|
+
throw new Error("Please implement this method in the subclass.");
|
|
2802
|
+
}
|
|
2803
|
+
};
|
|
2804
|
+
|
|
2805
|
+
// src/subagents/simulated-subagent.ts
|
|
2806
|
+
var SimulatedSubagentFrontmatterSchema = z13.object({
|
|
2807
|
+
name: z13.string(),
|
|
2808
|
+
description: z13.string()
|
|
2809
|
+
});
|
|
2810
|
+
var SimulatedSubagent = class extends ToolSubagent {
|
|
2811
|
+
frontmatter;
|
|
2812
|
+
body;
|
|
2813
|
+
constructor({ frontmatter, body, ...rest }) {
|
|
2814
|
+
if (rest.validate) {
|
|
2815
|
+
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
2816
|
+
if (!result.success) {
|
|
2817
|
+
throw result.error;
|
|
2818
|
+
}
|
|
2819
|
+
}
|
|
2820
|
+
super({
|
|
2821
|
+
...rest,
|
|
2822
|
+
fileContent: stringifyFrontmatter(body, frontmatter)
|
|
2823
|
+
});
|
|
2824
|
+
this.frontmatter = frontmatter;
|
|
2825
|
+
this.body = body;
|
|
2826
|
+
}
|
|
2827
|
+
getBody() {
|
|
2828
|
+
return this.body;
|
|
2829
|
+
}
|
|
2830
|
+
getFrontmatter() {
|
|
2831
|
+
return this.frontmatter;
|
|
2832
|
+
}
|
|
2833
|
+
toRulesyncSubagent() {
|
|
2834
|
+
throw new Error("Not implemented because it is a SIMULATED file.");
|
|
2835
|
+
}
|
|
2836
|
+
static fromRulesyncSubagentDefault({
|
|
2837
|
+
baseDir = ".",
|
|
2838
|
+
rulesyncSubagent,
|
|
2839
|
+
validate = true
|
|
2840
|
+
}) {
|
|
2841
|
+
const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
|
|
2842
|
+
const simulatedFrontmatter = {
|
|
2843
|
+
name: rulesyncFrontmatter.name,
|
|
2844
|
+
description: rulesyncFrontmatter.description
|
|
2845
|
+
};
|
|
2846
|
+
const body = rulesyncSubagent.getBody();
|
|
2847
|
+
return {
|
|
2848
|
+
baseDir,
|
|
2849
|
+
frontmatter: simulatedFrontmatter,
|
|
2850
|
+
body,
|
|
2851
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2852
|
+
relativeFilePath: rulesyncSubagent.getRelativeFilePath(),
|
|
2853
|
+
validate
|
|
2854
|
+
};
|
|
2855
|
+
}
|
|
2856
|
+
validate() {
|
|
2857
|
+
if (!this.frontmatter) {
|
|
2858
|
+
return { success: true, error: null };
|
|
2859
|
+
}
|
|
2860
|
+
const result = SimulatedSubagentFrontmatterSchema.safeParse(this.frontmatter);
|
|
2861
|
+
if (result.success) {
|
|
2862
|
+
return { success: true, error: null };
|
|
2863
|
+
} else {
|
|
2864
|
+
return { success: false, error: result.error };
|
|
2865
|
+
}
|
|
2866
|
+
}
|
|
2867
|
+
static async fromFileDefault({
|
|
2868
|
+
baseDir = ".",
|
|
2869
|
+
relativeFilePath,
|
|
2870
|
+
validate = true
|
|
2871
|
+
}) {
|
|
2872
|
+
const filePath = join30(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
2873
|
+
const fileContent = await readFileContent(filePath);
|
|
2874
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2875
|
+
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
2876
|
+
if (!result.success) {
|
|
2877
|
+
throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
|
|
2878
|
+
}
|
|
2879
|
+
return {
|
|
2880
|
+
baseDir,
|
|
2881
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2882
|
+
relativeFilePath: basename11(relativeFilePath),
|
|
2883
|
+
frontmatter: result.data,
|
|
2884
|
+
body: content.trim(),
|
|
2885
|
+
validate
|
|
2886
|
+
};
|
|
2887
|
+
}
|
|
2888
|
+
};
|
|
2889
|
+
|
|
2890
|
+
// src/subagents/codexcli-subagent.ts
|
|
2891
|
+
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
2892
|
+
static getSettablePaths() {
|
|
2893
|
+
return {
|
|
2894
|
+
relativeDirPath: ".codex/subagents"
|
|
2895
|
+
};
|
|
2896
|
+
}
|
|
2897
|
+
static async fromFile(params) {
|
|
2898
|
+
const baseParams = await this.fromFileDefault(params);
|
|
2899
|
+
return new _CodexCliSubagent(baseParams);
|
|
2900
|
+
}
|
|
2901
|
+
static fromRulesyncSubagent(params) {
|
|
2902
|
+
const baseParams = this.fromRulesyncSubagentDefault(params);
|
|
2903
|
+
return new _CodexCliSubagent(baseParams);
|
|
2904
|
+
}
|
|
2905
|
+
};
|
|
2906
|
+
|
|
2907
|
+
// src/subagents/copilot-subagent.ts
|
|
2908
|
+
var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
|
|
2909
|
+
static getSettablePaths() {
|
|
2910
|
+
return {
|
|
2911
|
+
relativeDirPath: ".copilot/subagents"
|
|
2912
|
+
};
|
|
2913
|
+
}
|
|
2914
|
+
static async fromFile(params) {
|
|
2915
|
+
const baseParams = await this.fromFileDefault(params);
|
|
2916
|
+
return new _CopilotSubagent(baseParams);
|
|
2917
|
+
}
|
|
2918
|
+
static fromRulesyncSubagent(params) {
|
|
2919
|
+
const baseParams = this.fromRulesyncSubagentDefault(params);
|
|
2920
|
+
return new _CopilotSubagent(baseParams);
|
|
2921
|
+
}
|
|
2922
|
+
};
|
|
2923
|
+
|
|
2924
|
+
// src/subagents/cursor-subagent.ts
|
|
2925
|
+
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
2926
|
+
static getSettablePaths() {
|
|
2927
|
+
return {
|
|
2928
|
+
relativeDirPath: ".cursor/subagents"
|
|
2929
|
+
};
|
|
2930
|
+
}
|
|
2931
|
+
static async fromFile(params) {
|
|
2932
|
+
const baseParams = await this.fromFileDefault(params);
|
|
2933
|
+
return new _CursorSubagent(baseParams);
|
|
2934
|
+
}
|
|
2935
|
+
static fromRulesyncSubagent(params) {
|
|
2936
|
+
const baseParams = this.fromRulesyncSubagentDefault(params);
|
|
2937
|
+
return new _CursorSubagent(baseParams);
|
|
2938
|
+
}
|
|
2939
|
+
};
|
|
2151
2940
|
|
|
2152
2941
|
// src/rules/agentsmd-rule.ts
|
|
2153
|
-
import { join as
|
|
2942
|
+
import { join as join32 } from "path";
|
|
2154
2943
|
|
|
2155
2944
|
// src/rules/rulesync-rule.ts
|
|
2156
|
-
import { basename as
|
|
2157
|
-
import { z as
|
|
2158
|
-
var RulesyncRuleFrontmatterSchema =
|
|
2159
|
-
root:
|
|
2160
|
-
targets:
|
|
2161
|
-
description:
|
|
2162
|
-
globs:
|
|
2163
|
-
cursor:
|
|
2164
|
-
|
|
2165
|
-
alwaysApply:
|
|
2166
|
-
description:
|
|
2167
|
-
globs:
|
|
2945
|
+
import { basename as basename12, join as join31 } from "path";
|
|
2946
|
+
import { z as z14 } from "zod/mini";
|
|
2947
|
+
var RulesyncRuleFrontmatterSchema = z14.object({
|
|
2948
|
+
root: z14.optional(z14.optional(z14.boolean())),
|
|
2949
|
+
targets: z14.optional(RulesyncTargetsSchema),
|
|
2950
|
+
description: z14.optional(z14.string()),
|
|
2951
|
+
globs: z14.optional(z14.array(z14.string())),
|
|
2952
|
+
cursor: z14.optional(
|
|
2953
|
+
z14.object({
|
|
2954
|
+
alwaysApply: z14.optional(z14.boolean()),
|
|
2955
|
+
description: z14.optional(z14.string()),
|
|
2956
|
+
globs: z14.optional(z14.array(z14.string()))
|
|
2168
2957
|
})
|
|
2169
2958
|
)
|
|
2170
2959
|
});
|
|
@@ -2185,6 +2974,16 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
2185
2974
|
this.frontmatter = frontmatter;
|
|
2186
2975
|
this.body = body;
|
|
2187
2976
|
}
|
|
2977
|
+
static getSettablePaths() {
|
|
2978
|
+
return {
|
|
2979
|
+
recommended: {
|
|
2980
|
+
relativeDirPath: ".rulesync/rules"
|
|
2981
|
+
},
|
|
2982
|
+
legacy: {
|
|
2983
|
+
relativeDirPath: ".rulesync"
|
|
2984
|
+
}
|
|
2985
|
+
};
|
|
2986
|
+
}
|
|
2188
2987
|
getFrontmatter() {
|
|
2189
2988
|
return this.frontmatter;
|
|
2190
2989
|
}
|
|
@@ -2203,7 +3002,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
2203
3002
|
relativeFilePath,
|
|
2204
3003
|
validate = true
|
|
2205
3004
|
}) {
|
|
2206
|
-
const filePath =
|
|
3005
|
+
const filePath = join31(this.getSettablePaths().legacy.relativeDirPath, relativeFilePath);
|
|
2207
3006
|
const fileContent = await readFileContent(filePath);
|
|
2208
3007
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2209
3008
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2217,10 +3016,10 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
2217
3016
|
globs: result.data.globs ?? [],
|
|
2218
3017
|
cursor: result.data.cursor
|
|
2219
3018
|
};
|
|
2220
|
-
const filename =
|
|
3019
|
+
const filename = basename12(filePath);
|
|
2221
3020
|
return new _RulesyncRule({
|
|
2222
3021
|
baseDir: ".",
|
|
2223
|
-
relativeDirPath:
|
|
3022
|
+
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
2224
3023
|
relativeFilePath: filename,
|
|
2225
3024
|
frontmatter: validatedFrontmatter,
|
|
2226
3025
|
body: content.trim(),
|
|
@@ -2231,7 +3030,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
2231
3030
|
relativeFilePath,
|
|
2232
3031
|
validate = true
|
|
2233
3032
|
}) {
|
|
2234
|
-
const filePath =
|
|
3033
|
+
const filePath = join31(this.getSettablePaths().recommended.relativeDirPath, relativeFilePath);
|
|
2235
3034
|
const fileContent = await readFileContent(filePath);
|
|
2236
3035
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2237
3036
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2245,10 +3044,10 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
2245
3044
|
globs: result.data.globs ?? [],
|
|
2246
3045
|
cursor: result.data.cursor
|
|
2247
3046
|
};
|
|
2248
|
-
const filename =
|
|
3047
|
+
const filename = basename12(filePath);
|
|
2249
3048
|
return new _RulesyncRule({
|
|
2250
3049
|
baseDir: ".",
|
|
2251
|
-
relativeDirPath:
|
|
3050
|
+
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
2252
3051
|
relativeFilePath: filename,
|
|
2253
3052
|
frontmatter: validatedFrontmatter,
|
|
2254
3053
|
body: content.trim(),
|
|
@@ -2318,17 +3117,28 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
2318
3117
|
root: root ?? false
|
|
2319
3118
|
});
|
|
2320
3119
|
}
|
|
3120
|
+
static getSettablePaths() {
|
|
3121
|
+
return {
|
|
3122
|
+
root: {
|
|
3123
|
+
relativeDirPath: ".",
|
|
3124
|
+
relativeFilePath: "AGENTS.md"
|
|
3125
|
+
},
|
|
3126
|
+
nonRoot: {
|
|
3127
|
+
relativeDirPath: ".agents/memories"
|
|
3128
|
+
}
|
|
3129
|
+
};
|
|
3130
|
+
}
|
|
2321
3131
|
static async fromFile({
|
|
2322
3132
|
baseDir = ".",
|
|
2323
3133
|
relativeFilePath,
|
|
2324
3134
|
validate = true
|
|
2325
3135
|
}) {
|
|
2326
3136
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
2327
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
2328
|
-
const fileContent = await readFileContent(
|
|
3137
|
+
const relativePath = isRoot ? "AGENTS.md" : join32(".agents/memories", relativeFilePath);
|
|
3138
|
+
const fileContent = await readFileContent(join32(baseDir, relativePath));
|
|
2329
3139
|
return new _AgentsMdRule({
|
|
2330
3140
|
baseDir,
|
|
2331
|
-
relativeDirPath: isRoot ?
|
|
3141
|
+
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
2332
3142
|
relativeFilePath: isRoot ? "AGENTS.md" : relativeFilePath,
|
|
2333
3143
|
fileContent,
|
|
2334
3144
|
validate,
|
|
@@ -2344,7 +3154,9 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
2344
3154
|
this.buildToolRuleParamsDefault({
|
|
2345
3155
|
baseDir,
|
|
2346
3156
|
rulesyncRule,
|
|
2347
|
-
validate
|
|
3157
|
+
validate,
|
|
3158
|
+
rootPath: this.getSettablePaths().root,
|
|
3159
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
2348
3160
|
})
|
|
2349
3161
|
);
|
|
2350
3162
|
}
|
|
@@ -2357,17 +3169,26 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
2357
3169
|
};
|
|
2358
3170
|
|
|
2359
3171
|
// src/rules/amazonqcli-rule.ts
|
|
2360
|
-
import { join as
|
|
3172
|
+
import { join as join33 } from "path";
|
|
2361
3173
|
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
3174
|
+
static getSettablePaths() {
|
|
3175
|
+
return {
|
|
3176
|
+
nonRoot: {
|
|
3177
|
+
relativeDirPath: ".amazonq/rules"
|
|
3178
|
+
}
|
|
3179
|
+
};
|
|
3180
|
+
}
|
|
2362
3181
|
static async fromFile({
|
|
2363
3182
|
baseDir = ".",
|
|
2364
3183
|
relativeFilePath,
|
|
2365
3184
|
validate = true
|
|
2366
3185
|
}) {
|
|
2367
|
-
const fileContent = await readFileContent(
|
|
3186
|
+
const fileContent = await readFileContent(
|
|
3187
|
+
join33(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
3188
|
+
);
|
|
2368
3189
|
return new _AmazonQCliRule({
|
|
2369
3190
|
baseDir,
|
|
2370
|
-
relativeDirPath:
|
|
3191
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
2371
3192
|
relativeFilePath,
|
|
2372
3193
|
fileContent,
|
|
2373
3194
|
validate,
|
|
@@ -2384,7 +3205,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
2384
3205
|
baseDir,
|
|
2385
3206
|
rulesyncRule,
|
|
2386
3207
|
validate,
|
|
2387
|
-
nonRootPath:
|
|
3208
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
2388
3209
|
})
|
|
2389
3210
|
);
|
|
2390
3211
|
}
|
|
@@ -2397,7 +3218,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
2397
3218
|
};
|
|
2398
3219
|
|
|
2399
3220
|
// src/rules/augmentcode-legacy-rule.ts
|
|
2400
|
-
import { join as
|
|
3221
|
+
import { join as join34 } from "path";
|
|
2401
3222
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
2402
3223
|
toRulesyncRule() {
|
|
2403
3224
|
const rulesyncFrontmatter = {
|
|
@@ -2415,6 +3236,17 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
2415
3236
|
validate: true
|
|
2416
3237
|
});
|
|
2417
3238
|
}
|
|
3239
|
+
static getSettablePaths() {
|
|
3240
|
+
return {
|
|
3241
|
+
root: {
|
|
3242
|
+
relativeDirPath: ".",
|
|
3243
|
+
relativeFilePath: ".augment-guidelines"
|
|
3244
|
+
},
|
|
3245
|
+
nonRoot: {
|
|
3246
|
+
relativeDirPath: ".augment/rules"
|
|
3247
|
+
}
|
|
3248
|
+
};
|
|
3249
|
+
}
|
|
2418
3250
|
static fromRulesyncRule({
|
|
2419
3251
|
baseDir = ".",
|
|
2420
3252
|
rulesyncRule,
|
|
@@ -2425,8 +3257,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
2425
3257
|
baseDir,
|
|
2426
3258
|
rulesyncRule,
|
|
2427
3259
|
validate,
|
|
2428
|
-
rootPath:
|
|
2429
|
-
nonRootPath:
|
|
3260
|
+
rootPath: this.getSettablePaths().root,
|
|
3261
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
2430
3262
|
})
|
|
2431
3263
|
);
|
|
2432
3264
|
}
|
|
@@ -2438,13 +3270,14 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
2438
3270
|
relativeFilePath,
|
|
2439
3271
|
validate = true
|
|
2440
3272
|
}) {
|
|
2441
|
-
const
|
|
2442
|
-
const
|
|
2443
|
-
const
|
|
3273
|
+
const settablePaths = this.getSettablePaths();
|
|
3274
|
+
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
3275
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join34(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
3276
|
+
const fileContent = await readFileContent(join34(baseDir, relativePath));
|
|
2444
3277
|
return new _AugmentcodeLegacyRule({
|
|
2445
3278
|
baseDir,
|
|
2446
|
-
relativeDirPath: isRoot ?
|
|
2447
|
-
relativeFilePath: isRoot ?
|
|
3279
|
+
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
3280
|
+
relativeFilePath: isRoot ? settablePaths.root.relativeFilePath : relativeFilePath,
|
|
2448
3281
|
fileContent,
|
|
2449
3282
|
validate,
|
|
2450
3283
|
root: isRoot
|
|
@@ -2453,11 +3286,18 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
2453
3286
|
};
|
|
2454
3287
|
|
|
2455
3288
|
// src/rules/augmentcode-rule.ts
|
|
2456
|
-
import { join as
|
|
3289
|
+
import { join as join35 } from "path";
|
|
2457
3290
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
2458
3291
|
toRulesyncRule() {
|
|
2459
3292
|
return this.toRulesyncRuleDefault();
|
|
2460
3293
|
}
|
|
3294
|
+
static getSettablePaths() {
|
|
3295
|
+
return {
|
|
3296
|
+
nonRoot: {
|
|
3297
|
+
relativeDirPath: ".augment/rules"
|
|
3298
|
+
}
|
|
3299
|
+
};
|
|
3300
|
+
}
|
|
2461
3301
|
static fromRulesyncRule({
|
|
2462
3302
|
baseDir = ".",
|
|
2463
3303
|
rulesyncRule,
|
|
@@ -2468,7 +3308,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
2468
3308
|
baseDir,
|
|
2469
3309
|
rulesyncRule,
|
|
2470
3310
|
validate,
|
|
2471
|
-
nonRootPath:
|
|
3311
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
2472
3312
|
})
|
|
2473
3313
|
);
|
|
2474
3314
|
}
|
|
@@ -2477,11 +3317,13 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
2477
3317
|
relativeFilePath,
|
|
2478
3318
|
validate = true
|
|
2479
3319
|
}) {
|
|
2480
|
-
const fileContent = await readFileContent(
|
|
3320
|
+
const fileContent = await readFileContent(
|
|
3321
|
+
join35(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
3322
|
+
);
|
|
2481
3323
|
const { body: content } = parseFrontmatter(fileContent);
|
|
2482
3324
|
return new _AugmentcodeRule({
|
|
2483
3325
|
baseDir,
|
|
2484
|
-
relativeDirPath:
|
|
3326
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
2485
3327
|
relativeFilePath,
|
|
2486
3328
|
fileContent: content.trim(),
|
|
2487
3329
|
validate
|
|
@@ -2493,20 +3335,31 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
2493
3335
|
};
|
|
2494
3336
|
|
|
2495
3337
|
// src/rules/claudecode-rule.ts
|
|
2496
|
-
import { join as
|
|
3338
|
+
import { join as join36 } from "path";
|
|
2497
3339
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
3340
|
+
static getSettablePaths() {
|
|
3341
|
+
return {
|
|
3342
|
+
root: {
|
|
3343
|
+
relativeDirPath: ".",
|
|
3344
|
+
relativeFilePath: "CLAUDE.md"
|
|
3345
|
+
},
|
|
3346
|
+
nonRoot: {
|
|
3347
|
+
relativeDirPath: ".claude/memories"
|
|
3348
|
+
}
|
|
3349
|
+
};
|
|
3350
|
+
}
|
|
2498
3351
|
static async fromFile({
|
|
2499
3352
|
baseDir = ".",
|
|
2500
3353
|
relativeFilePath,
|
|
2501
3354
|
validate = true
|
|
2502
3355
|
}) {
|
|
2503
|
-
const isRoot = relativeFilePath ===
|
|
2504
|
-
const relativePath = isRoot ?
|
|
2505
|
-
const fileContent = await readFileContent(
|
|
3356
|
+
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
3357
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join36(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
3358
|
+
const fileContent = await readFileContent(join36(baseDir, relativePath));
|
|
2506
3359
|
return new _ClaudecodeRule({
|
|
2507
3360
|
baseDir,
|
|
2508
|
-
relativeDirPath: isRoot ?
|
|
2509
|
-
relativeFilePath: isRoot ?
|
|
3361
|
+
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
3362
|
+
relativeFilePath: isRoot ? this.getSettablePaths().root.relativeFilePath : relativeFilePath,
|
|
2510
3363
|
fileContent,
|
|
2511
3364
|
validate,
|
|
2512
3365
|
root: isRoot
|
|
@@ -2522,8 +3375,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
2522
3375
|
baseDir,
|
|
2523
3376
|
rulesyncRule,
|
|
2524
3377
|
validate,
|
|
2525
|
-
rootPath:
|
|
2526
|
-
nonRootPath:
|
|
3378
|
+
rootPath: this.getSettablePaths().root,
|
|
3379
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
2527
3380
|
})
|
|
2528
3381
|
);
|
|
2529
3382
|
}
|
|
@@ -2536,12 +3389,19 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
2536
3389
|
};
|
|
2537
3390
|
|
|
2538
3391
|
// src/rules/cline-rule.ts
|
|
2539
|
-
import { join as
|
|
2540
|
-
import { z as
|
|
2541
|
-
var ClineRuleFrontmatterSchema =
|
|
2542
|
-
description:
|
|
3392
|
+
import { join as join37 } from "path";
|
|
3393
|
+
import { z as z15 } from "zod/mini";
|
|
3394
|
+
var ClineRuleFrontmatterSchema = z15.object({
|
|
3395
|
+
description: z15.string()
|
|
2543
3396
|
});
|
|
2544
3397
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
3398
|
+
static getSettablePaths() {
|
|
3399
|
+
return {
|
|
3400
|
+
nonRoot: {
|
|
3401
|
+
relativeDirPath: ".clinerules"
|
|
3402
|
+
}
|
|
3403
|
+
};
|
|
3404
|
+
}
|
|
2545
3405
|
toRulesyncRule() {
|
|
2546
3406
|
return this.toRulesyncRuleDefault();
|
|
2547
3407
|
}
|
|
@@ -2555,7 +3415,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
2555
3415
|
baseDir,
|
|
2556
3416
|
rulesyncRule,
|
|
2557
3417
|
validate,
|
|
2558
|
-
nonRootPath:
|
|
3418
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
2559
3419
|
})
|
|
2560
3420
|
);
|
|
2561
3421
|
}
|
|
@@ -2567,10 +3427,12 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
2567
3427
|
relativeFilePath,
|
|
2568
3428
|
validate = true
|
|
2569
3429
|
}) {
|
|
2570
|
-
const fileContent = await readFileContent(
|
|
3430
|
+
const fileContent = await readFileContent(
|
|
3431
|
+
join37(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
3432
|
+
);
|
|
2571
3433
|
return new _ClineRule({
|
|
2572
3434
|
baseDir,
|
|
2573
|
-
relativeDirPath:
|
|
3435
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
2574
3436
|
relativeFilePath,
|
|
2575
3437
|
fileContent,
|
|
2576
3438
|
validate
|
|
@@ -2579,19 +3441,30 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
2579
3441
|
};
|
|
2580
3442
|
|
|
2581
3443
|
// src/rules/codexcli-rule.ts
|
|
2582
|
-
import { join as
|
|
3444
|
+
import { join as join38 } from "path";
|
|
2583
3445
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
3446
|
+
static getSettablePaths() {
|
|
3447
|
+
return {
|
|
3448
|
+
root: {
|
|
3449
|
+
relativeDirPath: ".",
|
|
3450
|
+
relativeFilePath: "AGENTS.md"
|
|
3451
|
+
},
|
|
3452
|
+
nonRoot: {
|
|
3453
|
+
relativeDirPath: ".codex/memories"
|
|
3454
|
+
}
|
|
3455
|
+
};
|
|
3456
|
+
}
|
|
2584
3457
|
static async fromFile({
|
|
2585
3458
|
baseDir = ".",
|
|
2586
3459
|
relativeFilePath,
|
|
2587
3460
|
validate = true
|
|
2588
3461
|
}) {
|
|
2589
3462
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
2590
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
2591
|
-
const fileContent = await readFileContent(
|
|
3463
|
+
const relativePath = isRoot ? "AGENTS.md" : join38(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
3464
|
+
const fileContent = await readFileContent(join38(baseDir, relativePath));
|
|
2592
3465
|
return new _CodexcliRule({
|
|
2593
3466
|
baseDir,
|
|
2594
|
-
relativeDirPath: isRoot ?
|
|
3467
|
+
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
2595
3468
|
relativeFilePath: isRoot ? "AGENTS.md" : relativeFilePath,
|
|
2596
3469
|
fileContent,
|
|
2597
3470
|
validate,
|
|
@@ -2608,8 +3481,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
2608
3481
|
baseDir,
|
|
2609
3482
|
rulesyncRule,
|
|
2610
3483
|
validate,
|
|
2611
|
-
rootPath:
|
|
2612
|
-
nonRootPath:
|
|
3484
|
+
rootPath: this.getSettablePaths().root,
|
|
3485
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
2613
3486
|
})
|
|
2614
3487
|
);
|
|
2615
3488
|
}
|
|
@@ -2622,15 +3495,26 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
2622
3495
|
};
|
|
2623
3496
|
|
|
2624
3497
|
// src/rules/copilot-rule.ts
|
|
2625
|
-
import { join as
|
|
2626
|
-
import { z as
|
|
2627
|
-
var CopilotRuleFrontmatterSchema =
|
|
2628
|
-
description:
|
|
2629
|
-
applyTo:
|
|
3498
|
+
import { join as join39 } from "path";
|
|
3499
|
+
import { z as z16 } from "zod/mini";
|
|
3500
|
+
var CopilotRuleFrontmatterSchema = z16.object({
|
|
3501
|
+
description: z16.optional(z16.string()),
|
|
3502
|
+
applyTo: z16.optional(z16.string())
|
|
2630
3503
|
});
|
|
2631
3504
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
2632
3505
|
frontmatter;
|
|
2633
3506
|
body;
|
|
3507
|
+
static getSettablePaths() {
|
|
3508
|
+
return {
|
|
3509
|
+
root: {
|
|
3510
|
+
relativeDirPath: ".github",
|
|
3511
|
+
relativeFilePath: "copilot-instructions.md"
|
|
3512
|
+
},
|
|
3513
|
+
nonRoot: {
|
|
3514
|
+
relativeDirPath: ".github/instructions"
|
|
3515
|
+
}
|
|
3516
|
+
};
|
|
3517
|
+
}
|
|
2634
3518
|
constructor({ frontmatter, body, ...rest }) {
|
|
2635
3519
|
if (rest.validate) {
|
|
2636
3520
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2670,7 +3554,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
2670
3554
|
const root = rulesyncFrontmatter.root;
|
|
2671
3555
|
const copilotFrontmatter = {
|
|
2672
3556
|
description: rulesyncFrontmatter.description,
|
|
2673
|
-
applyTo: rulesyncFrontmatter.globs?.join(",")
|
|
3557
|
+
applyTo: rulesyncFrontmatter.globs?.length ? rulesyncFrontmatter.globs.join(",") : void 0
|
|
2674
3558
|
};
|
|
2675
3559
|
const body = rulesyncRule.getBody();
|
|
2676
3560
|
if (root) {
|
|
@@ -2678,8 +3562,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
2678
3562
|
baseDir,
|
|
2679
3563
|
frontmatter: copilotFrontmatter,
|
|
2680
3564
|
body,
|
|
2681
|
-
relativeDirPath:
|
|
2682
|
-
relativeFilePath:
|
|
3565
|
+
relativeDirPath: this.getSettablePaths().root.relativeDirPath,
|
|
3566
|
+
relativeFilePath: this.getSettablePaths().root.relativeFilePath,
|
|
2683
3567
|
validate,
|
|
2684
3568
|
root
|
|
2685
3569
|
});
|
|
@@ -2691,7 +3575,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
2691
3575
|
baseDir,
|
|
2692
3576
|
frontmatter: copilotFrontmatter,
|
|
2693
3577
|
body,
|
|
2694
|
-
relativeDirPath:
|
|
3578
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
2695
3579
|
relativeFilePath: newFileName,
|
|
2696
3580
|
validate,
|
|
2697
3581
|
root
|
|
@@ -2703,13 +3587,16 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
2703
3587
|
validate = true
|
|
2704
3588
|
}) {
|
|
2705
3589
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
2706
|
-
const relativePath = isRoot ?
|
|
2707
|
-
|
|
3590
|
+
const relativePath = isRoot ? join39(
|
|
3591
|
+
this.getSettablePaths().root.relativeDirPath,
|
|
3592
|
+
this.getSettablePaths().root.relativeFilePath
|
|
3593
|
+
) : join39(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
3594
|
+
const fileContent = await readFileContent(join39(baseDir, relativePath));
|
|
2708
3595
|
if (isRoot) {
|
|
2709
3596
|
return new _CopilotRule({
|
|
2710
3597
|
baseDir,
|
|
2711
|
-
relativeDirPath:
|
|
2712
|
-
relativeFilePath: isRoot ?
|
|
3598
|
+
relativeDirPath: this.getSettablePaths().root.relativeDirPath,
|
|
3599
|
+
relativeFilePath: isRoot ? this.getSettablePaths().root.relativeFilePath : relativeFilePath,
|
|
2713
3600
|
frontmatter: {
|
|
2714
3601
|
description: "",
|
|
2715
3602
|
applyTo: "**"
|
|
@@ -2723,13 +3610,13 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
2723
3610
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
2724
3611
|
if (!result.success) {
|
|
2725
3612
|
throw new Error(
|
|
2726
|
-
`Invalid frontmatter in ${
|
|
3613
|
+
`Invalid frontmatter in ${join39(baseDir, relativeFilePath)}: ${result.error.message}`
|
|
2727
3614
|
);
|
|
2728
3615
|
}
|
|
2729
3616
|
return new _CopilotRule({
|
|
2730
3617
|
baseDir,
|
|
2731
|
-
relativeDirPath:
|
|
2732
|
-
relativeFilePath: relativeFilePath.replace(/\.md$/, ".instructions.md"),
|
|
3618
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
3619
|
+
relativeFilePath: relativeFilePath.endsWith(".instructions.md") ? relativeFilePath : relativeFilePath.replace(/\.md$/, ".instructions.md"),
|
|
2733
3620
|
frontmatter: result.data,
|
|
2734
3621
|
body: content.trim(),
|
|
2735
3622
|
validate,
|
|
@@ -2756,16 +3643,23 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
2756
3643
|
};
|
|
2757
3644
|
|
|
2758
3645
|
// src/rules/cursor-rule.ts
|
|
2759
|
-
import { basename as
|
|
2760
|
-
import { z as
|
|
2761
|
-
var CursorRuleFrontmatterSchema =
|
|
2762
|
-
description:
|
|
2763
|
-
globs:
|
|
2764
|
-
alwaysApply:
|
|
3646
|
+
import { basename as basename13, join as join40 } from "path";
|
|
3647
|
+
import { z as z17 } from "zod/mini";
|
|
3648
|
+
var CursorRuleFrontmatterSchema = z17.object({
|
|
3649
|
+
description: z17.optional(z17.string()),
|
|
3650
|
+
globs: z17.optional(z17.string()),
|
|
3651
|
+
alwaysApply: z17.optional(z17.boolean())
|
|
2765
3652
|
});
|
|
2766
3653
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
2767
3654
|
frontmatter;
|
|
2768
3655
|
body;
|
|
3656
|
+
static getSettablePaths() {
|
|
3657
|
+
return {
|
|
3658
|
+
nonRoot: {
|
|
3659
|
+
relativeDirPath: ".cursor/rules"
|
|
3660
|
+
}
|
|
3661
|
+
};
|
|
3662
|
+
}
|
|
2769
3663
|
constructor({ frontmatter, body, ...rest }) {
|
|
2770
3664
|
if (rest.validate) {
|
|
2771
3665
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2868,7 +3762,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
2868
3762
|
baseDir,
|
|
2869
3763
|
frontmatter: cursorFrontmatter,
|
|
2870
3764
|
body,
|
|
2871
|
-
relativeDirPath:
|
|
3765
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
2872
3766
|
relativeFilePath: newFileName,
|
|
2873
3767
|
validate
|
|
2874
3768
|
});
|
|
@@ -2878,18 +3772,20 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
2878
3772
|
relativeFilePath,
|
|
2879
3773
|
validate = true
|
|
2880
3774
|
}) {
|
|
2881
|
-
const fileContent = await readFileContent(
|
|
3775
|
+
const fileContent = await readFileContent(
|
|
3776
|
+
join40(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
3777
|
+
);
|
|
2882
3778
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
2883
3779
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
2884
3780
|
if (!result.success) {
|
|
2885
3781
|
throw new Error(
|
|
2886
|
-
`Invalid frontmatter in ${
|
|
3782
|
+
`Invalid frontmatter in ${join40(baseDir, relativeFilePath)}: ${result.error.message}`
|
|
2887
3783
|
);
|
|
2888
3784
|
}
|
|
2889
3785
|
return new _CursorRule({
|
|
2890
3786
|
baseDir,
|
|
2891
|
-
relativeDirPath:
|
|
2892
|
-
relativeFilePath:
|
|
3787
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
3788
|
+
relativeFilePath: basename13(relativeFilePath),
|
|
2893
3789
|
frontmatter: result.data,
|
|
2894
3790
|
body: content.trim(),
|
|
2895
3791
|
validate
|
|
@@ -2915,19 +3811,30 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
2915
3811
|
};
|
|
2916
3812
|
|
|
2917
3813
|
// src/rules/geminicli-rule.ts
|
|
2918
|
-
import { join as
|
|
3814
|
+
import { join as join41 } from "path";
|
|
2919
3815
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
3816
|
+
static getSettablePaths() {
|
|
3817
|
+
return {
|
|
3818
|
+
root: {
|
|
3819
|
+
relativeDirPath: ".",
|
|
3820
|
+
relativeFilePath: "GEMINI.md"
|
|
3821
|
+
},
|
|
3822
|
+
nonRoot: {
|
|
3823
|
+
relativeDirPath: ".gemini/memories"
|
|
3824
|
+
}
|
|
3825
|
+
};
|
|
3826
|
+
}
|
|
2920
3827
|
static async fromFile({
|
|
2921
3828
|
baseDir = ".",
|
|
2922
3829
|
relativeFilePath,
|
|
2923
3830
|
validate = true
|
|
2924
3831
|
}) {
|
|
2925
3832
|
const isRoot = relativeFilePath === "GEMINI.md";
|
|
2926
|
-
const relativePath = isRoot ? "GEMINI.md" :
|
|
2927
|
-
const fileContent = await readFileContent(
|
|
3833
|
+
const relativePath = isRoot ? "GEMINI.md" : join41(".gemini/memories", relativeFilePath);
|
|
3834
|
+
const fileContent = await readFileContent(join41(baseDir, relativePath));
|
|
2928
3835
|
return new _GeminiCliRule({
|
|
2929
3836
|
baseDir,
|
|
2930
|
-
relativeDirPath: isRoot ?
|
|
3837
|
+
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
2931
3838
|
relativeFilePath: isRoot ? "GEMINI.md" : relativeFilePath,
|
|
2932
3839
|
fileContent,
|
|
2933
3840
|
validate,
|
|
@@ -2944,8 +3851,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
2944
3851
|
baseDir,
|
|
2945
3852
|
rulesyncRule,
|
|
2946
3853
|
validate,
|
|
2947
|
-
rootPath:
|
|
2948
|
-
nonRootPath:
|
|
3854
|
+
rootPath: this.getSettablePaths().root,
|
|
3855
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
2949
3856
|
})
|
|
2950
3857
|
);
|
|
2951
3858
|
}
|
|
@@ -2958,22 +3865,34 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
2958
3865
|
};
|
|
2959
3866
|
|
|
2960
3867
|
// src/rules/junie-rule.ts
|
|
2961
|
-
import { join as
|
|
3868
|
+
import { join as join42 } from "path";
|
|
2962
3869
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
3870
|
+
static getSettablePaths() {
|
|
3871
|
+
return {
|
|
3872
|
+
root: {
|
|
3873
|
+
relativeDirPath: ".junie",
|
|
3874
|
+
relativeFilePath: "guidelines.md"
|
|
3875
|
+
},
|
|
3876
|
+
nonRoot: {
|
|
3877
|
+
relativeDirPath: ".junie/memories"
|
|
3878
|
+
}
|
|
3879
|
+
};
|
|
3880
|
+
}
|
|
2963
3881
|
static async fromFile({
|
|
2964
3882
|
baseDir = ".",
|
|
2965
3883
|
relativeFilePath,
|
|
2966
3884
|
validate = true
|
|
2967
3885
|
}) {
|
|
2968
3886
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
2969
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
2970
|
-
const fileContent = await readFileContent(
|
|
3887
|
+
const relativePath = isRoot ? "guidelines.md" : join42(".junie/memories", relativeFilePath);
|
|
3888
|
+
const fileContent = await readFileContent(join42(baseDir, relativePath));
|
|
2971
3889
|
return new _JunieRule({
|
|
2972
3890
|
baseDir,
|
|
2973
|
-
relativeDirPath: isRoot ?
|
|
3891
|
+
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
2974
3892
|
relativeFilePath: isRoot ? "guidelines.md" : relativeFilePath,
|
|
2975
3893
|
fileContent,
|
|
2976
|
-
validate
|
|
3894
|
+
validate,
|
|
3895
|
+
root: isRoot
|
|
2977
3896
|
});
|
|
2978
3897
|
}
|
|
2979
3898
|
static fromRulesyncRule({
|
|
@@ -2986,8 +3905,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
2986
3905
|
baseDir,
|
|
2987
3906
|
rulesyncRule,
|
|
2988
3907
|
validate,
|
|
2989
|
-
rootPath:
|
|
2990
|
-
nonRootPath:
|
|
3908
|
+
rootPath: this.getSettablePaths().root,
|
|
3909
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
2991
3910
|
})
|
|
2992
3911
|
);
|
|
2993
3912
|
}
|
|
@@ -3000,17 +3919,26 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
3000
3919
|
};
|
|
3001
3920
|
|
|
3002
3921
|
// src/rules/kiro-rule.ts
|
|
3003
|
-
import { join as
|
|
3922
|
+
import { join as join43 } from "path";
|
|
3004
3923
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
3924
|
+
static getSettablePaths() {
|
|
3925
|
+
return {
|
|
3926
|
+
nonRoot: {
|
|
3927
|
+
relativeDirPath: ".kiro/steering"
|
|
3928
|
+
}
|
|
3929
|
+
};
|
|
3930
|
+
}
|
|
3005
3931
|
static async fromFile({
|
|
3006
3932
|
baseDir = ".",
|
|
3007
3933
|
relativeFilePath,
|
|
3008
3934
|
validate = true
|
|
3009
3935
|
}) {
|
|
3010
|
-
const fileContent = await readFileContent(
|
|
3936
|
+
const fileContent = await readFileContent(
|
|
3937
|
+
join43(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
3938
|
+
);
|
|
3011
3939
|
return new _KiroRule({
|
|
3012
3940
|
baseDir,
|
|
3013
|
-
relativeDirPath:
|
|
3941
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
3014
3942
|
relativeFilePath,
|
|
3015
3943
|
fileContent,
|
|
3016
3944
|
validate,
|
|
@@ -3027,7 +3955,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
3027
3955
|
baseDir,
|
|
3028
3956
|
rulesyncRule,
|
|
3029
3957
|
validate,
|
|
3030
|
-
nonRootPath:
|
|
3958
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
3031
3959
|
})
|
|
3032
3960
|
);
|
|
3033
3961
|
}
|
|
@@ -3040,19 +3968,30 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
3040
3968
|
};
|
|
3041
3969
|
|
|
3042
3970
|
// src/rules/opencode-rule.ts
|
|
3043
|
-
import { join as
|
|
3971
|
+
import { join as join44 } from "path";
|
|
3044
3972
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
3973
|
+
static getSettablePaths() {
|
|
3974
|
+
return {
|
|
3975
|
+
root: {
|
|
3976
|
+
relativeDirPath: ".",
|
|
3977
|
+
relativeFilePath: "AGENTS.md"
|
|
3978
|
+
},
|
|
3979
|
+
nonRoot: {
|
|
3980
|
+
relativeDirPath: ".opencode/memories"
|
|
3981
|
+
}
|
|
3982
|
+
};
|
|
3983
|
+
}
|
|
3045
3984
|
static async fromFile({
|
|
3046
3985
|
baseDir = ".",
|
|
3047
3986
|
relativeFilePath,
|
|
3048
3987
|
validate = true
|
|
3049
3988
|
}) {
|
|
3050
3989
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
3051
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
3052
|
-
const fileContent = await readFileContent(
|
|
3990
|
+
const relativePath = isRoot ? "AGENTS.md" : join44(".opencode/memories", relativeFilePath);
|
|
3991
|
+
const fileContent = await readFileContent(join44(baseDir, relativePath));
|
|
3053
3992
|
return new _OpenCodeRule({
|
|
3054
3993
|
baseDir,
|
|
3055
|
-
relativeDirPath: isRoot ?
|
|
3994
|
+
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
3056
3995
|
relativeFilePath: isRoot ? "AGENTS.md" : relativeFilePath,
|
|
3057
3996
|
validate,
|
|
3058
3997
|
root: isRoot,
|
|
@@ -3068,7 +4007,9 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
3068
4007
|
this.buildToolRuleParamsDefault({
|
|
3069
4008
|
baseDir,
|
|
3070
4009
|
rulesyncRule,
|
|
3071
|
-
validate
|
|
4010
|
+
validate,
|
|
4011
|
+
rootPath: this.getSettablePaths().root,
|
|
4012
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
3072
4013
|
})
|
|
3073
4014
|
);
|
|
3074
4015
|
}
|
|
@@ -3081,19 +4022,30 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
3081
4022
|
};
|
|
3082
4023
|
|
|
3083
4024
|
// src/rules/qwencode-rule.ts
|
|
3084
|
-
import { join as
|
|
4025
|
+
import { join as join45 } from "path";
|
|
3085
4026
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
4027
|
+
static getSettablePaths() {
|
|
4028
|
+
return {
|
|
4029
|
+
root: {
|
|
4030
|
+
relativeDirPath: ".",
|
|
4031
|
+
relativeFilePath: "QWEN.md"
|
|
4032
|
+
},
|
|
4033
|
+
nonRoot: {
|
|
4034
|
+
relativeDirPath: ".qwen/memories"
|
|
4035
|
+
}
|
|
4036
|
+
};
|
|
4037
|
+
}
|
|
3086
4038
|
static async fromFile({
|
|
3087
4039
|
baseDir = ".",
|
|
3088
4040
|
relativeFilePath,
|
|
3089
4041
|
validate = true
|
|
3090
4042
|
}) {
|
|
3091
4043
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
3092
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
3093
|
-
const fileContent = await readFileContent(
|
|
4044
|
+
const relativePath = isRoot ? "QWEN.md" : join45(".qwen/memories", relativeFilePath);
|
|
4045
|
+
const fileContent = await readFileContent(join45(baseDir, relativePath));
|
|
3094
4046
|
return new _QwencodeRule({
|
|
3095
4047
|
baseDir,
|
|
3096
|
-
relativeDirPath: isRoot ?
|
|
4048
|
+
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
3097
4049
|
relativeFilePath: isRoot ? "QWEN.md" : relativeFilePath,
|
|
3098
4050
|
fileContent,
|
|
3099
4051
|
validate,
|
|
@@ -3101,11 +4053,14 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
3101
4053
|
});
|
|
3102
4054
|
}
|
|
3103
4055
|
static fromRulesyncRule(params) {
|
|
3104
|
-
const { rulesyncRule } = params;
|
|
4056
|
+
const { baseDir = ".", rulesyncRule, validate = true } = params;
|
|
3105
4057
|
return new _QwencodeRule(
|
|
3106
4058
|
this.buildToolRuleParamsDefault({
|
|
4059
|
+
baseDir,
|
|
3107
4060
|
rulesyncRule,
|
|
3108
|
-
validate
|
|
4061
|
+
validate,
|
|
4062
|
+
rootPath: this.getSettablePaths().root,
|
|
4063
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
3109
4064
|
})
|
|
3110
4065
|
);
|
|
3111
4066
|
}
|
|
@@ -3118,17 +4073,26 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
3118
4073
|
};
|
|
3119
4074
|
|
|
3120
4075
|
// src/rules/roo-rule.ts
|
|
3121
|
-
import { join as
|
|
4076
|
+
import { join as join46 } from "path";
|
|
3122
4077
|
var RooRule = class _RooRule extends ToolRule {
|
|
4078
|
+
static getSettablePaths() {
|
|
4079
|
+
return {
|
|
4080
|
+
nonRoot: {
|
|
4081
|
+
relativeDirPath: ".roo/rules"
|
|
4082
|
+
}
|
|
4083
|
+
};
|
|
4084
|
+
}
|
|
3123
4085
|
static async fromFile({
|
|
3124
4086
|
baseDir = ".",
|
|
3125
4087
|
relativeFilePath,
|
|
3126
4088
|
validate = true
|
|
3127
4089
|
}) {
|
|
3128
|
-
const fileContent = await readFileContent(
|
|
4090
|
+
const fileContent = await readFileContent(
|
|
4091
|
+
join46(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4092
|
+
);
|
|
3129
4093
|
return new _RooRule({
|
|
3130
4094
|
baseDir,
|
|
3131
|
-
relativeDirPath:
|
|
4095
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
3132
4096
|
relativeFilePath,
|
|
3133
4097
|
fileContent,
|
|
3134
4098
|
validate,
|
|
@@ -3145,7 +4109,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
3145
4109
|
baseDir,
|
|
3146
4110
|
rulesyncRule,
|
|
3147
4111
|
validate,
|
|
3148
|
-
nonRootPath:
|
|
4112
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
3149
4113
|
})
|
|
3150
4114
|
);
|
|
3151
4115
|
}
|
|
@@ -3173,7 +4137,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
3173
4137
|
};
|
|
3174
4138
|
|
|
3175
4139
|
// src/rules/warp-rule.ts
|
|
3176
|
-
import { join as
|
|
4140
|
+
import { join as join47 } from "path";
|
|
3177
4141
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
3178
4142
|
constructor({ fileContent, root, ...rest }) {
|
|
3179
4143
|
super({
|
|
@@ -3182,18 +4146,29 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
3182
4146
|
root: root ?? false
|
|
3183
4147
|
});
|
|
3184
4148
|
}
|
|
4149
|
+
static getSettablePaths() {
|
|
4150
|
+
return {
|
|
4151
|
+
root: {
|
|
4152
|
+
relativeDirPath: ".",
|
|
4153
|
+
relativeFilePath: "WARP.md"
|
|
4154
|
+
},
|
|
4155
|
+
nonRoot: {
|
|
4156
|
+
relativeDirPath: ".warp/memories"
|
|
4157
|
+
}
|
|
4158
|
+
};
|
|
4159
|
+
}
|
|
3185
4160
|
static async fromFile({
|
|
3186
4161
|
baseDir = ".",
|
|
3187
4162
|
relativeFilePath,
|
|
3188
4163
|
validate = true
|
|
3189
4164
|
}) {
|
|
3190
|
-
const isRoot = relativeFilePath ===
|
|
3191
|
-
const relativePath = isRoot ?
|
|
3192
|
-
const fileContent = await readFileContent(
|
|
4165
|
+
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
4166
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join47(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4167
|
+
const fileContent = await readFileContent(join47(baseDir, relativePath));
|
|
3193
4168
|
return new _WarpRule({
|
|
3194
4169
|
baseDir,
|
|
3195
|
-
relativeDirPath: isRoot ?
|
|
3196
|
-
relativeFilePath: isRoot ?
|
|
4170
|
+
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
4171
|
+
relativeFilePath: isRoot ? this.getSettablePaths().root.relativeFilePath : relativeFilePath,
|
|
3197
4172
|
fileContent,
|
|
3198
4173
|
validate,
|
|
3199
4174
|
root: isRoot
|
|
@@ -3209,8 +4184,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
3209
4184
|
baseDir,
|
|
3210
4185
|
rulesyncRule,
|
|
3211
4186
|
validate,
|
|
3212
|
-
rootPath:
|
|
3213
|
-
nonRootPath:
|
|
4187
|
+
rootPath: this.getSettablePaths().root,
|
|
4188
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
3214
4189
|
})
|
|
3215
4190
|
);
|
|
3216
4191
|
}
|
|
@@ -3223,17 +4198,26 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
3223
4198
|
};
|
|
3224
4199
|
|
|
3225
4200
|
// src/rules/windsurf-rule.ts
|
|
3226
|
-
import { join as
|
|
4201
|
+
import { join as join48 } from "path";
|
|
3227
4202
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
4203
|
+
static getSettablePaths() {
|
|
4204
|
+
return {
|
|
4205
|
+
nonRoot: {
|
|
4206
|
+
relativeDirPath: ".windsurf/rules"
|
|
4207
|
+
}
|
|
4208
|
+
};
|
|
4209
|
+
}
|
|
3228
4210
|
static async fromFile({
|
|
3229
4211
|
baseDir = ".",
|
|
3230
4212
|
relativeFilePath,
|
|
3231
4213
|
validate = true
|
|
3232
4214
|
}) {
|
|
3233
|
-
const fileContent = await readFileContent(
|
|
4215
|
+
const fileContent = await readFileContent(
|
|
4216
|
+
join48(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4217
|
+
);
|
|
3234
4218
|
return new _WindsurfRule({
|
|
3235
4219
|
baseDir,
|
|
3236
|
-
relativeDirPath:
|
|
4220
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
3237
4221
|
relativeFilePath,
|
|
3238
4222
|
fileContent,
|
|
3239
4223
|
validate
|
|
@@ -3249,7 +4233,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
3249
4233
|
baseDir,
|
|
3250
4234
|
rulesyncRule,
|
|
3251
4235
|
validate,
|
|
3252
|
-
nonRootPath:
|
|
4236
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
3253
4237
|
})
|
|
3254
4238
|
);
|
|
3255
4239
|
}
|
|
@@ -3281,15 +4265,21 @@ var rulesProcessorToolTargets = [
|
|
|
3281
4265
|
"warp",
|
|
3282
4266
|
"windsurf"
|
|
3283
4267
|
];
|
|
3284
|
-
var RulesProcessorToolTargetSchema =
|
|
4268
|
+
var RulesProcessorToolTargetSchema = z18.enum(rulesProcessorToolTargets);
|
|
3285
4269
|
var RulesProcessor = class extends FeatureProcessor {
|
|
3286
4270
|
toolTarget;
|
|
4271
|
+
simulateCommands;
|
|
4272
|
+
simulateSubagents;
|
|
3287
4273
|
constructor({
|
|
3288
4274
|
baseDir = process.cwd(),
|
|
3289
|
-
toolTarget
|
|
4275
|
+
toolTarget,
|
|
4276
|
+
simulateCommands = false,
|
|
4277
|
+
simulateSubagents = false
|
|
3290
4278
|
}) {
|
|
3291
4279
|
super({ baseDir });
|
|
3292
4280
|
this.toolTarget = RulesProcessorToolTargetSchema.parse(toolTarget);
|
|
4281
|
+
this.simulateCommands = simulateCommands;
|
|
4282
|
+
this.simulateSubagents = simulateSubagents;
|
|
3293
4283
|
}
|
|
3294
4284
|
async convertRulesyncFilesToToolFiles(rulesyncFiles) {
|
|
3295
4285
|
const rulesyncRules = rulesyncFiles.filter(
|
|
@@ -3403,6 +4393,25 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3403
4393
|
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
3404
4394
|
}
|
|
3405
4395
|
});
|
|
4396
|
+
if (this.toolTarget === "cursor" && (this.simulateCommands || this.simulateSubagents)) {
|
|
4397
|
+
toolRules.push(
|
|
4398
|
+
new CursorRule({
|
|
4399
|
+
baseDir: this.baseDir,
|
|
4400
|
+
frontmatter: {
|
|
4401
|
+
alwaysApply: true
|
|
4402
|
+
},
|
|
4403
|
+
body: this.generateAdditionalConventionsSection({
|
|
4404
|
+
commands: { relativeDirPath: CursorCommand.getSettablePaths().relativeDirPath },
|
|
4405
|
+
subagents: {
|
|
4406
|
+
relativeDirPath: CursorSubagent.getSettablePaths().relativeDirPath
|
|
4407
|
+
}
|
|
4408
|
+
}),
|
|
4409
|
+
relativeDirPath: CursorRule.getSettablePaths().nonRoot.relativeDirPath,
|
|
4410
|
+
relativeFilePath: "additional-conventions.mdc",
|
|
4411
|
+
validate: true
|
|
4412
|
+
})
|
|
4413
|
+
);
|
|
4414
|
+
}
|
|
3406
4415
|
const rootRuleIndex = toolRules.findIndex((rule) => rule.isRoot());
|
|
3407
4416
|
if (rootRuleIndex === -1) {
|
|
3408
4417
|
return toolRules;
|
|
@@ -3432,14 +4441,24 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3432
4441
|
case "codexcli": {
|
|
3433
4442
|
const rootRule = toolRules[rootRuleIndex];
|
|
3434
4443
|
rootRule?.setFileContent(
|
|
3435
|
-
this.generateXmlReferencesSection(toolRules) +
|
|
4444
|
+
this.generateXmlReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
|
|
4445
|
+
commands: { relativeDirPath: CodexCliCommand.getSettablePaths().relativeDirPath },
|
|
4446
|
+
subagents: {
|
|
4447
|
+
relativeDirPath: CodexCliSubagent.getSettablePaths().relativeDirPath
|
|
4448
|
+
}
|
|
4449
|
+
}) + rootRule.getFileContent()
|
|
3436
4450
|
);
|
|
3437
4451
|
return toolRules;
|
|
3438
4452
|
}
|
|
3439
4453
|
case "copilot": {
|
|
3440
4454
|
const rootRule = toolRules[rootRuleIndex];
|
|
3441
4455
|
rootRule?.setFileContent(
|
|
3442
|
-
this.generateXmlReferencesSection(toolRules) +
|
|
4456
|
+
this.generateXmlReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
|
|
4457
|
+
commands: { relativeDirPath: CopilotCommand.getSettablePaths().relativeDirPath },
|
|
4458
|
+
subagents: {
|
|
4459
|
+
relativeDirPath: CopilotSubagent.getSettablePaths().relativeDirPath
|
|
4460
|
+
}
|
|
4461
|
+
}) + rootRule.getFileContent()
|
|
3443
4462
|
);
|
|
3444
4463
|
return toolRules;
|
|
3445
4464
|
}
|
|
@@ -3494,17 +4513,17 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3494
4513
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
3495
4514
|
*/
|
|
3496
4515
|
async loadRulesyncFiles() {
|
|
3497
|
-
const files = await findFilesByGlobs(
|
|
4516
|
+
const files = await findFilesByGlobs(join49(RULESYNC_RULES_DIR, "*.md"));
|
|
3498
4517
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
3499
4518
|
return Promise.all(
|
|
3500
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath:
|
|
4519
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename14(file) }))
|
|
3501
4520
|
);
|
|
3502
4521
|
}
|
|
3503
4522
|
async loadRulesyncFilesLegacy() {
|
|
3504
|
-
const legacyFiles = await findFilesByGlobs(
|
|
4523
|
+
const legacyFiles = await findFilesByGlobs(join49(RULESYNC_RULES_DIR_LEGACY, "*.md"));
|
|
3505
4524
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
3506
4525
|
return Promise.all(
|
|
3507
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath:
|
|
4526
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename14(file) }))
|
|
3508
4527
|
);
|
|
3509
4528
|
}
|
|
3510
4529
|
/**
|
|
@@ -3565,13 +4584,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3565
4584
|
return [];
|
|
3566
4585
|
}
|
|
3567
4586
|
const rootFilePaths = await findFilesByGlobs(
|
|
3568
|
-
|
|
4587
|
+
join49(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
|
|
3569
4588
|
);
|
|
3570
4589
|
return await Promise.all(
|
|
3571
4590
|
rootFilePaths.map(
|
|
3572
4591
|
(filePath) => root.fromFile({
|
|
3573
4592
|
baseDir: this.baseDir,
|
|
3574
|
-
relativeFilePath:
|
|
4593
|
+
relativeFilePath: basename14(filePath)
|
|
3575
4594
|
})
|
|
3576
4595
|
)
|
|
3577
4596
|
);
|
|
@@ -3582,13 +4601,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3582
4601
|
return [];
|
|
3583
4602
|
}
|
|
3584
4603
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
3585
|
-
|
|
4604
|
+
join49(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
|
|
3586
4605
|
);
|
|
3587
4606
|
return await Promise.all(
|
|
3588
4607
|
nonRootFilePaths.map(
|
|
3589
4608
|
(filePath) => nonRoot.fromFile({
|
|
3590
4609
|
baseDir: this.baseDir,
|
|
3591
|
-
relativeFilePath:
|
|
4610
|
+
relativeFilePath: basename14(filePath)
|
|
3592
4611
|
})
|
|
3593
4612
|
)
|
|
3594
4613
|
);
|
|
@@ -3600,28 +4619,30 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3600
4619
|
* Load AGENTS.md rule configuration
|
|
3601
4620
|
*/
|
|
3602
4621
|
async loadAgentsmdRules() {
|
|
4622
|
+
const settablePaths = AgentsMdRule.getSettablePaths();
|
|
3603
4623
|
return await this.loadToolRulesDefault({
|
|
3604
4624
|
root: {
|
|
3605
|
-
relativeDirPath:
|
|
3606
|
-
relativeFilePath:
|
|
4625
|
+
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
4626
|
+
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
3607
4627
|
fromFile: (params) => AgentsMdRule.fromFile(params)
|
|
3608
4628
|
},
|
|
3609
4629
|
nonRoot: {
|
|
3610
|
-
|
|
4630
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3611
4631
|
fromFile: (params) => AgentsMdRule.fromFile(params),
|
|
3612
4632
|
extension: "md"
|
|
3613
4633
|
}
|
|
3614
4634
|
});
|
|
3615
4635
|
}
|
|
3616
4636
|
async loadWarpRules() {
|
|
4637
|
+
const settablePaths = WarpRule.getSettablePaths();
|
|
3617
4638
|
return await this.loadToolRulesDefault({
|
|
3618
4639
|
root: {
|
|
3619
|
-
relativeDirPath:
|
|
3620
|
-
relativeFilePath:
|
|
4640
|
+
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
4641
|
+
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
3621
4642
|
fromFile: (params) => WarpRule.fromFile(params)
|
|
3622
4643
|
},
|
|
3623
4644
|
nonRoot: {
|
|
3624
|
-
|
|
4645
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3625
4646
|
fromFile: (params) => WarpRule.fromFile(params),
|
|
3626
4647
|
extension: "md"
|
|
3627
4648
|
}
|
|
@@ -3631,9 +4652,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3631
4652
|
* Load Amazon Q Developer CLI rule configurations from .amazonq/rules/ directory
|
|
3632
4653
|
*/
|
|
3633
4654
|
async loadAmazonqcliRules() {
|
|
4655
|
+
const settablePaths = AmazonQCliRule.getSettablePaths();
|
|
3634
4656
|
return await this.loadToolRulesDefault({
|
|
3635
4657
|
nonRoot: {
|
|
3636
|
-
|
|
4658
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3637
4659
|
fromFile: (params) => AmazonQCliRule.fromFile(params),
|
|
3638
4660
|
extension: "md"
|
|
3639
4661
|
}
|
|
@@ -3643,9 +4665,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3643
4665
|
* Load AugmentCode rule configurations from .augment/rules/ directory
|
|
3644
4666
|
*/
|
|
3645
4667
|
async loadAugmentcodeRules() {
|
|
4668
|
+
const settablePaths = AugmentcodeRule.getSettablePaths();
|
|
3646
4669
|
return await this.loadToolRulesDefault({
|
|
3647
4670
|
nonRoot: {
|
|
3648
|
-
|
|
4671
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3649
4672
|
fromFile: (params) => AugmentcodeRule.fromFile(params),
|
|
3650
4673
|
extension: "md"
|
|
3651
4674
|
}
|
|
@@ -3655,14 +4678,15 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3655
4678
|
* Load AugmentCode legacy rule configuration from .augment-guidelines file and .augment/rules/ directory
|
|
3656
4679
|
*/
|
|
3657
4680
|
async loadAugmentcodeLegacyRules() {
|
|
4681
|
+
const settablePaths = AugmentcodeLegacyRule.getSettablePaths();
|
|
3658
4682
|
return await this.loadToolRulesDefault({
|
|
3659
4683
|
root: {
|
|
3660
|
-
relativeDirPath:
|
|
3661
|
-
relativeFilePath:
|
|
4684
|
+
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
4685
|
+
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
3662
4686
|
fromFile: (params) => AugmentcodeLegacyRule.fromFile(params)
|
|
3663
4687
|
},
|
|
3664
4688
|
nonRoot: {
|
|
3665
|
-
|
|
4689
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3666
4690
|
fromFile: (params) => AugmentcodeLegacyRule.fromFile(params),
|
|
3667
4691
|
extension: "md"
|
|
3668
4692
|
}
|
|
@@ -3672,14 +4696,15 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3672
4696
|
* Load Claude Code rule configuration from CLAUDE.md file
|
|
3673
4697
|
*/
|
|
3674
4698
|
async loadClaudecodeRules() {
|
|
4699
|
+
const settablePaths = ClaudecodeRule.getSettablePaths();
|
|
3675
4700
|
return await this.loadToolRulesDefault({
|
|
3676
4701
|
root: {
|
|
3677
|
-
relativeDirPath:
|
|
3678
|
-
relativeFilePath:
|
|
4702
|
+
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
4703
|
+
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
3679
4704
|
fromFile: (params) => ClaudecodeRule.fromFile(params)
|
|
3680
4705
|
},
|
|
3681
4706
|
nonRoot: {
|
|
3682
|
-
|
|
4707
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3683
4708
|
fromFile: (params) => ClaudecodeRule.fromFile(params),
|
|
3684
4709
|
extension: "md"
|
|
3685
4710
|
}
|
|
@@ -3689,9 +4714,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3689
4714
|
* Load Cline rule configurations from .clinerules/ directory
|
|
3690
4715
|
*/
|
|
3691
4716
|
async loadClineRules() {
|
|
4717
|
+
const settablePaths = ClineRule.getSettablePaths();
|
|
3692
4718
|
return await this.loadToolRulesDefault({
|
|
3693
4719
|
nonRoot: {
|
|
3694
|
-
|
|
4720
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3695
4721
|
fromFile: (params) => ClineRule.fromFile(params),
|
|
3696
4722
|
extension: "md"
|
|
3697
4723
|
}
|
|
@@ -3701,14 +4727,15 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3701
4727
|
* Load OpenAI Codex CLI rule configuration from AGENTS.md and .codex/memories/*.md files
|
|
3702
4728
|
*/
|
|
3703
4729
|
async loadCodexcliRules() {
|
|
4730
|
+
const settablePaths = CodexcliRule.getSettablePaths();
|
|
3704
4731
|
return await this.loadToolRulesDefault({
|
|
3705
4732
|
root: {
|
|
3706
|
-
relativeDirPath:
|
|
3707
|
-
relativeFilePath:
|
|
4733
|
+
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
4734
|
+
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
3708
4735
|
fromFile: (params) => CodexcliRule.fromFile(params)
|
|
3709
4736
|
},
|
|
3710
4737
|
nonRoot: {
|
|
3711
|
-
|
|
4738
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3712
4739
|
fromFile: (params) => CodexcliRule.fromFile(params),
|
|
3713
4740
|
extension: "md"
|
|
3714
4741
|
}
|
|
@@ -3718,14 +4745,15 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3718
4745
|
* Load GitHub Copilot rule configuration from .github/copilot-instructions.md file
|
|
3719
4746
|
*/
|
|
3720
4747
|
async loadCopilotRules() {
|
|
4748
|
+
const settablePaths = CopilotRule.getSettablePaths();
|
|
3721
4749
|
return await this.loadToolRulesDefault({
|
|
3722
4750
|
root: {
|
|
3723
|
-
relativeDirPath:
|
|
3724
|
-
relativeFilePath:
|
|
4751
|
+
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
4752
|
+
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
3725
4753
|
fromFile: (params) => CopilotRule.fromFile(params)
|
|
3726
4754
|
},
|
|
3727
4755
|
nonRoot: {
|
|
3728
|
-
|
|
4756
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3729
4757
|
fromFile: (params) => CopilotRule.fromFile(params),
|
|
3730
4758
|
extension: "md"
|
|
3731
4759
|
}
|
|
@@ -3735,11 +4763,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3735
4763
|
* Load Cursor rule configurations from .cursor/rules/ directory
|
|
3736
4764
|
*/
|
|
3737
4765
|
async loadCursorRules() {
|
|
4766
|
+
const settablePaths = CursorRule.getSettablePaths();
|
|
3738
4767
|
return await this.loadToolRulesDefault({
|
|
3739
4768
|
nonRoot: {
|
|
3740
|
-
|
|
4769
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3741
4770
|
fromFile: (params) => CursorRule.fromFile(params),
|
|
3742
|
-
extension: "
|
|
4771
|
+
extension: "mdc"
|
|
3743
4772
|
}
|
|
3744
4773
|
});
|
|
3745
4774
|
}
|
|
@@ -3747,14 +4776,15 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3747
4776
|
* Load Gemini CLI rule configuration from GEMINI.md file
|
|
3748
4777
|
*/
|
|
3749
4778
|
async loadGeminicliRules() {
|
|
4779
|
+
const settablePaths = GeminiCliRule.getSettablePaths();
|
|
3750
4780
|
return await this.loadToolRulesDefault({
|
|
3751
4781
|
root: {
|
|
3752
|
-
relativeDirPath:
|
|
3753
|
-
relativeFilePath:
|
|
4782
|
+
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
4783
|
+
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
3754
4784
|
fromFile: (params) => GeminiCliRule.fromFile(params)
|
|
3755
4785
|
},
|
|
3756
4786
|
nonRoot: {
|
|
3757
|
-
|
|
4787
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3758
4788
|
fromFile: (params) => GeminiCliRule.fromFile(params),
|
|
3759
4789
|
extension: "md"
|
|
3760
4790
|
}
|
|
@@ -3764,14 +4794,15 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3764
4794
|
* Load JetBrains Junie rule configuration from .junie/guidelines.md file
|
|
3765
4795
|
*/
|
|
3766
4796
|
async loadJunieRules() {
|
|
4797
|
+
const settablePaths = JunieRule.getSettablePaths();
|
|
3767
4798
|
return await this.loadToolRulesDefault({
|
|
3768
4799
|
root: {
|
|
3769
|
-
relativeDirPath:
|
|
3770
|
-
relativeFilePath:
|
|
4800
|
+
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
4801
|
+
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
3771
4802
|
fromFile: (params) => JunieRule.fromFile(params)
|
|
3772
4803
|
},
|
|
3773
4804
|
nonRoot: {
|
|
3774
|
-
|
|
4805
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3775
4806
|
fromFile: (params) => JunieRule.fromFile(params),
|
|
3776
4807
|
extension: "md"
|
|
3777
4808
|
}
|
|
@@ -3781,9 +4812,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3781
4812
|
* Load Kiro rule configurations from .kiro/steering/ directory
|
|
3782
4813
|
*/
|
|
3783
4814
|
async loadKiroRules() {
|
|
4815
|
+
const settablePaths = KiroRule.getSettablePaths();
|
|
3784
4816
|
return await this.loadToolRulesDefault({
|
|
3785
4817
|
nonRoot: {
|
|
3786
|
-
|
|
4818
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3787
4819
|
fromFile: (params) => KiroRule.fromFile(params),
|
|
3788
4820
|
extension: "md"
|
|
3789
4821
|
}
|
|
@@ -3793,14 +4825,15 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3793
4825
|
* Load OpenCode rule configuration from AGENTS.md file and .opencode/memories/*.md files
|
|
3794
4826
|
*/
|
|
3795
4827
|
async loadOpencodeRules() {
|
|
4828
|
+
const settablePaths = OpenCodeRule.getSettablePaths();
|
|
3796
4829
|
return await this.loadToolRulesDefault({
|
|
3797
4830
|
root: {
|
|
3798
|
-
relativeDirPath:
|
|
3799
|
-
relativeFilePath:
|
|
4831
|
+
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
4832
|
+
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
3800
4833
|
fromFile: (params) => OpenCodeRule.fromFile(params)
|
|
3801
4834
|
},
|
|
3802
4835
|
nonRoot: {
|
|
3803
|
-
|
|
4836
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3804
4837
|
fromFile: (params) => OpenCodeRule.fromFile(params),
|
|
3805
4838
|
extension: "md"
|
|
3806
4839
|
}
|
|
@@ -3810,14 +4843,15 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3810
4843
|
* Load Qwen Code rule configuration from QWEN.md file and .qwen/memories/*.md files
|
|
3811
4844
|
*/
|
|
3812
4845
|
async loadQwencodeRules() {
|
|
4846
|
+
const settablePaths = QwencodeRule.getSettablePaths();
|
|
3813
4847
|
return await this.loadToolRulesDefault({
|
|
3814
4848
|
root: {
|
|
3815
|
-
relativeDirPath:
|
|
3816
|
-
relativeFilePath:
|
|
4849
|
+
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
4850
|
+
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
3817
4851
|
fromFile: (params) => QwencodeRule.fromFile(params)
|
|
3818
4852
|
},
|
|
3819
4853
|
nonRoot: {
|
|
3820
|
-
|
|
4854
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3821
4855
|
fromFile: (params) => QwencodeRule.fromFile(params),
|
|
3822
4856
|
extension: "md"
|
|
3823
4857
|
}
|
|
@@ -3827,9 +4861,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3827
4861
|
* Load Roo Code rule configurations from .roo/rules/ directory
|
|
3828
4862
|
*/
|
|
3829
4863
|
async loadRooRules() {
|
|
4864
|
+
const settablePaths = RooRule.getSettablePaths();
|
|
3830
4865
|
return await this.loadToolRulesDefault({
|
|
3831
4866
|
nonRoot: {
|
|
3832
|
-
|
|
4867
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3833
4868
|
fromFile: (params) => RooRule.fromFile(params),
|
|
3834
4869
|
extension: "md"
|
|
3835
4870
|
}
|
|
@@ -3839,9 +4874,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3839
4874
|
* Load Windsurf rule configurations from .windsurf/rules/ directory
|
|
3840
4875
|
*/
|
|
3841
4876
|
async loadWindsurfRules() {
|
|
4877
|
+
const settablePaths = WindsurfRule.getSettablePaths();
|
|
3842
4878
|
return await this.loadToolRulesDefault({
|
|
3843
4879
|
nonRoot: {
|
|
3844
|
-
|
|
4880
|
+
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
3845
4881
|
fromFile: (params) => WindsurfRule.fromFile(params),
|
|
3846
4882
|
extension: "md"
|
|
3847
4883
|
}
|
|
@@ -3911,26 +4947,57 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
3911
4947
|
}
|
|
3912
4948
|
return lines.join("\n") + "\n";
|
|
3913
4949
|
}
|
|
4950
|
+
generateAdditionalConventionsSection({
|
|
4951
|
+
commands,
|
|
4952
|
+
subagents
|
|
4953
|
+
}) {
|
|
4954
|
+
return `# Additional Conventions Beyond the Built-in Functions
|
|
4955
|
+
|
|
4956
|
+
As this project's AI coding tool, you must follow the additional conventions below, in addition to the built-in functions.
|
|
4957
|
+
|
|
4958
|
+
${this.simulateCommands ? `## Simulated Custom Slash Commands
|
|
4959
|
+
|
|
4960
|
+
Custom slash commands allow you to define frequently-used prompts as Markdown files that you can execute.
|
|
4961
|
+
|
|
4962
|
+
### Syntax
|
|
4963
|
+
|
|
4964
|
+
Users can use following syntax to invoke a custom command.
|
|
4965
|
+
|
|
4966
|
+
\`\`\`txt
|
|
4967
|
+
s/<command> [arguments]
|
|
4968
|
+
\`\`\`
|
|
4969
|
+
|
|
4970
|
+
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
4971
|
+
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
4972
|
+
|
|
4973
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join49(commands.relativeDirPath, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : ""}
|
|
4974
|
+
|
|
4975
|
+
${this.simulateSubagents ? `## Simulated Subagents
|
|
4976
|
+
|
|
4977
|
+
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.
|
|
4978
|
+
|
|
4979
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join49(subagents.relativeDirPath, "{subagent}.md")}\`, and execute its contents as the block of operations.` : ""}`.trim();
|
|
4980
|
+
}
|
|
3914
4981
|
};
|
|
3915
4982
|
|
|
3916
4983
|
// src/subagents/subagents-processor.ts
|
|
3917
|
-
import { basename as
|
|
3918
|
-
import { z as
|
|
4984
|
+
import { basename as basename16, join as join52 } from "path";
|
|
4985
|
+
import { z as z21 } from "zod/mini";
|
|
3919
4986
|
|
|
3920
4987
|
// src/subagents/claudecode-subagent.ts
|
|
3921
|
-
import { join as
|
|
3922
|
-
import { z as
|
|
4988
|
+
import { join as join51 } from "path";
|
|
4989
|
+
import { z as z20 } from "zod/mini";
|
|
3923
4990
|
|
|
3924
4991
|
// src/subagents/rulesync-subagent.ts
|
|
3925
|
-
import { basename as
|
|
3926
|
-
import { z as
|
|
3927
|
-
var RulesyncSubagentModelSchema =
|
|
3928
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
4992
|
+
import { basename as basename15, join as join50 } from "path";
|
|
4993
|
+
import { z as z19 } from "zod/mini";
|
|
4994
|
+
var RulesyncSubagentModelSchema = z19.enum(["opus", "sonnet", "haiku", "inherit"]);
|
|
4995
|
+
var RulesyncSubagentFrontmatterSchema = z19.object({
|
|
3929
4996
|
targets: RulesyncTargetsSchema,
|
|
3930
|
-
name:
|
|
3931
|
-
description:
|
|
3932
|
-
claudecode:
|
|
3933
|
-
|
|
4997
|
+
name: z19.string(),
|
|
4998
|
+
description: z19.string(),
|
|
4999
|
+
claudecode: z19.optional(
|
|
5000
|
+
z19.object({
|
|
3934
5001
|
model: RulesyncSubagentModelSchema
|
|
3935
5002
|
})
|
|
3936
5003
|
)
|
|
@@ -3951,6 +5018,11 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
3951
5018
|
this.frontmatter = frontmatter;
|
|
3952
5019
|
this.body = body;
|
|
3953
5020
|
}
|
|
5021
|
+
static getSettablePaths() {
|
|
5022
|
+
return {
|
|
5023
|
+
relativeDirPath: ".rulesync/subagents"
|
|
5024
|
+
};
|
|
5025
|
+
}
|
|
3954
5026
|
getFrontmatter() {
|
|
3955
5027
|
return this.frontmatter;
|
|
3956
5028
|
}
|
|
@@ -3971,16 +5043,16 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
3971
5043
|
static async fromFile({
|
|
3972
5044
|
relativeFilePath
|
|
3973
5045
|
}) {
|
|
3974
|
-
const fileContent = await readFileContent(
|
|
5046
|
+
const fileContent = await readFileContent(join50(RULESYNC_SUBAGENTS_DIR, relativeFilePath));
|
|
3975
5047
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3976
5048
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
3977
5049
|
if (!result.success) {
|
|
3978
5050
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${result.error.message}`);
|
|
3979
5051
|
}
|
|
3980
|
-
const filename =
|
|
5052
|
+
const filename = basename15(relativeFilePath);
|
|
3981
5053
|
return new _RulesyncSubagent({
|
|
3982
5054
|
baseDir: ".",
|
|
3983
|
-
relativeDirPath:
|
|
5055
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
3984
5056
|
relativeFilePath: filename,
|
|
3985
5057
|
frontmatter: result.data,
|
|
3986
5058
|
body: content.trim(),
|
|
@@ -3989,21 +5061,11 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
3989
5061
|
}
|
|
3990
5062
|
};
|
|
3991
5063
|
|
|
3992
|
-
// src/subagents/tool-subagent.ts
|
|
3993
|
-
var ToolSubagent = class extends ToolFile {
|
|
3994
|
-
static async fromFile(_params) {
|
|
3995
|
-
throw new Error("Please implement this method in the subclass.");
|
|
3996
|
-
}
|
|
3997
|
-
static fromRulesyncSubagent(_params) {
|
|
3998
|
-
throw new Error("Please implement this method in the subclass.");
|
|
3999
|
-
}
|
|
4000
|
-
};
|
|
4001
|
-
|
|
4002
5064
|
// src/subagents/claudecode-subagent.ts
|
|
4003
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
4004
|
-
name:
|
|
4005
|
-
description:
|
|
4006
|
-
model:
|
|
5065
|
+
var ClaudecodeSubagentFrontmatterSchema = z20.object({
|
|
5066
|
+
name: z20.string(),
|
|
5067
|
+
description: z20.string(),
|
|
5068
|
+
model: z20.optional(z20.enum(["opus", "sonnet", "haiku", "inherit"]))
|
|
4007
5069
|
});
|
|
4008
5070
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
4009
5071
|
frontmatter;
|
|
@@ -4021,6 +5083,11 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
4021
5083
|
this.frontmatter = frontmatter;
|
|
4022
5084
|
this.body = body;
|
|
4023
5085
|
}
|
|
5086
|
+
static getSettablePaths() {
|
|
5087
|
+
return {
|
|
5088
|
+
relativeDirPath: ".claude/agents"
|
|
5089
|
+
};
|
|
5090
|
+
}
|
|
4024
5091
|
getFrontmatter() {
|
|
4025
5092
|
return this.frontmatter;
|
|
4026
5093
|
}
|
|
@@ -4088,7 +5155,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
4088
5155
|
relativeFilePath,
|
|
4089
5156
|
validate = true
|
|
4090
5157
|
}) {
|
|
4091
|
-
const fileContent = await readFileContent(
|
|
5158
|
+
const fileContent = await readFileContent(join51(baseDir, ".claude/agents", relativeFilePath));
|
|
4092
5159
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
4093
5160
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
4094
5161
|
if (!result.success) {
|
|
@@ -4107,8 +5174,18 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
4107
5174
|
};
|
|
4108
5175
|
|
|
4109
5176
|
// src/subagents/subagents-processor.ts
|
|
4110
|
-
var subagentsProcessorToolTargets = [
|
|
4111
|
-
|
|
5177
|
+
var subagentsProcessorToolTargets = [
|
|
5178
|
+
"claudecode",
|
|
5179
|
+
"copilot",
|
|
5180
|
+
"cursor",
|
|
5181
|
+
"codexcli"
|
|
5182
|
+
];
|
|
5183
|
+
var subagentsProcessorToolTargetsSimulated = [
|
|
5184
|
+
"copilot",
|
|
5185
|
+
"cursor",
|
|
5186
|
+
"codexcli"
|
|
5187
|
+
];
|
|
5188
|
+
var SubagentsProcessorToolTargetSchema = z21.enum(subagentsProcessorToolTargets);
|
|
4112
5189
|
var SubagentsProcessor = class extends FeatureProcessor {
|
|
4113
5190
|
toolTarget;
|
|
4114
5191
|
constructor({
|
|
@@ -4127,7 +5204,25 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4127
5204
|
case "claudecode":
|
|
4128
5205
|
return ClaudecodeSubagent.fromRulesyncSubagent({
|
|
4129
5206
|
baseDir: this.baseDir,
|
|
4130
|
-
relativeDirPath:
|
|
5207
|
+
relativeDirPath: RulesyncSubagent.getSettablePaths().relativeDirPath,
|
|
5208
|
+
rulesyncSubagent
|
|
5209
|
+
});
|
|
5210
|
+
case "copilot":
|
|
5211
|
+
return CopilotSubagent.fromRulesyncSubagent({
|
|
5212
|
+
baseDir: this.baseDir,
|
|
5213
|
+
relativeDirPath: RulesyncSubagent.getSettablePaths().relativeDirPath,
|
|
5214
|
+
rulesyncSubagent
|
|
5215
|
+
});
|
|
5216
|
+
case "cursor":
|
|
5217
|
+
return CursorSubagent.fromRulesyncSubagent({
|
|
5218
|
+
baseDir: this.baseDir,
|
|
5219
|
+
relativeDirPath: RulesyncSubagent.getSettablePaths().relativeDirPath,
|
|
5220
|
+
rulesyncSubagent
|
|
5221
|
+
});
|
|
5222
|
+
case "codexcli":
|
|
5223
|
+
return CodexCliSubagent.fromRulesyncSubagent({
|
|
5224
|
+
baseDir: this.baseDir,
|
|
5225
|
+
relativeDirPath: RulesyncSubagent.getSettablePaths().relativeDirPath,
|
|
4131
5226
|
rulesyncSubagent
|
|
4132
5227
|
});
|
|
4133
5228
|
default:
|
|
@@ -4140,9 +5235,16 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4140
5235
|
const toolSubagents = toolFiles.filter(
|
|
4141
5236
|
(file) => file instanceof ToolSubagent
|
|
4142
5237
|
);
|
|
4143
|
-
const rulesyncSubagents =
|
|
4144
|
-
|
|
4145
|
-
|
|
5238
|
+
const rulesyncSubagents = [];
|
|
5239
|
+
for (const toolSubagent of toolSubagents) {
|
|
5240
|
+
if (toolSubagent instanceof SimulatedSubagent) {
|
|
5241
|
+
logger.debug(
|
|
5242
|
+
`Skipping simulated subagent conversion: ${toolSubagent.getRelativeFilePath()}`
|
|
5243
|
+
);
|
|
5244
|
+
continue;
|
|
5245
|
+
}
|
|
5246
|
+
rulesyncSubagents.push(toolSubagent.toRulesyncSubagent());
|
|
5247
|
+
}
|
|
4146
5248
|
return rulesyncSubagents;
|
|
4147
5249
|
}
|
|
4148
5250
|
/**
|
|
@@ -4150,7 +5252,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4150
5252
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
4151
5253
|
*/
|
|
4152
5254
|
async loadRulesyncFiles() {
|
|
4153
|
-
const subagentsDir =
|
|
5255
|
+
const subagentsDir = join52(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
4154
5256
|
const dirExists = await directoryExists(subagentsDir);
|
|
4155
5257
|
if (!dirExists) {
|
|
4156
5258
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -4165,7 +5267,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4165
5267
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
4166
5268
|
const rulesyncSubagents = [];
|
|
4167
5269
|
for (const mdFile of mdFiles) {
|
|
4168
|
-
const filepath =
|
|
5270
|
+
const filepath = join52(subagentsDir, mdFile);
|
|
4169
5271
|
try {
|
|
4170
5272
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
4171
5273
|
relativeFilePath: mdFile,
|
|
@@ -4193,6 +5295,12 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4193
5295
|
switch (this.toolTarget) {
|
|
4194
5296
|
case "claudecode":
|
|
4195
5297
|
return await this.loadClaudecodeSubagents();
|
|
5298
|
+
case "copilot":
|
|
5299
|
+
return await this.loadCopilotSubagents();
|
|
5300
|
+
case "cursor":
|
|
5301
|
+
return await this.loadCursorSubagents();
|
|
5302
|
+
case "codexcli":
|
|
5303
|
+
return await this.loadCodexCliSubagents();
|
|
4196
5304
|
default:
|
|
4197
5305
|
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
4198
5306
|
}
|
|
@@ -4202,16 +5310,43 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4202
5310
|
*/
|
|
4203
5311
|
async loadClaudecodeSubagents() {
|
|
4204
5312
|
return await this.loadToolSubagentsDefault({
|
|
4205
|
-
relativeDirPath:
|
|
5313
|
+
relativeDirPath: ClaudecodeSubagent.getSettablePaths().relativeDirPath,
|
|
4206
5314
|
fromFile: (relativeFilePath) => ClaudecodeSubagent.fromFile({ relativeFilePath })
|
|
4207
5315
|
});
|
|
4208
5316
|
}
|
|
5317
|
+
/**
|
|
5318
|
+
* Load Copilot subagent configurations from .copilot/subagents/ directory
|
|
5319
|
+
*/
|
|
5320
|
+
async loadCopilotSubagents() {
|
|
5321
|
+
return await this.loadToolSubagentsDefault({
|
|
5322
|
+
relativeDirPath: CopilotSubagent.getSettablePaths().relativeDirPath,
|
|
5323
|
+
fromFile: (relativeFilePath) => CopilotSubagent.fromFile({ relativeFilePath })
|
|
5324
|
+
});
|
|
5325
|
+
}
|
|
5326
|
+
/**
|
|
5327
|
+
* Load Cursor subagent configurations from .cursor/subagents/ directory
|
|
5328
|
+
*/
|
|
5329
|
+
async loadCursorSubagents() {
|
|
5330
|
+
return await this.loadToolSubagentsDefault({
|
|
5331
|
+
relativeDirPath: CursorSubagent.getSettablePaths().relativeDirPath,
|
|
5332
|
+
fromFile: (relativeFilePath) => CursorSubagent.fromFile({ relativeFilePath })
|
|
5333
|
+
});
|
|
5334
|
+
}
|
|
5335
|
+
/**
|
|
5336
|
+
* Load CodexCli subagent configurations from .codex/subagents/ directory
|
|
5337
|
+
*/
|
|
5338
|
+
async loadCodexCliSubagents() {
|
|
5339
|
+
return await this.loadToolSubagentsDefault({
|
|
5340
|
+
relativeDirPath: CodexCliSubagent.getSettablePaths().relativeDirPath,
|
|
5341
|
+
fromFile: (relativeFilePath) => CodexCliSubagent.fromFile({ relativeFilePath })
|
|
5342
|
+
});
|
|
5343
|
+
}
|
|
4209
5344
|
async loadToolSubagentsDefault({
|
|
4210
5345
|
relativeDirPath,
|
|
4211
5346
|
fromFile
|
|
4212
5347
|
}) {
|
|
4213
|
-
const paths = await findFilesByGlobs(
|
|
4214
|
-
const subagents = (await Promise.allSettled(paths.map((path2) => fromFile(
|
|
5348
|
+
const paths = await findFilesByGlobs(join52(this.baseDir, relativeDirPath, "*.md"));
|
|
5349
|
+
const subagents = (await Promise.allSettled(paths.map((path2) => fromFile(basename16(path2))))).filter((r) => r.status === "fulfilled").map((r) => r.value);
|
|
4215
5350
|
logger.info(`Successfully loaded ${subagents.length} ${relativeDirPath} subagents`);
|
|
4216
5351
|
return subagents;
|
|
4217
5352
|
}
|
|
@@ -4219,7 +5354,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4219
5354
|
* Implementation of abstract method from FeatureProcessor
|
|
4220
5355
|
* Return the tool targets that this processor supports
|
|
4221
5356
|
*/
|
|
4222
|
-
static getToolTargets(
|
|
5357
|
+
static getToolTargets({
|
|
5358
|
+
includeSimulated = false
|
|
5359
|
+
} = {}) {
|
|
5360
|
+
if (!includeSimulated) {
|
|
5361
|
+
return subagentsProcessorToolTargets.filter(
|
|
5362
|
+
(target) => !subagentsProcessorToolTargetsSimulated.includes(target)
|
|
5363
|
+
);
|
|
5364
|
+
}
|
|
4223
5365
|
return subagentsProcessorToolTargets;
|
|
4224
5366
|
}
|
|
4225
5367
|
};
|
|
@@ -4241,7 +5383,9 @@ async function generateCommand(options) {
|
|
|
4241
5383
|
for (const toolTarget of intersection(config.getTargets(), RulesProcessor.getToolTargets())) {
|
|
4242
5384
|
const processor = new RulesProcessor({
|
|
4243
5385
|
baseDir,
|
|
4244
|
-
toolTarget
|
|
5386
|
+
toolTarget,
|
|
5387
|
+
simulateCommands: config.getExperimentalSimulateCommands(),
|
|
5388
|
+
simulateSubagents: config.getExperimentalSimulateSubagents()
|
|
4245
5389
|
});
|
|
4246
5390
|
if (config.getDelete()) {
|
|
4247
5391
|
const oldToolFiles = await processor.loadToolFiles();
|
|
@@ -4299,18 +5443,12 @@ async function generateCommand(options) {
|
|
|
4299
5443
|
let totalCommandOutputs = 0;
|
|
4300
5444
|
if (config.getFeatures().includes("commands")) {
|
|
4301
5445
|
logger.info("Generating command files...");
|
|
4302
|
-
const supportedCommandTargets = [
|
|
4303
|
-
"claudecode",
|
|
4304
|
-
"geminicli",
|
|
4305
|
-
"roo"
|
|
4306
|
-
];
|
|
4307
|
-
const commandSupportedTargets = config.getTargets().filter((target) => {
|
|
4308
|
-
return supportedCommandTargets.some((supportedTarget) => supportedTarget === target);
|
|
4309
|
-
});
|
|
4310
5446
|
for (const baseDir of config.getBaseDirs()) {
|
|
4311
5447
|
for (const toolTarget of intersection(
|
|
4312
|
-
|
|
4313
|
-
CommandsProcessor.getToolTargets(
|
|
5448
|
+
config.getTargets(),
|
|
5449
|
+
CommandsProcessor.getToolTargets({
|
|
5450
|
+
includeSimulated: config.getExperimentalSimulateCommands()
|
|
5451
|
+
})
|
|
4314
5452
|
)) {
|
|
4315
5453
|
const processor = new CommandsProcessor({
|
|
4316
5454
|
baseDir,
|
|
@@ -4367,7 +5505,9 @@ async function generateCommand(options) {
|
|
|
4367
5505
|
for (const baseDir of config.getBaseDirs()) {
|
|
4368
5506
|
for (const toolTarget of intersection(
|
|
4369
5507
|
config.getTargets(),
|
|
4370
|
-
SubagentsProcessor.getToolTargets(
|
|
5508
|
+
SubagentsProcessor.getToolTargets({
|
|
5509
|
+
includeSimulated: config.getExperimentalSimulateSubagents()
|
|
5510
|
+
})
|
|
4371
5511
|
)) {
|
|
4372
5512
|
const processor = new SubagentsProcessor({
|
|
4373
5513
|
baseDir,
|
|
@@ -4403,16 +5543,15 @@ async function generateCommand(options) {
|
|
|
4403
5543
|
}
|
|
4404
5544
|
|
|
4405
5545
|
// src/cli/commands/gitignore.ts
|
|
4406
|
-
import { join as
|
|
5546
|
+
import { join as join53 } from "path";
|
|
4407
5547
|
var gitignoreCommand = async () => {
|
|
4408
|
-
const gitignorePath =
|
|
5548
|
+
const gitignorePath = join53(process.cwd(), ".gitignore");
|
|
4409
5549
|
const rulesFilesToIgnore = [
|
|
4410
5550
|
"# Generated by rulesync - AI tool configuration files",
|
|
4411
|
-
"**/.amazonq/
|
|
4412
|
-
"**/.amazonq/mcp.json",
|
|
5551
|
+
"**/.amazonq/",
|
|
4413
5552
|
"**/.github/copilot-instructions.md",
|
|
4414
5553
|
"**/.github/instructions/",
|
|
4415
|
-
"**/.cursor/
|
|
5554
|
+
"**/.cursor/",
|
|
4416
5555
|
"**/.cursorignore",
|
|
4417
5556
|
"**/.clinerules/",
|
|
4418
5557
|
"**/.clineignore",
|
|
@@ -4422,7 +5561,6 @@ var gitignoreCommand = async () => {
|
|
|
4422
5561
|
"**/.claude/agents/",
|
|
4423
5562
|
"**/AGENTS.md",
|
|
4424
5563
|
"**/.agents/",
|
|
4425
|
-
"**/.codexignore",
|
|
4426
5564
|
"**/.roo/rules/",
|
|
4427
5565
|
"**/.rooignore",
|
|
4428
5566
|
"**/.copilotignore",
|
|
@@ -4443,14 +5581,16 @@ var gitignoreCommand = async () => {
|
|
|
4443
5581
|
"**/.opencode/commands/",
|
|
4444
5582
|
"**/opencode.json",
|
|
4445
5583
|
"**/.mcp.json",
|
|
4446
|
-
"!.rulesync/.mcp.json",
|
|
4447
5584
|
"**/.cursor/mcp.json",
|
|
4448
5585
|
"**/.cline/mcp.json",
|
|
5586
|
+
"**/.roo/mcp.json",
|
|
4449
5587
|
"**/.vscode/mcp.json",
|
|
4450
|
-
"**/.
|
|
4451
|
-
"**/.
|
|
4452
|
-
"**/.
|
|
4453
|
-
"
|
|
5588
|
+
"**/.github/commands/",
|
|
5589
|
+
"**/.github/subagents/",
|
|
5590
|
+
"**/.warp/",
|
|
5591
|
+
"**/WARP.md",
|
|
5592
|
+
"**/.codexignore",
|
|
5593
|
+
"**/.codex/"
|
|
4454
5594
|
];
|
|
4455
5595
|
let gitignoreContent = "";
|
|
4456
5596
|
if (await fileExists(gitignorePath)) {
|
|
@@ -4493,6 +5633,13 @@ async function importCommand(options) {
|
|
|
4493
5633
|
const config = await ConfigResolver.resolve(options);
|
|
4494
5634
|
logger.setVerbose(config.getVerbose());
|
|
4495
5635
|
const tool = config.getTargets()[0];
|
|
5636
|
+
const simulatedOnlyTools = ["copilot", "cursor", "codexcli"];
|
|
5637
|
+
if (simulatedOnlyTools.includes(tool)) {
|
|
5638
|
+
logger.error(
|
|
5639
|
+
`Cannot import ${tool}: it only supports generation (simulated commands/subagents)`
|
|
5640
|
+
);
|
|
5641
|
+
process.exit(1);
|
|
5642
|
+
}
|
|
4496
5643
|
let rulesCreated = 0;
|
|
4497
5644
|
if (config.getFeatures().includes("rules")) {
|
|
4498
5645
|
if (RulesProcessor.getToolTargets().includes(tool)) {
|
|
@@ -4554,7 +5701,8 @@ async function importCommand(options) {
|
|
|
4554
5701
|
}
|
|
4555
5702
|
let subagentsCreated = 0;
|
|
4556
5703
|
if (config.getFeatures().includes("subagents")) {
|
|
4557
|
-
|
|
5704
|
+
const supportedTargets = SubagentsProcessor.getToolTargets({ includeSimulated: false });
|
|
5705
|
+
if (supportedTargets.includes(tool)) {
|
|
4558
5706
|
const subagentsProcessor = new SubagentsProcessor({
|
|
4559
5707
|
baseDir: ".",
|
|
4560
5708
|
toolTarget: tool
|
|
@@ -4572,8 +5720,8 @@ async function importCommand(options) {
|
|
|
4572
5720
|
}
|
|
4573
5721
|
let commandsCreated = 0;
|
|
4574
5722
|
if (config.getFeatures().includes("commands")) {
|
|
4575
|
-
const supportedTargets = CommandsProcessor.getToolTargets();
|
|
4576
|
-
if (supportedTargets
|
|
5723
|
+
const supportedTargets = CommandsProcessor.getToolTargets({ includeSimulated: false });
|
|
5724
|
+
if (supportedTargets.includes(tool)) {
|
|
4577
5725
|
const commandsProcessor = new CommandsProcessor({
|
|
4578
5726
|
baseDir: ".",
|
|
4579
5727
|
toolTarget: tool
|
|
@@ -4592,7 +5740,7 @@ async function importCommand(options) {
|
|
|
4592
5740
|
}
|
|
4593
5741
|
|
|
4594
5742
|
// src/cli/commands/init.ts
|
|
4595
|
-
import { join as
|
|
5743
|
+
import { join as join54 } from "path";
|
|
4596
5744
|
async function initCommand() {
|
|
4597
5745
|
logger.info("Initializing rulesync...");
|
|
4598
5746
|
await ensureDir(RULESYNC_DIR);
|
|
@@ -4638,9 +5786,9 @@ globs: ["**/*"]
|
|
|
4638
5786
|
- Follow single responsibility principle
|
|
4639
5787
|
`
|
|
4640
5788
|
};
|
|
4641
|
-
const filepath =
|
|
5789
|
+
const filepath = join54(RULESYNC_RULES_DIR, sampleFile.filename);
|
|
4642
5790
|
await ensureDir(RULESYNC_RULES_DIR);
|
|
4643
|
-
await ensureDir(
|
|
5791
|
+
await ensureDir(RulesyncCommand.getSettablePaths().relativeDirPath);
|
|
4644
5792
|
await ensureDir(RULESYNC_SUBAGENTS_DIR);
|
|
4645
5793
|
if (!await fileExists(filepath)) {
|
|
4646
5794
|
await writeFileContent(filepath, sampleFile.content);
|
|
@@ -4656,15 +5804,15 @@ var getVersion = async () => {
|
|
|
4656
5804
|
let packageJsonPath;
|
|
4657
5805
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
4658
5806
|
const __filename = fileURLToPath(import.meta.url);
|
|
4659
|
-
const __dirname =
|
|
4660
|
-
packageJsonPath =
|
|
5807
|
+
const __dirname = join55(__filename, "..");
|
|
5808
|
+
packageJsonPath = join55(__dirname, "../../package.json");
|
|
4661
5809
|
} else {
|
|
4662
|
-
packageJsonPath =
|
|
5810
|
+
packageJsonPath = join55(process.cwd(), "package.json");
|
|
4663
5811
|
}
|
|
4664
5812
|
const packageJson = await readJsonFile(packageJsonPath);
|
|
4665
5813
|
return packageJson.version;
|
|
4666
5814
|
} catch {
|
|
4667
|
-
return "0.
|
|
5815
|
+
return "0.71.0";
|
|
4668
5816
|
}
|
|
4669
5817
|
};
|
|
4670
5818
|
var main = async () => {
|
|
@@ -4690,7 +5838,7 @@ var main = async () => {
|
|
|
4690
5838
|
(value) => {
|
|
4691
5839
|
return value.split(",").map((f) => f.trim());
|
|
4692
5840
|
}
|
|
4693
|
-
).option("--verbose", "Verbose output").action(async (options) => {
|
|
5841
|
+
).option("-V, --verbose", "Verbose output").action(async (options) => {
|
|
4694
5842
|
try {
|
|
4695
5843
|
await importCommand({
|
|
4696
5844
|
targets: options.targets,
|
|
@@ -4718,7 +5866,13 @@ var main = async () => {
|
|
|
4718
5866
|
).option("--delete", "Delete all existing files in output directories before generating").option(
|
|
4719
5867
|
"-b, --base-dir <paths>",
|
|
4720
5868
|
"Base directories to generate files (comma-separated for multiple paths)"
|
|
4721
|
-
).option("-
|
|
5869
|
+
).option("-V, --verbose", "Verbose output").option("-c, --config <path>", "Path to configuration file").option(
|
|
5870
|
+
"--experimental-simulate-commands",
|
|
5871
|
+
"Generate simulated commands (experimental feature). This feature is only available for copilot, cursor and codexcli."
|
|
5872
|
+
).option(
|
|
5873
|
+
"--experimental-simulate-subagents",
|
|
5874
|
+
"Generate simulated subagents (experimental feature). This feature is only available for copilot, cursor and codexcli."
|
|
5875
|
+
).action(async (options) => {
|
|
4722
5876
|
try {
|
|
4723
5877
|
await generateCommand({
|
|
4724
5878
|
targets: options.targets,
|
|
@@ -4726,7 +5880,9 @@ var main = async () => {
|
|
|
4726
5880
|
verbose: options.verbose,
|
|
4727
5881
|
delete: options.delete,
|
|
4728
5882
|
baseDirs: options.baseDirs,
|
|
4729
|
-
configPath: options.config
|
|
5883
|
+
configPath: options.config,
|
|
5884
|
+
experimentalSimulateCommands: options.experimentalSimulateCommands,
|
|
5885
|
+
experimentalSimulateSubagents: options.experimentalSimulateSubagents
|
|
4730
5886
|
});
|
|
4731
5887
|
} catch (error) {
|
|
4732
5888
|
logger.error(error instanceof Error ? error.message : String(error));
|