rulesync 7.23.0 → 7.24.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 +27 -26
- package/dist/{chunk-GAWAOFCL.js → chunk-A4FZT3JT.js} +1703 -813
- package/dist/cli/index.cjs +2209 -1269
- package/dist/cli/index.js +64 -14
- package/dist/index.cjs +1880 -990
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -61,6 +61,7 @@ var ALL_TOOL_TARGETS = [
|
|
|
61
61
|
"qwencode",
|
|
62
62
|
"replit",
|
|
63
63
|
"roo",
|
|
64
|
+
"rovodev",
|
|
64
65
|
"warp",
|
|
65
66
|
"windsurf",
|
|
66
67
|
"zed"
|
|
@@ -75,7 +76,8 @@ import { dirname as dirname2, join as join3, resolve as resolve2 } from "path";
|
|
|
75
76
|
import { parse as parseJsonc } from "jsonc-parser";
|
|
76
77
|
|
|
77
78
|
// src/constants/rulesync-paths.ts
|
|
78
|
-
import {
|
|
79
|
+
import { posix } from "path";
|
|
80
|
+
var { join } = posix;
|
|
79
81
|
var RULESYNC_CONFIG_RELATIVE_FILE_PATH = "rulesync.jsonc";
|
|
80
82
|
var RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH = "rulesync.local.jsonc";
|
|
81
83
|
var RULESYNC_RELATIVE_DIR_PATH = ".rulesync";
|
|
@@ -602,83 +604,19 @@ function getBaseDirsInLightOfGlobal({
|
|
|
602
604
|
}
|
|
603
605
|
|
|
604
606
|
// src/lib/generate.ts
|
|
605
|
-
import { join as
|
|
607
|
+
import { join as join127 } from "path";
|
|
606
608
|
import { intersection } from "es-toolkit";
|
|
607
609
|
|
|
608
610
|
// src/features/commands/commands-processor.ts
|
|
609
611
|
import { basename as basename2, join as join20, relative as relative3 } from "path";
|
|
610
612
|
import { z as z14 } from "zod/mini";
|
|
611
613
|
|
|
612
|
-
// src/
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
baseDir = process.cwd(),
|
|
619
|
-
dryRun = false,
|
|
620
|
-
logger
|
|
621
|
-
}) {
|
|
622
|
-
this.baseDir = baseDir;
|
|
623
|
-
this.dryRun = dryRun;
|
|
624
|
-
this.logger = logger;
|
|
625
|
-
}
|
|
626
|
-
/**
|
|
627
|
-
* Return tool targets that this feature supports.
|
|
628
|
-
*/
|
|
629
|
-
static getToolTargets(_params = {}) {
|
|
630
|
-
throw new Error("Not implemented");
|
|
631
|
-
}
|
|
632
|
-
/**
|
|
633
|
-
* Once converted to rulesync/tool files, write them to the filesystem.
|
|
634
|
-
* Returns the count and paths of files written.
|
|
635
|
-
*/
|
|
636
|
-
async writeAiFiles(aiFiles) {
|
|
637
|
-
let changedCount = 0;
|
|
638
|
-
const changedPaths = [];
|
|
639
|
-
for (const aiFile of aiFiles) {
|
|
640
|
-
const filePath = aiFile.getFilePath();
|
|
641
|
-
const contentWithNewline = addTrailingNewline(aiFile.getFileContent());
|
|
642
|
-
const existingContent = await readFileContentOrNull(filePath);
|
|
643
|
-
if (existingContent === contentWithNewline) {
|
|
644
|
-
continue;
|
|
645
|
-
}
|
|
646
|
-
if (this.dryRun) {
|
|
647
|
-
this.logger.info(`[DRY RUN] Would write: ${filePath}`);
|
|
648
|
-
} else {
|
|
649
|
-
await writeFileContent(filePath, contentWithNewline);
|
|
650
|
-
}
|
|
651
|
-
changedCount++;
|
|
652
|
-
changedPaths.push(aiFile.getRelativePathFromCwd());
|
|
653
|
-
}
|
|
654
|
-
return { count: changedCount, paths: changedPaths };
|
|
655
|
-
}
|
|
656
|
-
async removeAiFiles(aiFiles) {
|
|
657
|
-
for (const aiFile of aiFiles) {
|
|
658
|
-
await removeFile(aiFile.getFilePath());
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
/**
|
|
662
|
-
* Remove orphan files that exist in the tool directory but not in the generated files.
|
|
663
|
-
* This only deletes files that are no longer in the rulesync source, not files that will be overwritten.
|
|
664
|
-
*/
|
|
665
|
-
async removeOrphanAiFiles(existingFiles, generatedFiles) {
|
|
666
|
-
const generatedPaths = new Set(generatedFiles.map((f) => f.getFilePath()));
|
|
667
|
-
const orphanFiles = existingFiles.filter((f) => !generatedPaths.has(f.getFilePath()));
|
|
668
|
-
for (const aiFile of orphanFiles) {
|
|
669
|
-
const filePath = aiFile.getFilePath();
|
|
670
|
-
if (this.dryRun) {
|
|
671
|
-
this.logger.info(`[DRY RUN] Would delete: ${filePath}`);
|
|
672
|
-
} else {
|
|
673
|
-
await removeFile(filePath);
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
return orphanFiles.length;
|
|
677
|
-
}
|
|
678
|
-
};
|
|
679
|
-
|
|
680
|
-
// src/features/commands/agentsmd-command.ts
|
|
681
|
-
import { join as join5 } from "path";
|
|
614
|
+
// src/utils/content-equivalence.ts
|
|
615
|
+
import { extname } from "path";
|
|
616
|
+
import { isDeepStrictEqual } from "util";
|
|
617
|
+
import { load as load2 } from "js-yaml";
|
|
618
|
+
import { parse as parseJsonc2 } from "jsonc-parser";
|
|
619
|
+
import * as smolToml from "smol-toml";
|
|
682
620
|
|
|
683
621
|
// src/utils/frontmatter.ts
|
|
684
622
|
import matter from "gray-matter";
|
|
@@ -791,6 +729,154 @@ function parseFrontmatter(content, filePath) {
|
|
|
791
729
|
return { frontmatter: cleanFrontmatter, body };
|
|
792
730
|
}
|
|
793
731
|
|
|
732
|
+
// src/utils/content-equivalence.ts
|
|
733
|
+
function tryJsonEquivalent(a, b) {
|
|
734
|
+
const errorsA = [];
|
|
735
|
+
const errorsB = [];
|
|
736
|
+
const parsedA = parseJsonc2(a, errorsA);
|
|
737
|
+
const parsedB = parseJsonc2(b, errorsB);
|
|
738
|
+
if (errorsA.length > 0 || errorsB.length > 0) {
|
|
739
|
+
return void 0;
|
|
740
|
+
}
|
|
741
|
+
return isDeepStrictEqual(parsedA, parsedB);
|
|
742
|
+
}
|
|
743
|
+
function tryYamlEquivalent(a, b) {
|
|
744
|
+
try {
|
|
745
|
+
return isDeepStrictEqual(load2(a), load2(b));
|
|
746
|
+
} catch {
|
|
747
|
+
return void 0;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
function tryTomlEquivalent(a, b) {
|
|
751
|
+
try {
|
|
752
|
+
return isDeepStrictEqual(smolToml.parse(a), smolToml.parse(b));
|
|
753
|
+
} catch {
|
|
754
|
+
return void 0;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
function tryMarkdownEquivalent(expected, existing) {
|
|
758
|
+
function normalizeMarkdownBody(body) {
|
|
759
|
+
return addTrailingNewline(body.replace(/^\n+/, ""));
|
|
760
|
+
}
|
|
761
|
+
try {
|
|
762
|
+
const parsedExpected = parseFrontmatter(expected);
|
|
763
|
+
const parsedExisting = parseFrontmatter(existing);
|
|
764
|
+
if (!isDeepStrictEqual(parsedExpected.frontmatter, parsedExisting.frontmatter)) {
|
|
765
|
+
return false;
|
|
766
|
+
}
|
|
767
|
+
return normalizeMarkdownBody(parsedExpected.body) === normalizeMarkdownBody(parsedExisting.body);
|
|
768
|
+
} catch {
|
|
769
|
+
return void 0;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
function tryFileContentsEquivalent(filePath, expected, existing) {
|
|
773
|
+
const ext = extname(filePath).toLowerCase();
|
|
774
|
+
switch (ext) {
|
|
775
|
+
case ".json":
|
|
776
|
+
case ".jsonc":
|
|
777
|
+
return tryJsonEquivalent(expected, existing);
|
|
778
|
+
case ".yaml":
|
|
779
|
+
case ".yml":
|
|
780
|
+
return tryYamlEquivalent(expected, existing);
|
|
781
|
+
case ".toml":
|
|
782
|
+
return tryTomlEquivalent(expected, existing);
|
|
783
|
+
case ".md":
|
|
784
|
+
case ".mdc":
|
|
785
|
+
return tryMarkdownEquivalent(expected, existing);
|
|
786
|
+
default:
|
|
787
|
+
return void 0;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
function fileContentsEquivalent({
|
|
791
|
+
filePath,
|
|
792
|
+
expected,
|
|
793
|
+
existing
|
|
794
|
+
}) {
|
|
795
|
+
if (existing === null) {
|
|
796
|
+
return false;
|
|
797
|
+
}
|
|
798
|
+
const structured = tryFileContentsEquivalent(filePath, expected, existing);
|
|
799
|
+
if (structured !== void 0) {
|
|
800
|
+
return structured;
|
|
801
|
+
}
|
|
802
|
+
return addTrailingNewline(expected) === addTrailingNewline(existing);
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
// src/types/feature-processor.ts
|
|
806
|
+
var FeatureProcessor = class {
|
|
807
|
+
baseDir;
|
|
808
|
+
dryRun;
|
|
809
|
+
logger;
|
|
810
|
+
constructor({
|
|
811
|
+
baseDir = process.cwd(),
|
|
812
|
+
dryRun = false,
|
|
813
|
+
logger
|
|
814
|
+
}) {
|
|
815
|
+
this.baseDir = baseDir;
|
|
816
|
+
this.dryRun = dryRun;
|
|
817
|
+
this.logger = logger;
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* Return tool targets that this feature supports.
|
|
821
|
+
*/
|
|
822
|
+
static getToolTargets(_params = {}) {
|
|
823
|
+
throw new Error("Not implemented");
|
|
824
|
+
}
|
|
825
|
+
/**
|
|
826
|
+
* Once converted to rulesync/tool files, write them to the filesystem.
|
|
827
|
+
* Returns the count and paths of files written.
|
|
828
|
+
*/
|
|
829
|
+
async writeAiFiles(aiFiles) {
|
|
830
|
+
let changedCount = 0;
|
|
831
|
+
const changedPaths = [];
|
|
832
|
+
for (const aiFile of aiFiles) {
|
|
833
|
+
const filePath = aiFile.getFilePath();
|
|
834
|
+
const contentWithNewline = addTrailingNewline(aiFile.getFileContent());
|
|
835
|
+
const existingContent = await readFileContentOrNull(filePath);
|
|
836
|
+
if (fileContentsEquivalent({
|
|
837
|
+
filePath,
|
|
838
|
+
expected: contentWithNewline,
|
|
839
|
+
existing: existingContent
|
|
840
|
+
})) {
|
|
841
|
+
continue;
|
|
842
|
+
}
|
|
843
|
+
if (this.dryRun) {
|
|
844
|
+
this.logger.info(`[DRY RUN] Would write: ${filePath}`);
|
|
845
|
+
} else {
|
|
846
|
+
await writeFileContent(filePath, contentWithNewline);
|
|
847
|
+
}
|
|
848
|
+
changedCount++;
|
|
849
|
+
changedPaths.push(aiFile.getRelativePathFromCwd());
|
|
850
|
+
}
|
|
851
|
+
return { count: changedCount, paths: changedPaths };
|
|
852
|
+
}
|
|
853
|
+
async removeAiFiles(aiFiles) {
|
|
854
|
+
for (const aiFile of aiFiles) {
|
|
855
|
+
await removeFile(aiFile.getFilePath());
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Remove orphan files that exist in the tool directory but not in the generated files.
|
|
860
|
+
* This only deletes files that are no longer in the rulesync source, not files that will be overwritten.
|
|
861
|
+
*/
|
|
862
|
+
async removeOrphanAiFiles(existingFiles, generatedFiles) {
|
|
863
|
+
const generatedPaths = new Set(generatedFiles.map((f) => f.getFilePath()));
|
|
864
|
+
const orphanFiles = existingFiles.filter((f) => !generatedPaths.has(f.getFilePath()));
|
|
865
|
+
for (const aiFile of orphanFiles) {
|
|
866
|
+
const filePath = aiFile.getFilePath();
|
|
867
|
+
if (this.dryRun) {
|
|
868
|
+
this.logger.info(`[DRY RUN] Would delete: ${filePath}`);
|
|
869
|
+
} else {
|
|
870
|
+
await removeFile(filePath);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
return orphanFiles.length;
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
|
|
877
|
+
// src/features/commands/agentsmd-command.ts
|
|
878
|
+
import { join as join5 } from "path";
|
|
879
|
+
|
|
794
880
|
// src/features/commands/simulated-command.ts
|
|
795
881
|
import { join as join4 } from "path";
|
|
796
882
|
import { z as z4 } from "zod/mini";
|
|
@@ -859,7 +945,7 @@ var AiFile = class {
|
|
|
859
945
|
return this.fileContent;
|
|
860
946
|
}
|
|
861
947
|
getRelativePathFromCwd() {
|
|
862
|
-
return path.join(this.relativeDirPath, this.relativeFilePath);
|
|
948
|
+
return path.join(this.relativeDirPath, this.relativeFilePath).replace(/\\/g, "/");
|
|
863
949
|
}
|
|
864
950
|
setFileContent(newFileContent) {
|
|
865
951
|
this.fileContent = newFileContent;
|
|
@@ -6057,6 +6143,9 @@ var McpServerSchema = z20.looseObject({
|
|
|
6057
6143
|
disabledTools: z20.optional(z20.array(z20.string()))
|
|
6058
6144
|
});
|
|
6059
6145
|
var McpServersSchema = z20.record(z20.string(), McpServerSchema);
|
|
6146
|
+
function isMcpServers(value) {
|
|
6147
|
+
return value !== void 0 && value !== null && typeof value === "object" && !Array.isArray(value);
|
|
6148
|
+
}
|
|
6060
6149
|
|
|
6061
6150
|
// src/features/mcp/rulesync-mcp.ts
|
|
6062
6151
|
var RulesyncMcpServerSchema = z21.extend(McpServerSchema, {
|
|
@@ -6396,7 +6485,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
6396
6485
|
|
|
6397
6486
|
// src/features/mcp/codexcli-mcp.ts
|
|
6398
6487
|
import { join as join46 } from "path";
|
|
6399
|
-
import * as
|
|
6488
|
+
import * as smolToml2 from "smol-toml";
|
|
6400
6489
|
function convertFromCodexFormat(codexMcp) {
|
|
6401
6490
|
const result = {};
|
|
6402
6491
|
for (const [name, config] of Object.entries(codexMcp)) {
|
|
@@ -6449,7 +6538,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
6449
6538
|
...rest,
|
|
6450
6539
|
validate: false
|
|
6451
6540
|
});
|
|
6452
|
-
this.toml =
|
|
6541
|
+
this.toml = smolToml2.parse(this.fileContent);
|
|
6453
6542
|
if (rest.validate) {
|
|
6454
6543
|
const result = this.validate();
|
|
6455
6544
|
if (!result.success) {
|
|
@@ -6478,7 +6567,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
6478
6567
|
global = false
|
|
6479
6568
|
}) {
|
|
6480
6569
|
const paths = this.getSettablePaths({ global });
|
|
6481
|
-
const fileContent = await readFileContentOrNull(join46(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ??
|
|
6570
|
+
const fileContent = await readFileContentOrNull(join46(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? smolToml2.stringify({});
|
|
6482
6571
|
return new _CodexcliMcp({
|
|
6483
6572
|
baseDir,
|
|
6484
6573
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -6497,9 +6586,9 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
6497
6586
|
const configTomlFilePath = join46(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
6498
6587
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
6499
6588
|
configTomlFilePath,
|
|
6500
|
-
|
|
6589
|
+
smolToml2.stringify({})
|
|
6501
6590
|
);
|
|
6502
|
-
const configToml =
|
|
6591
|
+
const configToml = smolToml2.parse(configTomlFileContent);
|
|
6503
6592
|
const mcpServers = rulesyncMcp.getJson().mcpServers;
|
|
6504
6593
|
const converted = convertToCodexFormat(mcpServers);
|
|
6505
6594
|
const filteredMcpServers = this.removeEmptyEntries(converted);
|
|
@@ -6508,7 +6597,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
6508
6597
|
baseDir,
|
|
6509
6598
|
relativeDirPath: paths.relativeDirPath,
|
|
6510
6599
|
relativeFilePath: paths.relativeFilePath,
|
|
6511
|
-
fileContent:
|
|
6600
|
+
fileContent: smolToml2.stringify(configToml),
|
|
6512
6601
|
validate
|
|
6513
6602
|
});
|
|
6514
6603
|
}
|
|
@@ -6767,9 +6856,6 @@ var CopilotcliMcp = class _CopilotcliMcp extends ToolMcp {
|
|
|
6767
6856
|
// src/features/mcp/cursor-mcp.ts
|
|
6768
6857
|
import { join as join49 } from "path";
|
|
6769
6858
|
var CURSOR_ENV_VAR_PATTERN = /\$\{env:([^}]+)\}/g;
|
|
6770
|
-
function isMcpServers(value) {
|
|
6771
|
-
return value !== void 0 && value !== null && typeof value === "object";
|
|
6772
|
-
}
|
|
6773
6859
|
function convertEnvFromCursorFormat(mcpServers) {
|
|
6774
6860
|
return Object.fromEntries(
|
|
6775
6861
|
Object.entries(mcpServers).map(([name, config]) => [
|
|
@@ -7386,7 +7472,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
7386
7472
|
|
|
7387
7473
|
// src/features/mcp/opencode-mcp.ts
|
|
7388
7474
|
import { join as join56 } from "path";
|
|
7389
|
-
import { parse as
|
|
7475
|
+
import { parse as parseJsonc3 } from "jsonc-parser";
|
|
7390
7476
|
import { z as z22 } from "zod/mini";
|
|
7391
7477
|
var OpencodeMcpLocalServerSchema = z22.object({
|
|
7392
7478
|
type: z22.literal("local"),
|
|
@@ -7512,7 +7598,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7512
7598
|
json;
|
|
7513
7599
|
constructor(params) {
|
|
7514
7600
|
super(params);
|
|
7515
|
-
this.json = OpencodeConfigSchema.parse(
|
|
7601
|
+
this.json = OpencodeConfigSchema.parse(parseJsonc3(this.fileContent || "{}"));
|
|
7516
7602
|
}
|
|
7517
7603
|
getJson() {
|
|
7518
7604
|
return this.json;
|
|
@@ -7554,7 +7640,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7554
7640
|
}
|
|
7555
7641
|
}
|
|
7556
7642
|
const fileContentToUse = fileContent ?? '{"mcp":{}}';
|
|
7557
|
-
const json =
|
|
7643
|
+
const json = parseJsonc3(fileContentToUse);
|
|
7558
7644
|
const newJson = { ...json, mcp: json.mcp ?? {} };
|
|
7559
7645
|
return new _OpencodeMcp({
|
|
7560
7646
|
baseDir,
|
|
@@ -7586,7 +7672,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7586
7672
|
if (!fileContent) {
|
|
7587
7673
|
fileContent = JSON.stringify({ mcp: {} }, null, 2);
|
|
7588
7674
|
}
|
|
7589
|
-
const json =
|
|
7675
|
+
const json = parseJsonc3(fileContent);
|
|
7590
7676
|
const { mcp: convertedMcp, tools: mcpTools } = convertToOpencodeFormat(
|
|
7591
7677
|
rulesyncMcp.getMcpServers()
|
|
7592
7678
|
);
|
|
@@ -7637,9 +7723,6 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7637
7723
|
|
|
7638
7724
|
// src/features/mcp/roo-mcp.ts
|
|
7639
7725
|
import { join as join57 } from "path";
|
|
7640
|
-
function isRooMcpServers(value) {
|
|
7641
|
-
return value !== void 0 && value !== null && typeof value === "object";
|
|
7642
|
-
}
|
|
7643
7726
|
function convertToRooFormat(mcpServers) {
|
|
7644
7727
|
return Object.fromEntries(
|
|
7645
7728
|
Object.entries(mcpServers).map(([serverName, serverConfig]) => {
|
|
@@ -7655,13 +7738,16 @@ function convertToRooFormat(mcpServers) {
|
|
|
7655
7738
|
);
|
|
7656
7739
|
}
|
|
7657
7740
|
function convertFromRooFormat(mcpServers) {
|
|
7741
|
+
if (!isMcpServers(mcpServers)) {
|
|
7742
|
+
return {};
|
|
7743
|
+
}
|
|
7658
7744
|
return Object.fromEntries(
|
|
7659
7745
|
Object.entries(mcpServers).map(([serverName, serverConfig]) => {
|
|
7660
|
-
const converted =
|
|
7661
|
-
if (
|
|
7746
|
+
const converted = typeof serverConfig === "object" && serverConfig !== null && !Array.isArray(serverConfig) ? Object.fromEntries(Object.entries(serverConfig)) : {};
|
|
7747
|
+
if (converted.type === "streamable-http") {
|
|
7662
7748
|
converted.type = "http";
|
|
7663
7749
|
}
|
|
7664
|
-
if (
|
|
7750
|
+
if (converted.transport === "streamable-http") {
|
|
7665
7751
|
converted.transport = "http";
|
|
7666
7752
|
}
|
|
7667
7753
|
return [serverName, converted];
|
|
@@ -7719,8 +7805,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
7719
7805
|
});
|
|
7720
7806
|
}
|
|
7721
7807
|
toRulesyncMcp() {
|
|
7722
|
-
const
|
|
7723
|
-
const convertedMcpServers = convertFromRooFormat(rawMcpServers);
|
|
7808
|
+
const convertedMcpServers = convertFromRooFormat(this.json.mcpServers);
|
|
7724
7809
|
return this.toRulesyncMcpDefault({
|
|
7725
7810
|
fileContent: JSON.stringify({ mcpServers: convertedMcpServers }, null, 2)
|
|
7726
7811
|
});
|
|
@@ -7743,48 +7828,167 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
7743
7828
|
}
|
|
7744
7829
|
};
|
|
7745
7830
|
|
|
7746
|
-
// src/features/mcp/mcp
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
}
|
|
7831
|
+
// src/features/mcp/rovodev-mcp.ts
|
|
7832
|
+
import { join as join58 } from "path";
|
|
7833
|
+
function parseRovodevMcpJson(fileContent, relativeDirPath, relativeFilePath) {
|
|
7834
|
+
const configPath = join58(relativeDirPath, relativeFilePath);
|
|
7835
|
+
let parsed;
|
|
7836
|
+
try {
|
|
7837
|
+
parsed = JSON.parse(fileContent);
|
|
7838
|
+
} catch (error) {
|
|
7839
|
+
throw new Error(`Failed to parse Rovodev MCP config at ${configPath}: ${formatError(error)}`, {
|
|
7840
|
+
cause: error
|
|
7841
|
+
});
|
|
7842
|
+
}
|
|
7843
|
+
if (!isRecord(parsed)) {
|
|
7844
|
+
throw new Error(`Failed to parse Rovodev MCP config at ${configPath}: expected a JSON object`);
|
|
7845
|
+
}
|
|
7846
|
+
return parsed;
|
|
7847
|
+
}
|
|
7848
|
+
var RovodevMcp = class _RovodevMcp extends ToolMcp {
|
|
7849
|
+
json;
|
|
7850
|
+
constructor(params) {
|
|
7851
|
+
super(params);
|
|
7852
|
+
if (this.fileContent !== void 0) {
|
|
7853
|
+
this.json = parseRovodevMcpJson(
|
|
7854
|
+
this.fileContent,
|
|
7855
|
+
this.relativeDirPath,
|
|
7856
|
+
this.relativeFilePath
|
|
7857
|
+
);
|
|
7858
|
+
} else {
|
|
7859
|
+
this.json = {};
|
|
7776
7860
|
}
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
|
|
7861
|
+
}
|
|
7862
|
+
getJson() {
|
|
7863
|
+
return this.json;
|
|
7864
|
+
}
|
|
7865
|
+
isDeletable() {
|
|
7866
|
+
return false;
|
|
7867
|
+
}
|
|
7868
|
+
static getSettablePaths(_options) {
|
|
7869
|
+
return {
|
|
7870
|
+
relativeDirPath: ".rovodev",
|
|
7871
|
+
relativeFilePath: "mcp.json"
|
|
7872
|
+
};
|
|
7873
|
+
}
|
|
7874
|
+
static async fromFile({
|
|
7875
|
+
baseDir = process.cwd(),
|
|
7876
|
+
validate = true,
|
|
7877
|
+
global = false
|
|
7878
|
+
}) {
|
|
7879
|
+
if (!global) {
|
|
7880
|
+
throw new Error("Rovodev MCP is global-only; use --global to sync ~/.rovodev/mcp.json");
|
|
7881
|
+
}
|
|
7882
|
+
const paths = this.getSettablePaths({ global });
|
|
7883
|
+
const filePath = join58(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
7884
|
+
const fileContent = await readFileContentOrNull(filePath) ?? '{"mcpServers":{}}';
|
|
7885
|
+
const json = parseRovodevMcpJson(fileContent, paths.relativeDirPath, paths.relativeFilePath);
|
|
7886
|
+
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
7887
|
+
return new _RovodevMcp({
|
|
7888
|
+
baseDir,
|
|
7889
|
+
relativeDirPath: paths.relativeDirPath,
|
|
7890
|
+
relativeFilePath: paths.relativeFilePath,
|
|
7891
|
+
fileContent: JSON.stringify(newJson, null, 2),
|
|
7892
|
+
validate,
|
|
7893
|
+
global
|
|
7894
|
+
});
|
|
7895
|
+
}
|
|
7896
|
+
static async fromRulesyncMcp({
|
|
7897
|
+
baseDir = process.cwd(),
|
|
7898
|
+
rulesyncMcp,
|
|
7899
|
+
validate = true,
|
|
7900
|
+
global = false
|
|
7901
|
+
}) {
|
|
7902
|
+
if (!global) {
|
|
7903
|
+
throw new Error("Rovodev MCP is global-only; use --global to sync ~/.rovodev/mcp.json");
|
|
7904
|
+
}
|
|
7905
|
+
const paths = this.getSettablePaths({ global });
|
|
7906
|
+
const fileContent = await readOrInitializeFileContent(
|
|
7907
|
+
join58(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
7908
|
+
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
7909
|
+
);
|
|
7910
|
+
const json = parseRovodevMcpJson(fileContent, paths.relativeDirPath, paths.relativeFilePath);
|
|
7911
|
+
const rulesyncJson = rulesyncMcp.getJson();
|
|
7912
|
+
const mcpServers = isMcpServers(rulesyncJson.mcpServers) ? rulesyncJson.mcpServers : {};
|
|
7913
|
+
const rovodevConfig = { ...json, mcpServers };
|
|
7914
|
+
return new _RovodevMcp({
|
|
7915
|
+
baseDir,
|
|
7916
|
+
relativeDirPath: paths.relativeDirPath,
|
|
7917
|
+
relativeFilePath: paths.relativeFilePath,
|
|
7918
|
+
fileContent: JSON.stringify(rovodevConfig, null, 2),
|
|
7919
|
+
validate,
|
|
7920
|
+
global
|
|
7921
|
+
});
|
|
7922
|
+
}
|
|
7923
|
+
toRulesyncMcp() {
|
|
7924
|
+
const mcpServers = isMcpServers(this.json.mcpServers) ? this.json.mcpServers : {};
|
|
7925
|
+
return this.toRulesyncMcpDefault({
|
|
7926
|
+
fileContent: JSON.stringify({ mcpServers }, null, 2)
|
|
7927
|
+
});
|
|
7928
|
+
}
|
|
7929
|
+
validate() {
|
|
7930
|
+
return { success: true, error: null };
|
|
7931
|
+
}
|
|
7932
|
+
static forDeletion({
|
|
7933
|
+
baseDir = process.cwd(),
|
|
7934
|
+
relativeDirPath,
|
|
7935
|
+
relativeFilePath,
|
|
7936
|
+
global = false
|
|
7937
|
+
}) {
|
|
7938
|
+
return new _RovodevMcp({
|
|
7939
|
+
baseDir,
|
|
7940
|
+
relativeDirPath,
|
|
7941
|
+
relativeFilePath,
|
|
7942
|
+
fileContent: "{}",
|
|
7943
|
+
validate: false,
|
|
7944
|
+
global
|
|
7945
|
+
});
|
|
7946
|
+
}
|
|
7947
|
+
};
|
|
7948
|
+
|
|
7949
|
+
// src/features/mcp/mcp-processor.ts
|
|
7950
|
+
var mcpProcessorToolTargetTuple = [
|
|
7951
|
+
"claudecode",
|
|
7952
|
+
"claudecode-legacy",
|
|
7953
|
+
"cline",
|
|
7954
|
+
"codexcli",
|
|
7955
|
+
"copilot",
|
|
7956
|
+
"copilotcli",
|
|
7957
|
+
"cursor",
|
|
7958
|
+
"deepagents",
|
|
7959
|
+
"factorydroid",
|
|
7960
|
+
"geminicli",
|
|
7961
|
+
"kilo",
|
|
7962
|
+
"kiro",
|
|
7963
|
+
"junie",
|
|
7964
|
+
"opencode",
|
|
7965
|
+
"roo",
|
|
7966
|
+
"rovodev"
|
|
7967
|
+
];
|
|
7968
|
+
var McpProcessorToolTargetSchema = z23.enum(mcpProcessorToolTargetTuple);
|
|
7969
|
+
var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
7970
|
+
[
|
|
7971
|
+
"claudecode",
|
|
7972
|
+
{
|
|
7973
|
+
class: ClaudecodeMcp,
|
|
7974
|
+
meta: {
|
|
7975
|
+
supportsProject: true,
|
|
7976
|
+
supportsGlobal: true,
|
|
7977
|
+
supportsEnabledTools: false,
|
|
7978
|
+
supportsDisabledTools: false
|
|
7979
|
+
}
|
|
7980
|
+
}
|
|
7981
|
+
],
|
|
7982
|
+
[
|
|
7983
|
+
"claudecode-legacy",
|
|
7984
|
+
{
|
|
7985
|
+
class: ClaudecodeMcp,
|
|
7986
|
+
meta: {
|
|
7987
|
+
supportsProject: true,
|
|
7988
|
+
supportsGlobal: true,
|
|
7989
|
+
supportsEnabledTools: false,
|
|
7990
|
+
supportsDisabledTools: false
|
|
7991
|
+
}
|
|
7788
7992
|
}
|
|
7789
7993
|
],
|
|
7790
7994
|
[
|
|
@@ -7942,6 +8146,18 @@ var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
|
7942
8146
|
supportsDisabledTools: false
|
|
7943
8147
|
}
|
|
7944
8148
|
}
|
|
8149
|
+
],
|
|
8150
|
+
[
|
|
8151
|
+
"rovodev",
|
|
8152
|
+
{
|
|
8153
|
+
class: RovodevMcp,
|
|
8154
|
+
meta: {
|
|
8155
|
+
supportsProject: false,
|
|
8156
|
+
supportsGlobal: true,
|
|
8157
|
+
supportsEnabledTools: false,
|
|
8158
|
+
supportsDisabledTools: false
|
|
8159
|
+
}
|
|
8160
|
+
}
|
|
7945
8161
|
]
|
|
7946
8162
|
]);
|
|
7947
8163
|
var allToolTargetKeys2 = [...toolMcpFactories.keys()];
|
|
@@ -8088,25 +8304,25 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
8088
8304
|
};
|
|
8089
8305
|
|
|
8090
8306
|
// src/features/rules/rules-processor.ts
|
|
8091
|
-
import { basename as basename10, dirname as dirname3, join as
|
|
8307
|
+
import { basename as basename10, dirname as dirname3, join as join126, relative as relative5 } from "path";
|
|
8092
8308
|
import { encode } from "@toon-format/toon";
|
|
8093
|
-
import { z as
|
|
8309
|
+
import { z as z61 } from "zod/mini";
|
|
8094
8310
|
|
|
8095
8311
|
// src/constants/general.ts
|
|
8096
8312
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
8097
8313
|
|
|
8098
8314
|
// src/features/skills/agentsmd-skill.ts
|
|
8099
|
-
import { join as
|
|
8315
|
+
import { join as join62 } from "path";
|
|
8100
8316
|
|
|
8101
8317
|
// src/features/skills/simulated-skill.ts
|
|
8102
|
-
import { join as
|
|
8318
|
+
import { join as join61 } from "path";
|
|
8103
8319
|
import { z as z24 } from "zod/mini";
|
|
8104
8320
|
|
|
8105
8321
|
// src/features/skills/tool-skill.ts
|
|
8106
|
-
import { join as
|
|
8322
|
+
import { join as join60 } from "path";
|
|
8107
8323
|
|
|
8108
8324
|
// src/types/ai-dir.ts
|
|
8109
|
-
import path2, { basename as basename3, join as
|
|
8325
|
+
import path2, { basename as basename3, join as join59, relative as relative4, resolve as resolve4 } from "path";
|
|
8110
8326
|
var AiDir = class {
|
|
8111
8327
|
/**
|
|
8112
8328
|
* @example "."
|
|
@@ -8181,7 +8397,7 @@ var AiDir = class {
|
|
|
8181
8397
|
return this.otherFiles;
|
|
8182
8398
|
}
|
|
8183
8399
|
getRelativePathFromCwd() {
|
|
8184
|
-
return path2.join(this.relativeDirPath, this.dirName);
|
|
8400
|
+
return path2.join(this.relativeDirPath, this.dirName).replace(/\\/g, "/");
|
|
8185
8401
|
}
|
|
8186
8402
|
getGlobal() {
|
|
8187
8403
|
return this.global;
|
|
@@ -8200,8 +8416,8 @@ var AiDir = class {
|
|
|
8200
8416
|
* @returns Array of files with their relative paths and buffers
|
|
8201
8417
|
*/
|
|
8202
8418
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
8203
|
-
const dirPath =
|
|
8204
|
-
const glob =
|
|
8419
|
+
const dirPath = join59(baseDir, relativeDirPath, dirName);
|
|
8420
|
+
const glob = join59(dirPath, "**", "*");
|
|
8205
8421
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
8206
8422
|
const filteredPaths = filePaths.filter((filePath) => basename3(filePath) !== excludeFileName);
|
|
8207
8423
|
const files = await Promise.all(
|
|
@@ -8218,6 +8434,9 @@ var AiDir = class {
|
|
|
8218
8434
|
};
|
|
8219
8435
|
|
|
8220
8436
|
// src/features/skills/tool-skill.ts
|
|
8437
|
+
function toolSkillSearchRoots(paths) {
|
|
8438
|
+
return [paths.relativeDirPath, ...paths.alternativeSkillRoots ?? []];
|
|
8439
|
+
}
|
|
8221
8440
|
var ToolSkill = class extends AiDir {
|
|
8222
8441
|
/**
|
|
8223
8442
|
* Get the settable paths for this tool's skill directories.
|
|
@@ -8299,8 +8518,8 @@ var ToolSkill = class extends AiDir {
|
|
|
8299
8518
|
}) {
|
|
8300
8519
|
const settablePaths = getSettablePaths({ global });
|
|
8301
8520
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
8302
|
-
const skillDirPath =
|
|
8303
|
-
const skillFilePath =
|
|
8521
|
+
const skillDirPath = join60(baseDir, actualRelativeDirPath, dirName);
|
|
8522
|
+
const skillFilePath = join60(skillDirPath, SKILL_FILE_NAME);
|
|
8304
8523
|
if (!await fileExists(skillFilePath)) {
|
|
8305
8524
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
8306
8525
|
}
|
|
@@ -8324,7 +8543,7 @@ var ToolSkill = class extends AiDir {
|
|
|
8324
8543
|
}
|
|
8325
8544
|
requireMainFileFrontmatter() {
|
|
8326
8545
|
if (!this.mainFile?.frontmatter) {
|
|
8327
|
-
throw new Error(`Frontmatter is not defined in ${
|
|
8546
|
+
throw new Error(`Frontmatter is not defined in ${join60(this.relativeDirPath, this.dirName)}`);
|
|
8328
8547
|
}
|
|
8329
8548
|
return this.mainFile.frontmatter;
|
|
8330
8549
|
}
|
|
@@ -8364,7 +8583,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
8364
8583
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
8365
8584
|
if (!result.success) {
|
|
8366
8585
|
throw new Error(
|
|
8367
|
-
`Invalid frontmatter in ${
|
|
8586
|
+
`Invalid frontmatter in ${join61(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
8368
8587
|
);
|
|
8369
8588
|
}
|
|
8370
8589
|
}
|
|
@@ -8423,8 +8642,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
8423
8642
|
}) {
|
|
8424
8643
|
const settablePaths = this.getSettablePaths();
|
|
8425
8644
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
8426
|
-
const skillDirPath =
|
|
8427
|
-
const skillFilePath =
|
|
8645
|
+
const skillDirPath = join61(baseDir, actualRelativeDirPath, dirName);
|
|
8646
|
+
const skillFilePath = join61(skillDirPath, SKILL_FILE_NAME);
|
|
8428
8647
|
if (!await fileExists(skillFilePath)) {
|
|
8429
8648
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
8430
8649
|
}
|
|
@@ -8501,7 +8720,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
8501
8720
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
8502
8721
|
}
|
|
8503
8722
|
return {
|
|
8504
|
-
relativeDirPath:
|
|
8723
|
+
relativeDirPath: join62(".agents", "skills")
|
|
8505
8724
|
};
|
|
8506
8725
|
}
|
|
8507
8726
|
static async fromDir(params) {
|
|
@@ -8528,11 +8747,11 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
8528
8747
|
};
|
|
8529
8748
|
|
|
8530
8749
|
// src/features/skills/factorydroid-skill.ts
|
|
8531
|
-
import { join as
|
|
8750
|
+
import { join as join63 } from "path";
|
|
8532
8751
|
var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
8533
8752
|
static getSettablePaths(_options) {
|
|
8534
8753
|
return {
|
|
8535
|
-
relativeDirPath:
|
|
8754
|
+
relativeDirPath: join63(".factory", "skills")
|
|
8536
8755
|
};
|
|
8537
8756
|
}
|
|
8538
8757
|
static async fromDir(params) {
|
|
@@ -8558,138 +8777,7 @@ var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
|
8558
8777
|
}
|
|
8559
8778
|
};
|
|
8560
8779
|
|
|
8561
|
-
// src/features/skills/
|
|
8562
|
-
import { basename as basename5, join as join81 } from "path";
|
|
8563
|
-
import { z as z41 } from "zod/mini";
|
|
8564
|
-
|
|
8565
|
-
// src/types/dir-feature-processor.ts
|
|
8566
|
-
import { join as join63 } from "path";
|
|
8567
|
-
var DirFeatureProcessor = class {
|
|
8568
|
-
baseDir;
|
|
8569
|
-
dryRun;
|
|
8570
|
-
avoidBlockScalars;
|
|
8571
|
-
logger;
|
|
8572
|
-
constructor({
|
|
8573
|
-
baseDir = process.cwd(),
|
|
8574
|
-
dryRun = false,
|
|
8575
|
-
avoidBlockScalars = false,
|
|
8576
|
-
logger
|
|
8577
|
-
}) {
|
|
8578
|
-
this.baseDir = baseDir;
|
|
8579
|
-
this.dryRun = dryRun;
|
|
8580
|
-
this.avoidBlockScalars = avoidBlockScalars;
|
|
8581
|
-
this.logger = logger;
|
|
8582
|
-
}
|
|
8583
|
-
/**
|
|
8584
|
-
* Return tool targets that this feature supports.
|
|
8585
|
-
*/
|
|
8586
|
-
static getToolTargets(_params = {}) {
|
|
8587
|
-
throw new Error("Not implemented");
|
|
8588
|
-
}
|
|
8589
|
-
/**
|
|
8590
|
-
* Once converted to rulesync/tool dirs, write them to the filesystem.
|
|
8591
|
-
* Returns the number of directories written.
|
|
8592
|
-
*
|
|
8593
|
-
* Note: This method uses directory-level change detection. If any file within
|
|
8594
|
-
* a directory has changed, ALL files in that directory are rewritten. This is
|
|
8595
|
-
* an intentional design decision to ensure consistency within directory units.
|
|
8596
|
-
*/
|
|
8597
|
-
async writeAiDirs(aiDirs) {
|
|
8598
|
-
let changedCount = 0;
|
|
8599
|
-
const changedPaths = [];
|
|
8600
|
-
for (const aiDir of aiDirs) {
|
|
8601
|
-
const dirPath = aiDir.getDirPath();
|
|
8602
|
-
let dirHasChanges = false;
|
|
8603
|
-
const mainFile = aiDir.getMainFile();
|
|
8604
|
-
let mainFileContent;
|
|
8605
|
-
if (mainFile) {
|
|
8606
|
-
const mainFilePath = join63(dirPath, mainFile.name);
|
|
8607
|
-
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter, {
|
|
8608
|
-
avoidBlockScalars: this.avoidBlockScalars
|
|
8609
|
-
});
|
|
8610
|
-
mainFileContent = addTrailingNewline(content);
|
|
8611
|
-
const existingContent = await readFileContentOrNull(mainFilePath);
|
|
8612
|
-
if (existingContent !== mainFileContent) {
|
|
8613
|
-
dirHasChanges = true;
|
|
8614
|
-
}
|
|
8615
|
-
}
|
|
8616
|
-
const otherFiles = aiDir.getOtherFiles();
|
|
8617
|
-
const otherFileContents = [];
|
|
8618
|
-
for (const file of otherFiles) {
|
|
8619
|
-
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
8620
|
-
otherFileContents.push(contentWithNewline);
|
|
8621
|
-
if (!dirHasChanges) {
|
|
8622
|
-
const filePath = join63(dirPath, file.relativeFilePathToDirPath);
|
|
8623
|
-
const existingContent = await readFileContentOrNull(filePath);
|
|
8624
|
-
if (existingContent !== contentWithNewline) {
|
|
8625
|
-
dirHasChanges = true;
|
|
8626
|
-
}
|
|
8627
|
-
}
|
|
8628
|
-
}
|
|
8629
|
-
if (!dirHasChanges) {
|
|
8630
|
-
continue;
|
|
8631
|
-
}
|
|
8632
|
-
const relativeDir = aiDir.getRelativePathFromCwd();
|
|
8633
|
-
if (this.dryRun) {
|
|
8634
|
-
this.logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
|
|
8635
|
-
if (mainFile) {
|
|
8636
|
-
this.logger.info(`[DRY RUN] Would write: ${join63(dirPath, mainFile.name)}`);
|
|
8637
|
-
changedPaths.push(join63(relativeDir, mainFile.name));
|
|
8638
|
-
}
|
|
8639
|
-
for (const file of otherFiles) {
|
|
8640
|
-
this.logger.info(
|
|
8641
|
-
`[DRY RUN] Would write: ${join63(dirPath, file.relativeFilePathToDirPath)}`
|
|
8642
|
-
);
|
|
8643
|
-
changedPaths.push(join63(relativeDir, file.relativeFilePathToDirPath));
|
|
8644
|
-
}
|
|
8645
|
-
} else {
|
|
8646
|
-
await ensureDir(dirPath);
|
|
8647
|
-
if (mainFile && mainFileContent) {
|
|
8648
|
-
const mainFilePath = join63(dirPath, mainFile.name);
|
|
8649
|
-
await writeFileContent(mainFilePath, mainFileContent);
|
|
8650
|
-
changedPaths.push(join63(relativeDir, mainFile.name));
|
|
8651
|
-
}
|
|
8652
|
-
for (const [i, file] of otherFiles.entries()) {
|
|
8653
|
-
const filePath = join63(dirPath, file.relativeFilePathToDirPath);
|
|
8654
|
-
const content = otherFileContents[i];
|
|
8655
|
-
if (content === void 0) {
|
|
8656
|
-
throw new Error(
|
|
8657
|
-
`Internal error: content for file ${file.relativeFilePathToDirPath} is undefined. This indicates a synchronization issue between otherFiles and otherFileContents arrays.`
|
|
8658
|
-
);
|
|
8659
|
-
}
|
|
8660
|
-
await writeFileContent(filePath, content);
|
|
8661
|
-
changedPaths.push(join63(relativeDir, file.relativeFilePathToDirPath));
|
|
8662
|
-
}
|
|
8663
|
-
}
|
|
8664
|
-
changedCount++;
|
|
8665
|
-
}
|
|
8666
|
-
return { count: changedCount, paths: changedPaths };
|
|
8667
|
-
}
|
|
8668
|
-
async removeAiDirs(aiDirs) {
|
|
8669
|
-
for (const aiDir of aiDirs) {
|
|
8670
|
-
await removeDirectory(aiDir.getDirPath());
|
|
8671
|
-
}
|
|
8672
|
-
}
|
|
8673
|
-
/**
|
|
8674
|
-
* Remove orphan directories that exist in the tool directory but not in the generated directories.
|
|
8675
|
-
* This only deletes directories that are no longer in the rulesync source, not directories that will be overwritten.
|
|
8676
|
-
*/
|
|
8677
|
-
async removeOrphanAiDirs(existingDirs, generatedDirs) {
|
|
8678
|
-
const generatedPaths = new Set(generatedDirs.map((d) => d.getDirPath()));
|
|
8679
|
-
const orphanDirs = existingDirs.filter((d) => !generatedPaths.has(d.getDirPath()));
|
|
8680
|
-
for (const aiDir of orphanDirs) {
|
|
8681
|
-
const dirPath = aiDir.getDirPath();
|
|
8682
|
-
if (this.dryRun) {
|
|
8683
|
-
this.logger.info(`[DRY RUN] Would delete directory: ${dirPath}`);
|
|
8684
|
-
} else {
|
|
8685
|
-
await removeDirectory(dirPath);
|
|
8686
|
-
}
|
|
8687
|
-
}
|
|
8688
|
-
return orphanDirs.length;
|
|
8689
|
-
}
|
|
8690
|
-
};
|
|
8691
|
-
|
|
8692
|
-
// src/features/skills/agentsskills-skill.ts
|
|
8780
|
+
// src/features/skills/rovodev-skill.ts
|
|
8693
8781
|
import { join as join65 } from "path";
|
|
8694
8782
|
import { z as z26 } from "zod/mini";
|
|
8695
8783
|
|
|
@@ -8761,78 +8849,392 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
8761
8849
|
}
|
|
8762
8850
|
}
|
|
8763
8851
|
}
|
|
8764
|
-
static getSettablePaths() {
|
|
8765
|
-
return {
|
|
8766
|
-
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH
|
|
8767
|
-
};
|
|
8768
|
-
}
|
|
8769
|
-
getFrontmatter() {
|
|
8770
|
-
if (!this.mainFile?.frontmatter) {
|
|
8771
|
-
throw new Error(`Frontmatter is not defined in ${join64(this.relativeDirPath, this.dirName)}`);
|
|
8772
|
-
}
|
|
8773
|
-
const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
8774
|
-
return result;
|
|
8775
|
-
}
|
|
8776
|
-
getBody() {
|
|
8777
|
-
return this.mainFile?.body ?? "";
|
|
8778
|
-
}
|
|
8779
|
-
validate() {
|
|
8780
|
-
const result = RulesyncSkillFrontmatterSchema.safeParse(this.mainFile?.frontmatter);
|
|
8781
|
-
if (!result.success) {
|
|
8782
|
-
return {
|
|
8783
|
-
success: false,
|
|
8784
|
-
error: new Error(
|
|
8785
|
-
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
8786
|
-
)
|
|
8787
|
-
};
|
|
8852
|
+
static getSettablePaths() {
|
|
8853
|
+
return {
|
|
8854
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH
|
|
8855
|
+
};
|
|
8856
|
+
}
|
|
8857
|
+
getFrontmatter() {
|
|
8858
|
+
if (!this.mainFile?.frontmatter) {
|
|
8859
|
+
throw new Error(`Frontmatter is not defined in ${join64(this.relativeDirPath, this.dirName)}`);
|
|
8860
|
+
}
|
|
8861
|
+
const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
8862
|
+
return result;
|
|
8863
|
+
}
|
|
8864
|
+
getBody() {
|
|
8865
|
+
return this.mainFile?.body ?? "";
|
|
8866
|
+
}
|
|
8867
|
+
validate() {
|
|
8868
|
+
const result = RulesyncSkillFrontmatterSchema.safeParse(this.mainFile?.frontmatter);
|
|
8869
|
+
if (!result.success) {
|
|
8870
|
+
return {
|
|
8871
|
+
success: false,
|
|
8872
|
+
error: new Error(
|
|
8873
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
8874
|
+
)
|
|
8875
|
+
};
|
|
8876
|
+
}
|
|
8877
|
+
return { success: true, error: null };
|
|
8878
|
+
}
|
|
8879
|
+
static async fromDir({
|
|
8880
|
+
baseDir = process.cwd(),
|
|
8881
|
+
relativeDirPath = RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
8882
|
+
dirName,
|
|
8883
|
+
global = false
|
|
8884
|
+
}) {
|
|
8885
|
+
const skillDirPath = join64(baseDir, relativeDirPath, dirName);
|
|
8886
|
+
const skillFilePath = join64(skillDirPath, SKILL_FILE_NAME);
|
|
8887
|
+
if (!await fileExists(skillFilePath)) {
|
|
8888
|
+
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
8889
|
+
}
|
|
8890
|
+
const fileContent = await readFileContent(skillFilePath);
|
|
8891
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, skillFilePath);
|
|
8892
|
+
const result = RulesyncSkillFrontmatterSchema.safeParse(frontmatter);
|
|
8893
|
+
if (!result.success) {
|
|
8894
|
+
throw new Error(`Invalid frontmatter in ${skillFilePath}: ${formatError(result.error)}`);
|
|
8895
|
+
}
|
|
8896
|
+
const otherFiles = await this.collectOtherFiles(
|
|
8897
|
+
baseDir,
|
|
8898
|
+
relativeDirPath,
|
|
8899
|
+
dirName,
|
|
8900
|
+
SKILL_FILE_NAME
|
|
8901
|
+
);
|
|
8902
|
+
return new _RulesyncSkill({
|
|
8903
|
+
baseDir,
|
|
8904
|
+
relativeDirPath,
|
|
8905
|
+
dirName,
|
|
8906
|
+
frontmatter: result.data,
|
|
8907
|
+
body: content.trim(),
|
|
8908
|
+
otherFiles,
|
|
8909
|
+
validate: true,
|
|
8910
|
+
global
|
|
8911
|
+
});
|
|
8912
|
+
}
|
|
8913
|
+
};
|
|
8914
|
+
|
|
8915
|
+
// src/features/skills/rovodev-skill.ts
|
|
8916
|
+
var RovodevSkillFrontmatterSchema = z26.looseObject({
|
|
8917
|
+
name: z26.string(),
|
|
8918
|
+
description: z26.string()
|
|
8919
|
+
});
|
|
8920
|
+
var RovodevSkill = class _RovodevSkill extends ToolSkill {
|
|
8921
|
+
constructor({
|
|
8922
|
+
baseDir = process.cwd(),
|
|
8923
|
+
relativeDirPath = join65(".rovodev", "skills"),
|
|
8924
|
+
dirName,
|
|
8925
|
+
frontmatter,
|
|
8926
|
+
body,
|
|
8927
|
+
otherFiles = [],
|
|
8928
|
+
validate = true,
|
|
8929
|
+
global = false
|
|
8930
|
+
}) {
|
|
8931
|
+
super({
|
|
8932
|
+
baseDir,
|
|
8933
|
+
relativeDirPath,
|
|
8934
|
+
dirName,
|
|
8935
|
+
mainFile: {
|
|
8936
|
+
name: SKILL_FILE_NAME,
|
|
8937
|
+
body,
|
|
8938
|
+
frontmatter: { ...frontmatter }
|
|
8939
|
+
},
|
|
8940
|
+
otherFiles,
|
|
8941
|
+
global
|
|
8942
|
+
});
|
|
8943
|
+
if (validate) {
|
|
8944
|
+
const result = this.validate();
|
|
8945
|
+
if (!result.success) {
|
|
8946
|
+
throw result.error;
|
|
8947
|
+
}
|
|
8948
|
+
}
|
|
8949
|
+
}
|
|
8950
|
+
static getSettablePaths(_options) {
|
|
8951
|
+
return {
|
|
8952
|
+
relativeDirPath: join65(".rovodev", "skills"),
|
|
8953
|
+
alternativeSkillRoots: [join65(".agents", "skills")]
|
|
8954
|
+
};
|
|
8955
|
+
}
|
|
8956
|
+
getFrontmatter() {
|
|
8957
|
+
const result = RovodevSkillFrontmatterSchema.parse(this.requireMainFileFrontmatter());
|
|
8958
|
+
return result;
|
|
8959
|
+
}
|
|
8960
|
+
getBody() {
|
|
8961
|
+
return this.mainFile?.body ?? "";
|
|
8962
|
+
}
|
|
8963
|
+
validate() {
|
|
8964
|
+
if (!this.mainFile) {
|
|
8965
|
+
return {
|
|
8966
|
+
success: false,
|
|
8967
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
8968
|
+
};
|
|
8969
|
+
}
|
|
8970
|
+
const result = RovodevSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
8971
|
+
if (!result.success) {
|
|
8972
|
+
return {
|
|
8973
|
+
success: false,
|
|
8974
|
+
error: new Error(
|
|
8975
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
8976
|
+
)
|
|
8977
|
+
};
|
|
8978
|
+
}
|
|
8979
|
+
if (result.data.name !== this.getDirName()) {
|
|
8980
|
+
return {
|
|
8981
|
+
success: false,
|
|
8982
|
+
error: new Error(
|
|
8983
|
+
`${this.getDirPath()}: frontmatter name (${result.data.name}) must match directory name (${this.getDirName()})`
|
|
8984
|
+
)
|
|
8985
|
+
};
|
|
8986
|
+
}
|
|
8987
|
+
return { success: true, error: null };
|
|
8988
|
+
}
|
|
8989
|
+
toRulesyncSkill() {
|
|
8990
|
+
const frontmatter = this.getFrontmatter();
|
|
8991
|
+
const rulesyncFrontmatter = {
|
|
8992
|
+
name: frontmatter.name,
|
|
8993
|
+
description: frontmatter.description,
|
|
8994
|
+
targets: ["*"]
|
|
8995
|
+
};
|
|
8996
|
+
return new RulesyncSkill({
|
|
8997
|
+
baseDir: this.baseDir,
|
|
8998
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
8999
|
+
dirName: this.getDirName(),
|
|
9000
|
+
frontmatter: rulesyncFrontmatter,
|
|
9001
|
+
body: this.getBody(),
|
|
9002
|
+
otherFiles: this.getOtherFiles(),
|
|
9003
|
+
validate: true,
|
|
9004
|
+
global: this.global
|
|
9005
|
+
});
|
|
9006
|
+
}
|
|
9007
|
+
static fromRulesyncSkill({
|
|
9008
|
+
baseDir = process.cwd(),
|
|
9009
|
+
rulesyncSkill,
|
|
9010
|
+
validate = true,
|
|
9011
|
+
global = false
|
|
9012
|
+
}) {
|
|
9013
|
+
const settablePaths = _RovodevSkill.getSettablePaths({ global });
|
|
9014
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
9015
|
+
const rovodevFrontmatter = {
|
|
9016
|
+
name: rulesyncFrontmatter.name,
|
|
9017
|
+
description: rulesyncFrontmatter.description
|
|
9018
|
+
};
|
|
9019
|
+
return new _RovodevSkill({
|
|
9020
|
+
baseDir,
|
|
9021
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
9022
|
+
dirName: rovodevFrontmatter.name,
|
|
9023
|
+
frontmatter: rovodevFrontmatter,
|
|
9024
|
+
body: rulesyncSkill.getBody(),
|
|
9025
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
9026
|
+
validate,
|
|
9027
|
+
global
|
|
9028
|
+
});
|
|
9029
|
+
}
|
|
9030
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
9031
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
9032
|
+
return targets.includes("*") || targets.includes("rovodev");
|
|
9033
|
+
}
|
|
9034
|
+
static async fromDir(params) {
|
|
9035
|
+
const loaded = await this.loadSkillDirContent({
|
|
9036
|
+
...params,
|
|
9037
|
+
getSettablePaths: _RovodevSkill.getSettablePaths
|
|
9038
|
+
});
|
|
9039
|
+
const result = RovodevSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9040
|
+
if (!result.success) {
|
|
9041
|
+
const skillDirPath = join65(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9042
|
+
throw new Error(
|
|
9043
|
+
`Invalid frontmatter in ${join65(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9044
|
+
);
|
|
9045
|
+
}
|
|
9046
|
+
if (result.data.name !== loaded.dirName) {
|
|
9047
|
+
const skillFilePath = join65(
|
|
9048
|
+
loaded.baseDir,
|
|
9049
|
+
loaded.relativeDirPath,
|
|
9050
|
+
loaded.dirName,
|
|
9051
|
+
SKILL_FILE_NAME
|
|
9052
|
+
);
|
|
9053
|
+
throw new Error(
|
|
9054
|
+
`Frontmatter name (${result.data.name}) must match directory name (${loaded.dirName}) in ${skillFilePath}`
|
|
9055
|
+
);
|
|
9056
|
+
}
|
|
9057
|
+
return new _RovodevSkill({
|
|
9058
|
+
baseDir: loaded.baseDir,
|
|
9059
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
9060
|
+
dirName: loaded.dirName,
|
|
9061
|
+
frontmatter: result.data,
|
|
9062
|
+
body: loaded.body,
|
|
9063
|
+
otherFiles: loaded.otherFiles,
|
|
9064
|
+
validate: true,
|
|
9065
|
+
global: loaded.global
|
|
9066
|
+
});
|
|
9067
|
+
}
|
|
9068
|
+
static forDeletion({
|
|
9069
|
+
baseDir = process.cwd(),
|
|
9070
|
+
relativeDirPath,
|
|
9071
|
+
dirName,
|
|
9072
|
+
global = false
|
|
9073
|
+
}) {
|
|
9074
|
+
const settablePaths = _RovodevSkill.getSettablePaths({ global });
|
|
9075
|
+
return new _RovodevSkill({
|
|
9076
|
+
baseDir,
|
|
9077
|
+
relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
|
|
9078
|
+
dirName,
|
|
9079
|
+
frontmatter: { name: "", description: "" },
|
|
9080
|
+
body: "",
|
|
9081
|
+
otherFiles: [],
|
|
9082
|
+
validate: false,
|
|
9083
|
+
global
|
|
9084
|
+
});
|
|
9085
|
+
}
|
|
9086
|
+
};
|
|
9087
|
+
|
|
9088
|
+
// src/features/skills/skills-processor.ts
|
|
9089
|
+
import { basename as basename5, join as join83 } from "path";
|
|
9090
|
+
import { z as z42 } from "zod/mini";
|
|
9091
|
+
|
|
9092
|
+
// src/types/dir-feature-processor.ts
|
|
9093
|
+
import { join as join66 } from "path";
|
|
9094
|
+
var DirFeatureProcessor = class {
|
|
9095
|
+
baseDir;
|
|
9096
|
+
dryRun;
|
|
9097
|
+
avoidBlockScalars;
|
|
9098
|
+
logger;
|
|
9099
|
+
constructor({
|
|
9100
|
+
baseDir = process.cwd(),
|
|
9101
|
+
dryRun = false,
|
|
9102
|
+
avoidBlockScalars = false,
|
|
9103
|
+
logger
|
|
9104
|
+
}) {
|
|
9105
|
+
this.baseDir = baseDir;
|
|
9106
|
+
this.dryRun = dryRun;
|
|
9107
|
+
this.avoidBlockScalars = avoidBlockScalars;
|
|
9108
|
+
this.logger = logger;
|
|
9109
|
+
}
|
|
9110
|
+
/**
|
|
9111
|
+
* Return tool targets that this feature supports.
|
|
9112
|
+
*/
|
|
9113
|
+
static getToolTargets(_params = {}) {
|
|
9114
|
+
throw new Error("Not implemented");
|
|
9115
|
+
}
|
|
9116
|
+
/**
|
|
9117
|
+
* Once converted to rulesync/tool dirs, write them to the filesystem.
|
|
9118
|
+
* Returns the number of directories written.
|
|
9119
|
+
*
|
|
9120
|
+
* Note: This method uses directory-level change detection. If any file within
|
|
9121
|
+
* a directory has changed, ALL files in that directory are rewritten. This is
|
|
9122
|
+
* an intentional design decision to ensure consistency within directory units.
|
|
9123
|
+
*/
|
|
9124
|
+
async writeAiDirs(aiDirs) {
|
|
9125
|
+
let changedCount = 0;
|
|
9126
|
+
const changedPaths = [];
|
|
9127
|
+
for (const aiDir of aiDirs) {
|
|
9128
|
+
const dirPath = aiDir.getDirPath();
|
|
9129
|
+
let dirHasChanges = false;
|
|
9130
|
+
const mainFile = aiDir.getMainFile();
|
|
9131
|
+
let mainFileContent;
|
|
9132
|
+
if (mainFile) {
|
|
9133
|
+
const mainFilePath = join66(dirPath, mainFile.name);
|
|
9134
|
+
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter, {
|
|
9135
|
+
avoidBlockScalars: this.avoidBlockScalars
|
|
9136
|
+
});
|
|
9137
|
+
mainFileContent = addTrailingNewline(content);
|
|
9138
|
+
const existingContent = await readFileContentOrNull(mainFilePath);
|
|
9139
|
+
if (!fileContentsEquivalent({
|
|
9140
|
+
filePath: mainFilePath,
|
|
9141
|
+
expected: mainFileContent,
|
|
9142
|
+
existing: existingContent
|
|
9143
|
+
})) {
|
|
9144
|
+
dirHasChanges = true;
|
|
9145
|
+
}
|
|
9146
|
+
}
|
|
9147
|
+
const otherFiles = aiDir.getOtherFiles();
|
|
9148
|
+
const otherFileContents = [];
|
|
9149
|
+
for (const file of otherFiles) {
|
|
9150
|
+
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
9151
|
+
otherFileContents.push(contentWithNewline);
|
|
9152
|
+
if (!dirHasChanges) {
|
|
9153
|
+
const filePath = join66(dirPath, file.relativeFilePathToDirPath);
|
|
9154
|
+
const existingContent = await readFileContentOrNull(filePath);
|
|
9155
|
+
if (!fileContentsEquivalent({
|
|
9156
|
+
filePath,
|
|
9157
|
+
expected: contentWithNewline,
|
|
9158
|
+
existing: existingContent
|
|
9159
|
+
})) {
|
|
9160
|
+
dirHasChanges = true;
|
|
9161
|
+
}
|
|
9162
|
+
}
|
|
9163
|
+
}
|
|
9164
|
+
if (!dirHasChanges) {
|
|
9165
|
+
continue;
|
|
9166
|
+
}
|
|
9167
|
+
const relativeDir = aiDir.getRelativePathFromCwd();
|
|
9168
|
+
if (this.dryRun) {
|
|
9169
|
+
this.logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
|
|
9170
|
+
if (mainFile) {
|
|
9171
|
+
this.logger.info(`[DRY RUN] Would write: ${join66(dirPath, mainFile.name)}`);
|
|
9172
|
+
changedPaths.push(join66(relativeDir, mainFile.name));
|
|
9173
|
+
}
|
|
9174
|
+
for (const file of otherFiles) {
|
|
9175
|
+
this.logger.info(
|
|
9176
|
+
`[DRY RUN] Would write: ${join66(dirPath, file.relativeFilePathToDirPath)}`
|
|
9177
|
+
);
|
|
9178
|
+
changedPaths.push(join66(relativeDir, file.relativeFilePathToDirPath));
|
|
9179
|
+
}
|
|
9180
|
+
} else {
|
|
9181
|
+
await ensureDir(dirPath);
|
|
9182
|
+
if (mainFile && mainFileContent) {
|
|
9183
|
+
const mainFilePath = join66(dirPath, mainFile.name);
|
|
9184
|
+
await writeFileContent(mainFilePath, mainFileContent);
|
|
9185
|
+
changedPaths.push(join66(relativeDir, mainFile.name));
|
|
9186
|
+
}
|
|
9187
|
+
for (const [i, file] of otherFiles.entries()) {
|
|
9188
|
+
const filePath = join66(dirPath, file.relativeFilePathToDirPath);
|
|
9189
|
+
const content = otherFileContents[i];
|
|
9190
|
+
if (content === void 0) {
|
|
9191
|
+
throw new Error(
|
|
9192
|
+
`Internal error: content for file ${file.relativeFilePathToDirPath} is undefined. This indicates a synchronization issue between otherFiles and otherFileContents arrays.`
|
|
9193
|
+
);
|
|
9194
|
+
}
|
|
9195
|
+
await writeFileContent(filePath, content);
|
|
9196
|
+
changedPaths.push(join66(relativeDir, file.relativeFilePathToDirPath));
|
|
9197
|
+
}
|
|
9198
|
+
}
|
|
9199
|
+
changedCount++;
|
|
9200
|
+
}
|
|
9201
|
+
return { count: changedCount, paths: changedPaths };
|
|
9202
|
+
}
|
|
9203
|
+
async removeAiDirs(aiDirs) {
|
|
9204
|
+
for (const aiDir of aiDirs) {
|
|
9205
|
+
await removeDirectory(aiDir.getDirPath());
|
|
8788
9206
|
}
|
|
8789
|
-
return { success: true, error: null };
|
|
8790
9207
|
}
|
|
8791
|
-
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
const
|
|
8798
|
-
const
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
if (!result.success) {
|
|
8806
|
-
throw new Error(`Invalid frontmatter in ${skillFilePath}: ${formatError(result.error)}`);
|
|
9208
|
+
/**
|
|
9209
|
+
* Remove orphan directories that exist in the tool directory but not in the generated directories.
|
|
9210
|
+
* This only deletes directories that are no longer in the rulesync source, not directories that will be overwritten.
|
|
9211
|
+
*/
|
|
9212
|
+
async removeOrphanAiDirs(existingDirs, generatedDirs) {
|
|
9213
|
+
const generatedPaths = new Set(generatedDirs.map((d) => d.getDirPath()));
|
|
9214
|
+
const orphanDirs = existingDirs.filter((d) => !generatedPaths.has(d.getDirPath()));
|
|
9215
|
+
for (const aiDir of orphanDirs) {
|
|
9216
|
+
const dirPath = aiDir.getDirPath();
|
|
9217
|
+
if (this.dryRun) {
|
|
9218
|
+
this.logger.info(`[DRY RUN] Would delete directory: ${dirPath}`);
|
|
9219
|
+
} else {
|
|
9220
|
+
await removeDirectory(dirPath);
|
|
9221
|
+
}
|
|
8807
9222
|
}
|
|
8808
|
-
|
|
8809
|
-
baseDir,
|
|
8810
|
-
relativeDirPath,
|
|
8811
|
-
dirName,
|
|
8812
|
-
SKILL_FILE_NAME
|
|
8813
|
-
);
|
|
8814
|
-
return new _RulesyncSkill({
|
|
8815
|
-
baseDir,
|
|
8816
|
-
relativeDirPath,
|
|
8817
|
-
dirName,
|
|
8818
|
-
frontmatter: result.data,
|
|
8819
|
-
body: content.trim(),
|
|
8820
|
-
otherFiles,
|
|
8821
|
-
validate: true,
|
|
8822
|
-
global
|
|
8823
|
-
});
|
|
9223
|
+
return orphanDirs.length;
|
|
8824
9224
|
}
|
|
8825
9225
|
};
|
|
8826
9226
|
|
|
8827
9227
|
// src/features/skills/agentsskills-skill.ts
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
9228
|
+
import { join as join67 } from "path";
|
|
9229
|
+
import { z as z27 } from "zod/mini";
|
|
9230
|
+
var AgentsSkillsSkillFrontmatterSchema = z27.looseObject({
|
|
9231
|
+
name: z27.string(),
|
|
9232
|
+
description: z27.string()
|
|
8831
9233
|
});
|
|
8832
9234
|
var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
8833
9235
|
constructor({
|
|
8834
9236
|
baseDir = process.cwd(),
|
|
8835
|
-
relativeDirPath =
|
|
9237
|
+
relativeDirPath = join67(".agents", "skills"),
|
|
8836
9238
|
dirName,
|
|
8837
9239
|
frontmatter,
|
|
8838
9240
|
body,
|
|
@@ -8864,7 +9266,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8864
9266
|
throw new Error("AgentsSkillsSkill does not support global mode.");
|
|
8865
9267
|
}
|
|
8866
9268
|
return {
|
|
8867
|
-
relativeDirPath:
|
|
9269
|
+
relativeDirPath: join67(".agents", "skills")
|
|
8868
9270
|
};
|
|
8869
9271
|
}
|
|
8870
9272
|
getFrontmatter() {
|
|
@@ -8944,9 +9346,9 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8944
9346
|
});
|
|
8945
9347
|
const result = AgentsSkillsSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8946
9348
|
if (!result.success) {
|
|
8947
|
-
const skillDirPath =
|
|
9349
|
+
const skillDirPath = join67(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8948
9350
|
throw new Error(
|
|
8949
|
-
`Invalid frontmatter in ${
|
|
9351
|
+
`Invalid frontmatter in ${join67(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8950
9352
|
);
|
|
8951
9353
|
}
|
|
8952
9354
|
return new _AgentsSkillsSkill({
|
|
@@ -8981,16 +9383,16 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8981
9383
|
};
|
|
8982
9384
|
|
|
8983
9385
|
// src/features/skills/antigravity-skill.ts
|
|
8984
|
-
import { join as
|
|
8985
|
-
import { z as
|
|
8986
|
-
var AntigravitySkillFrontmatterSchema =
|
|
8987
|
-
name:
|
|
8988
|
-
description:
|
|
9386
|
+
import { join as join68 } from "path";
|
|
9387
|
+
import { z as z28 } from "zod/mini";
|
|
9388
|
+
var AntigravitySkillFrontmatterSchema = z28.looseObject({
|
|
9389
|
+
name: z28.string(),
|
|
9390
|
+
description: z28.string()
|
|
8989
9391
|
});
|
|
8990
9392
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
8991
9393
|
constructor({
|
|
8992
9394
|
baseDir = process.cwd(),
|
|
8993
|
-
relativeDirPath =
|
|
9395
|
+
relativeDirPath = join68(".agent", "skills"),
|
|
8994
9396
|
dirName,
|
|
8995
9397
|
frontmatter,
|
|
8996
9398
|
body,
|
|
@@ -9022,11 +9424,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
9022
9424
|
} = {}) {
|
|
9023
9425
|
if (global) {
|
|
9024
9426
|
return {
|
|
9025
|
-
relativeDirPath:
|
|
9427
|
+
relativeDirPath: join68(".gemini", "antigravity", "skills")
|
|
9026
9428
|
};
|
|
9027
9429
|
}
|
|
9028
9430
|
return {
|
|
9029
|
-
relativeDirPath:
|
|
9431
|
+
relativeDirPath: join68(".agent", "skills")
|
|
9030
9432
|
};
|
|
9031
9433
|
}
|
|
9032
9434
|
getFrontmatter() {
|
|
@@ -9106,9 +9508,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
9106
9508
|
});
|
|
9107
9509
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9108
9510
|
if (!result.success) {
|
|
9109
|
-
const skillDirPath =
|
|
9511
|
+
const skillDirPath = join68(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9110
9512
|
throw new Error(
|
|
9111
|
-
`Invalid frontmatter in ${
|
|
9513
|
+
`Invalid frontmatter in ${join68(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9112
9514
|
);
|
|
9113
9515
|
}
|
|
9114
9516
|
return new _AntigravitySkill({
|
|
@@ -9142,19 +9544,19 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
9142
9544
|
};
|
|
9143
9545
|
|
|
9144
9546
|
// src/features/skills/claudecode-skill.ts
|
|
9145
|
-
import { join as
|
|
9146
|
-
import { z as
|
|
9147
|
-
var ClaudecodeSkillFrontmatterSchema =
|
|
9148
|
-
name:
|
|
9149
|
-
description:
|
|
9150
|
-
"allowed-tools":
|
|
9151
|
-
model:
|
|
9152
|
-
"disable-model-invocation":
|
|
9547
|
+
import { join as join69 } from "path";
|
|
9548
|
+
import { z as z29 } from "zod/mini";
|
|
9549
|
+
var ClaudecodeSkillFrontmatterSchema = z29.looseObject({
|
|
9550
|
+
name: z29.string(),
|
|
9551
|
+
description: z29.string(),
|
|
9552
|
+
"allowed-tools": z29.optional(z29.array(z29.string())),
|
|
9553
|
+
model: z29.optional(z29.string()),
|
|
9554
|
+
"disable-model-invocation": z29.optional(z29.boolean())
|
|
9153
9555
|
});
|
|
9154
9556
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
9155
9557
|
constructor({
|
|
9156
9558
|
baseDir = process.cwd(),
|
|
9157
|
-
relativeDirPath =
|
|
9559
|
+
relativeDirPath = join69(".claude", "skills"),
|
|
9158
9560
|
dirName,
|
|
9159
9561
|
frontmatter,
|
|
9160
9562
|
body,
|
|
@@ -9185,7 +9587,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
9185
9587
|
global: _global = false
|
|
9186
9588
|
} = {}) {
|
|
9187
9589
|
return {
|
|
9188
|
-
relativeDirPath:
|
|
9590
|
+
relativeDirPath: join69(".claude", "skills")
|
|
9189
9591
|
};
|
|
9190
9592
|
}
|
|
9191
9593
|
getFrontmatter() {
|
|
@@ -9282,9 +9684,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
9282
9684
|
});
|
|
9283
9685
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9284
9686
|
if (!result.success) {
|
|
9285
|
-
const skillDirPath =
|
|
9687
|
+
const skillDirPath = join69(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9286
9688
|
throw new Error(
|
|
9287
|
-
`Invalid frontmatter in ${
|
|
9689
|
+
`Invalid frontmatter in ${join69(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9288
9690
|
);
|
|
9289
9691
|
}
|
|
9290
9692
|
return new _ClaudecodeSkill({
|
|
@@ -9318,16 +9720,16 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
9318
9720
|
};
|
|
9319
9721
|
|
|
9320
9722
|
// src/features/skills/cline-skill.ts
|
|
9321
|
-
import { join as
|
|
9322
|
-
import { z as
|
|
9323
|
-
var ClineSkillFrontmatterSchema =
|
|
9324
|
-
name:
|
|
9325
|
-
description:
|
|
9723
|
+
import { join as join70 } from "path";
|
|
9724
|
+
import { z as z30 } from "zod/mini";
|
|
9725
|
+
var ClineSkillFrontmatterSchema = z30.looseObject({
|
|
9726
|
+
name: z30.string(),
|
|
9727
|
+
description: z30.string()
|
|
9326
9728
|
});
|
|
9327
9729
|
var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
9328
9730
|
constructor({
|
|
9329
9731
|
baseDir = process.cwd(),
|
|
9330
|
-
relativeDirPath =
|
|
9732
|
+
relativeDirPath = join70(".cline", "skills"),
|
|
9331
9733
|
dirName,
|
|
9332
9734
|
frontmatter,
|
|
9333
9735
|
body,
|
|
@@ -9356,7 +9758,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
9356
9758
|
}
|
|
9357
9759
|
static getSettablePaths(_options = {}) {
|
|
9358
9760
|
return {
|
|
9359
|
-
relativeDirPath:
|
|
9761
|
+
relativeDirPath: join70(".cline", "skills")
|
|
9360
9762
|
};
|
|
9361
9763
|
}
|
|
9362
9764
|
getFrontmatter() {
|
|
@@ -9444,13 +9846,13 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
9444
9846
|
});
|
|
9445
9847
|
const result = ClineSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9446
9848
|
if (!result.success) {
|
|
9447
|
-
const skillDirPath =
|
|
9849
|
+
const skillDirPath = join70(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9448
9850
|
throw new Error(
|
|
9449
|
-
`Invalid frontmatter in ${
|
|
9851
|
+
`Invalid frontmatter in ${join70(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9450
9852
|
);
|
|
9451
9853
|
}
|
|
9452
9854
|
if (result.data.name !== loaded.dirName) {
|
|
9453
|
-
const skillFilePath =
|
|
9855
|
+
const skillFilePath = join70(
|
|
9454
9856
|
loaded.baseDir,
|
|
9455
9857
|
loaded.relativeDirPath,
|
|
9456
9858
|
loaded.dirName,
|
|
@@ -9491,21 +9893,21 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
9491
9893
|
};
|
|
9492
9894
|
|
|
9493
9895
|
// src/features/skills/codexcli-skill.ts
|
|
9494
|
-
import { join as
|
|
9495
|
-
import { z as
|
|
9496
|
-
var CodexCliSkillFrontmatterSchema =
|
|
9497
|
-
name:
|
|
9498
|
-
description:
|
|
9499
|
-
metadata:
|
|
9500
|
-
|
|
9501
|
-
"short-description":
|
|
9896
|
+
import { join as join71 } from "path";
|
|
9897
|
+
import { z as z31 } from "zod/mini";
|
|
9898
|
+
var CodexCliSkillFrontmatterSchema = z31.looseObject({
|
|
9899
|
+
name: z31.string(),
|
|
9900
|
+
description: z31.string(),
|
|
9901
|
+
metadata: z31.optional(
|
|
9902
|
+
z31.looseObject({
|
|
9903
|
+
"short-description": z31.optional(z31.string())
|
|
9502
9904
|
})
|
|
9503
9905
|
)
|
|
9504
9906
|
});
|
|
9505
9907
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
9506
9908
|
constructor({
|
|
9507
9909
|
baseDir = process.cwd(),
|
|
9508
|
-
relativeDirPath =
|
|
9910
|
+
relativeDirPath = join71(".codex", "skills"),
|
|
9509
9911
|
dirName,
|
|
9510
9912
|
frontmatter,
|
|
9511
9913
|
body,
|
|
@@ -9536,7 +9938,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
9536
9938
|
global: _global = false
|
|
9537
9939
|
} = {}) {
|
|
9538
9940
|
return {
|
|
9539
|
-
relativeDirPath:
|
|
9941
|
+
relativeDirPath: join71(".codex", "skills")
|
|
9540
9942
|
};
|
|
9541
9943
|
}
|
|
9542
9944
|
getFrontmatter() {
|
|
@@ -9626,9 +10028,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
9626
10028
|
});
|
|
9627
10029
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9628
10030
|
if (!result.success) {
|
|
9629
|
-
const skillDirPath =
|
|
10031
|
+
const skillDirPath = join71(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9630
10032
|
throw new Error(
|
|
9631
|
-
`Invalid frontmatter in ${
|
|
10033
|
+
`Invalid frontmatter in ${join71(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9632
10034
|
);
|
|
9633
10035
|
}
|
|
9634
10036
|
return new _CodexCliSkill({
|
|
@@ -9662,17 +10064,17 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
9662
10064
|
};
|
|
9663
10065
|
|
|
9664
10066
|
// src/features/skills/copilot-skill.ts
|
|
9665
|
-
import { join as
|
|
9666
|
-
import { z as
|
|
9667
|
-
var CopilotSkillFrontmatterSchema =
|
|
9668
|
-
name:
|
|
9669
|
-
description:
|
|
9670
|
-
license:
|
|
10067
|
+
import { join as join72 } from "path";
|
|
10068
|
+
import { z as z32 } from "zod/mini";
|
|
10069
|
+
var CopilotSkillFrontmatterSchema = z32.looseObject({
|
|
10070
|
+
name: z32.string(),
|
|
10071
|
+
description: z32.string(),
|
|
10072
|
+
license: z32.optional(z32.string())
|
|
9671
10073
|
});
|
|
9672
10074
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
9673
10075
|
constructor({
|
|
9674
10076
|
baseDir = process.cwd(),
|
|
9675
|
-
relativeDirPath =
|
|
10077
|
+
relativeDirPath = join72(".github", "skills"),
|
|
9676
10078
|
dirName,
|
|
9677
10079
|
frontmatter,
|
|
9678
10080
|
body,
|
|
@@ -9704,7 +10106,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9704
10106
|
throw new Error("CopilotSkill does not support global mode.");
|
|
9705
10107
|
}
|
|
9706
10108
|
return {
|
|
9707
|
-
relativeDirPath:
|
|
10109
|
+
relativeDirPath: join72(".github", "skills")
|
|
9708
10110
|
};
|
|
9709
10111
|
}
|
|
9710
10112
|
getFrontmatter() {
|
|
@@ -9790,9 +10192,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9790
10192
|
});
|
|
9791
10193
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9792
10194
|
if (!result.success) {
|
|
9793
|
-
const skillDirPath =
|
|
10195
|
+
const skillDirPath = join72(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9794
10196
|
throw new Error(
|
|
9795
|
-
`Invalid frontmatter in ${
|
|
10197
|
+
`Invalid frontmatter in ${join72(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9796
10198
|
);
|
|
9797
10199
|
}
|
|
9798
10200
|
return new _CopilotSkill({
|
|
@@ -9827,16 +10229,16 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9827
10229
|
};
|
|
9828
10230
|
|
|
9829
10231
|
// src/features/skills/cursor-skill.ts
|
|
9830
|
-
import { join as
|
|
9831
|
-
import { z as
|
|
9832
|
-
var CursorSkillFrontmatterSchema =
|
|
9833
|
-
name:
|
|
9834
|
-
description:
|
|
10232
|
+
import { join as join73 } from "path";
|
|
10233
|
+
import { z as z33 } from "zod/mini";
|
|
10234
|
+
var CursorSkillFrontmatterSchema = z33.looseObject({
|
|
10235
|
+
name: z33.string(),
|
|
10236
|
+
description: z33.string()
|
|
9835
10237
|
});
|
|
9836
10238
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
9837
10239
|
constructor({
|
|
9838
10240
|
baseDir = process.cwd(),
|
|
9839
|
-
relativeDirPath =
|
|
10241
|
+
relativeDirPath = join73(".cursor", "skills"),
|
|
9840
10242
|
dirName,
|
|
9841
10243
|
frontmatter,
|
|
9842
10244
|
body,
|
|
@@ -9865,7 +10267,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9865
10267
|
}
|
|
9866
10268
|
static getSettablePaths(_options) {
|
|
9867
10269
|
return {
|
|
9868
|
-
relativeDirPath:
|
|
10270
|
+
relativeDirPath: join73(".cursor", "skills")
|
|
9869
10271
|
};
|
|
9870
10272
|
}
|
|
9871
10273
|
getFrontmatter() {
|
|
@@ -9945,9 +10347,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9945
10347
|
});
|
|
9946
10348
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9947
10349
|
if (!result.success) {
|
|
9948
|
-
const skillDirPath =
|
|
10350
|
+
const skillDirPath = join73(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9949
10351
|
throw new Error(
|
|
9950
|
-
`Invalid frontmatter in ${
|
|
10352
|
+
`Invalid frontmatter in ${join73(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9951
10353
|
);
|
|
9952
10354
|
}
|
|
9953
10355
|
return new _CursorSkill({
|
|
@@ -9982,17 +10384,17 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9982
10384
|
};
|
|
9983
10385
|
|
|
9984
10386
|
// src/features/skills/deepagents-skill.ts
|
|
9985
|
-
import { join as
|
|
9986
|
-
import { z as
|
|
9987
|
-
var DeepagentsSkillFrontmatterSchema =
|
|
9988
|
-
name:
|
|
9989
|
-
description:
|
|
9990
|
-
"allowed-tools":
|
|
10387
|
+
import { join as join74 } from "path";
|
|
10388
|
+
import { z as z34 } from "zod/mini";
|
|
10389
|
+
var DeepagentsSkillFrontmatterSchema = z34.looseObject({
|
|
10390
|
+
name: z34.string(),
|
|
10391
|
+
description: z34.string(),
|
|
10392
|
+
"allowed-tools": z34.optional(z34.array(z34.string()))
|
|
9991
10393
|
});
|
|
9992
10394
|
var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
|
|
9993
10395
|
constructor({
|
|
9994
10396
|
baseDir = process.cwd(),
|
|
9995
|
-
relativeDirPath =
|
|
10397
|
+
relativeDirPath = join74(".deepagents", "skills"),
|
|
9996
10398
|
dirName,
|
|
9997
10399
|
frontmatter,
|
|
9998
10400
|
body,
|
|
@@ -10024,7 +10426,7 @@ var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
|
|
|
10024
10426
|
throw new Error("DeepagentsSkill does not support global mode.");
|
|
10025
10427
|
}
|
|
10026
10428
|
return {
|
|
10027
|
-
relativeDirPath:
|
|
10429
|
+
relativeDirPath: join74(".deepagents", "skills")
|
|
10028
10430
|
};
|
|
10029
10431
|
}
|
|
10030
10432
|
getFrontmatter() {
|
|
@@ -10108,9 +10510,9 @@ var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
|
|
|
10108
10510
|
});
|
|
10109
10511
|
const result = DeepagentsSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10110
10512
|
if (!result.success) {
|
|
10111
|
-
const skillDirPath =
|
|
10513
|
+
const skillDirPath = join74(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10112
10514
|
throw new Error(
|
|
10113
|
-
`Invalid frontmatter in ${
|
|
10515
|
+
`Invalid frontmatter in ${join74(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10114
10516
|
);
|
|
10115
10517
|
}
|
|
10116
10518
|
return new _DeepagentsSkill({
|
|
@@ -10145,11 +10547,11 @@ var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
|
|
|
10145
10547
|
};
|
|
10146
10548
|
|
|
10147
10549
|
// src/features/skills/geminicli-skill.ts
|
|
10148
|
-
import { join as
|
|
10149
|
-
import { z as
|
|
10150
|
-
var GeminiCliSkillFrontmatterSchema =
|
|
10151
|
-
name:
|
|
10152
|
-
description:
|
|
10550
|
+
import { join as join75 } from "path";
|
|
10551
|
+
import { z as z35 } from "zod/mini";
|
|
10552
|
+
var GeminiCliSkillFrontmatterSchema = z35.looseObject({
|
|
10553
|
+
name: z35.string(),
|
|
10554
|
+
description: z35.string()
|
|
10153
10555
|
});
|
|
10154
10556
|
var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
10155
10557
|
constructor({
|
|
@@ -10185,7 +10587,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
10185
10587
|
global: _global = false
|
|
10186
10588
|
} = {}) {
|
|
10187
10589
|
return {
|
|
10188
|
-
relativeDirPath:
|
|
10590
|
+
relativeDirPath: join75(".gemini", "skills")
|
|
10189
10591
|
};
|
|
10190
10592
|
}
|
|
10191
10593
|
getFrontmatter() {
|
|
@@ -10265,9 +10667,9 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
10265
10667
|
});
|
|
10266
10668
|
const result = GeminiCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10267
10669
|
if (!result.success) {
|
|
10268
|
-
const skillDirPath =
|
|
10670
|
+
const skillDirPath = join75(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10269
10671
|
throw new Error(
|
|
10270
|
-
`Invalid frontmatter in ${
|
|
10672
|
+
`Invalid frontmatter in ${join75(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10271
10673
|
);
|
|
10272
10674
|
}
|
|
10273
10675
|
return new _GeminiCliSkill({
|
|
@@ -10302,16 +10704,16 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
10302
10704
|
};
|
|
10303
10705
|
|
|
10304
10706
|
// src/features/skills/junie-skill.ts
|
|
10305
|
-
import { join as
|
|
10306
|
-
import { z as
|
|
10307
|
-
var JunieSkillFrontmatterSchema =
|
|
10308
|
-
name:
|
|
10309
|
-
description:
|
|
10707
|
+
import { join as join76 } from "path";
|
|
10708
|
+
import { z as z36 } from "zod/mini";
|
|
10709
|
+
var JunieSkillFrontmatterSchema = z36.looseObject({
|
|
10710
|
+
name: z36.string(),
|
|
10711
|
+
description: z36.string()
|
|
10310
10712
|
});
|
|
10311
10713
|
var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
10312
10714
|
constructor({
|
|
10313
10715
|
baseDir = process.cwd(),
|
|
10314
|
-
relativeDirPath =
|
|
10716
|
+
relativeDirPath = join76(".junie", "skills"),
|
|
10315
10717
|
dirName,
|
|
10316
10718
|
frontmatter,
|
|
10317
10719
|
body,
|
|
@@ -10343,7 +10745,7 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
10343
10745
|
throw new Error("JunieSkill does not support global mode.");
|
|
10344
10746
|
}
|
|
10345
10747
|
return {
|
|
10346
|
-
relativeDirPath:
|
|
10748
|
+
relativeDirPath: join76(".junie", "skills")
|
|
10347
10749
|
};
|
|
10348
10750
|
}
|
|
10349
10751
|
getFrontmatter() {
|
|
@@ -10430,13 +10832,13 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
10430
10832
|
});
|
|
10431
10833
|
const result = JunieSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10432
10834
|
if (!result.success) {
|
|
10433
|
-
const skillDirPath =
|
|
10835
|
+
const skillDirPath = join76(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10434
10836
|
throw new Error(
|
|
10435
|
-
`Invalid frontmatter in ${
|
|
10837
|
+
`Invalid frontmatter in ${join76(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10436
10838
|
);
|
|
10437
10839
|
}
|
|
10438
10840
|
if (result.data.name !== loaded.dirName) {
|
|
10439
|
-
const skillFilePath =
|
|
10841
|
+
const skillFilePath = join76(
|
|
10440
10842
|
loaded.baseDir,
|
|
10441
10843
|
loaded.relativeDirPath,
|
|
10442
10844
|
loaded.dirName,
|
|
@@ -10478,16 +10880,16 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
10478
10880
|
};
|
|
10479
10881
|
|
|
10480
10882
|
// src/features/skills/kilo-skill.ts
|
|
10481
|
-
import { join as
|
|
10482
|
-
import { z as
|
|
10483
|
-
var KiloSkillFrontmatterSchema =
|
|
10484
|
-
name:
|
|
10485
|
-
description:
|
|
10883
|
+
import { join as join77 } from "path";
|
|
10884
|
+
import { z as z37 } from "zod/mini";
|
|
10885
|
+
var KiloSkillFrontmatterSchema = z37.looseObject({
|
|
10886
|
+
name: z37.string(),
|
|
10887
|
+
description: z37.string()
|
|
10486
10888
|
});
|
|
10487
10889
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
10488
10890
|
constructor({
|
|
10489
10891
|
baseDir = process.cwd(),
|
|
10490
|
-
relativeDirPath =
|
|
10892
|
+
relativeDirPath = join77(".kilocode", "skills"),
|
|
10491
10893
|
dirName,
|
|
10492
10894
|
frontmatter,
|
|
10493
10895
|
body,
|
|
@@ -10518,7 +10920,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
10518
10920
|
global: _global = false
|
|
10519
10921
|
} = {}) {
|
|
10520
10922
|
return {
|
|
10521
|
-
relativeDirPath:
|
|
10923
|
+
relativeDirPath: join77(".kilocode", "skills")
|
|
10522
10924
|
};
|
|
10523
10925
|
}
|
|
10524
10926
|
getFrontmatter() {
|
|
@@ -10606,13 +11008,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
10606
11008
|
});
|
|
10607
11009
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10608
11010
|
if (!result.success) {
|
|
10609
|
-
const skillDirPath =
|
|
11011
|
+
const skillDirPath = join77(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10610
11012
|
throw new Error(
|
|
10611
|
-
`Invalid frontmatter in ${
|
|
11013
|
+
`Invalid frontmatter in ${join77(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10612
11014
|
);
|
|
10613
11015
|
}
|
|
10614
11016
|
if (result.data.name !== loaded.dirName) {
|
|
10615
|
-
const skillFilePath =
|
|
11017
|
+
const skillFilePath = join77(
|
|
10616
11018
|
loaded.baseDir,
|
|
10617
11019
|
loaded.relativeDirPath,
|
|
10618
11020
|
loaded.dirName,
|
|
@@ -10653,16 +11055,16 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
10653
11055
|
};
|
|
10654
11056
|
|
|
10655
11057
|
// src/features/skills/kiro-skill.ts
|
|
10656
|
-
import { join as
|
|
10657
|
-
import { z as
|
|
10658
|
-
var KiroSkillFrontmatterSchema =
|
|
10659
|
-
name:
|
|
10660
|
-
description:
|
|
11058
|
+
import { join as join78 } from "path";
|
|
11059
|
+
import { z as z38 } from "zod/mini";
|
|
11060
|
+
var KiroSkillFrontmatterSchema = z38.looseObject({
|
|
11061
|
+
name: z38.string(),
|
|
11062
|
+
description: z38.string()
|
|
10661
11063
|
});
|
|
10662
11064
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
10663
11065
|
constructor({
|
|
10664
11066
|
baseDir = process.cwd(),
|
|
10665
|
-
relativeDirPath =
|
|
11067
|
+
relativeDirPath = join78(".kiro", "skills"),
|
|
10666
11068
|
dirName,
|
|
10667
11069
|
frontmatter,
|
|
10668
11070
|
body,
|
|
@@ -10694,7 +11096,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
10694
11096
|
throw new Error("KiroSkill does not support global mode.");
|
|
10695
11097
|
}
|
|
10696
11098
|
return {
|
|
10697
|
-
relativeDirPath:
|
|
11099
|
+
relativeDirPath: join78(".kiro", "skills")
|
|
10698
11100
|
};
|
|
10699
11101
|
}
|
|
10700
11102
|
getFrontmatter() {
|
|
@@ -10782,13 +11184,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
10782
11184
|
});
|
|
10783
11185
|
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10784
11186
|
if (!result.success) {
|
|
10785
|
-
const skillDirPath =
|
|
11187
|
+
const skillDirPath = join78(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10786
11188
|
throw new Error(
|
|
10787
|
-
`Invalid frontmatter in ${
|
|
11189
|
+
`Invalid frontmatter in ${join78(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10788
11190
|
);
|
|
10789
11191
|
}
|
|
10790
11192
|
if (result.data.name !== loaded.dirName) {
|
|
10791
|
-
const skillFilePath =
|
|
11193
|
+
const skillFilePath = join78(
|
|
10792
11194
|
loaded.baseDir,
|
|
10793
11195
|
loaded.relativeDirPath,
|
|
10794
11196
|
loaded.dirName,
|
|
@@ -10830,17 +11232,17 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
10830
11232
|
};
|
|
10831
11233
|
|
|
10832
11234
|
// src/features/skills/opencode-skill.ts
|
|
10833
|
-
import { join as
|
|
10834
|
-
import { z as
|
|
10835
|
-
var OpenCodeSkillFrontmatterSchema =
|
|
10836
|
-
name:
|
|
10837
|
-
description:
|
|
10838
|
-
"allowed-tools":
|
|
11235
|
+
import { join as join79 } from "path";
|
|
11236
|
+
import { z as z39 } from "zod/mini";
|
|
11237
|
+
var OpenCodeSkillFrontmatterSchema = z39.looseObject({
|
|
11238
|
+
name: z39.string(),
|
|
11239
|
+
description: z39.string(),
|
|
11240
|
+
"allowed-tools": z39.optional(z39.array(z39.string()))
|
|
10839
11241
|
});
|
|
10840
11242
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
10841
11243
|
constructor({
|
|
10842
11244
|
baseDir = process.cwd(),
|
|
10843
|
-
relativeDirPath =
|
|
11245
|
+
relativeDirPath = join79(".opencode", "skill"),
|
|
10844
11246
|
dirName,
|
|
10845
11247
|
frontmatter,
|
|
10846
11248
|
body,
|
|
@@ -10869,7 +11271,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
10869
11271
|
}
|
|
10870
11272
|
static getSettablePaths({ global = false } = {}) {
|
|
10871
11273
|
return {
|
|
10872
|
-
relativeDirPath: global ?
|
|
11274
|
+
relativeDirPath: global ? join79(".config", "opencode", "skill") : join79(".opencode", "skill")
|
|
10873
11275
|
};
|
|
10874
11276
|
}
|
|
10875
11277
|
getFrontmatter() {
|
|
@@ -10955,9 +11357,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
10955
11357
|
});
|
|
10956
11358
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10957
11359
|
if (!result.success) {
|
|
10958
|
-
const skillDirPath =
|
|
11360
|
+
const skillDirPath = join79(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10959
11361
|
throw new Error(
|
|
10960
|
-
`Invalid frontmatter in ${
|
|
11362
|
+
`Invalid frontmatter in ${join79(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10961
11363
|
);
|
|
10962
11364
|
}
|
|
10963
11365
|
return new _OpenCodeSkill({
|
|
@@ -10991,16 +11393,16 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
10991
11393
|
};
|
|
10992
11394
|
|
|
10993
11395
|
// src/features/skills/replit-skill.ts
|
|
10994
|
-
import { join as
|
|
10995
|
-
import { z as
|
|
10996
|
-
var ReplitSkillFrontmatterSchema =
|
|
10997
|
-
name:
|
|
10998
|
-
description:
|
|
11396
|
+
import { join as join80 } from "path";
|
|
11397
|
+
import { z as z40 } from "zod/mini";
|
|
11398
|
+
var ReplitSkillFrontmatterSchema = z40.looseObject({
|
|
11399
|
+
name: z40.string(),
|
|
11400
|
+
description: z40.string()
|
|
10999
11401
|
});
|
|
11000
11402
|
var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
11001
11403
|
constructor({
|
|
11002
11404
|
baseDir = process.cwd(),
|
|
11003
|
-
relativeDirPath =
|
|
11405
|
+
relativeDirPath = join80(".agents", "skills"),
|
|
11004
11406
|
dirName,
|
|
11005
11407
|
frontmatter,
|
|
11006
11408
|
body,
|
|
@@ -11032,7 +11434,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
11032
11434
|
throw new Error("ReplitSkill does not support global mode.");
|
|
11033
11435
|
}
|
|
11034
11436
|
return {
|
|
11035
|
-
relativeDirPath:
|
|
11437
|
+
relativeDirPath: join80(".agents", "skills")
|
|
11036
11438
|
};
|
|
11037
11439
|
}
|
|
11038
11440
|
getFrontmatter() {
|
|
@@ -11112,9 +11514,9 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
11112
11514
|
});
|
|
11113
11515
|
const result = ReplitSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
11114
11516
|
if (!result.success) {
|
|
11115
|
-
const skillDirPath =
|
|
11517
|
+
const skillDirPath = join80(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
11116
11518
|
throw new Error(
|
|
11117
|
-
`Invalid frontmatter in ${
|
|
11519
|
+
`Invalid frontmatter in ${join80(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
11118
11520
|
);
|
|
11119
11521
|
}
|
|
11120
11522
|
return new _ReplitSkill({
|
|
@@ -11149,16 +11551,16 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
11149
11551
|
};
|
|
11150
11552
|
|
|
11151
11553
|
// src/features/skills/roo-skill.ts
|
|
11152
|
-
import { join as
|
|
11153
|
-
import { z as
|
|
11154
|
-
var RooSkillFrontmatterSchema =
|
|
11155
|
-
name:
|
|
11156
|
-
description:
|
|
11554
|
+
import { join as join81 } from "path";
|
|
11555
|
+
import { z as z41 } from "zod/mini";
|
|
11556
|
+
var RooSkillFrontmatterSchema = z41.looseObject({
|
|
11557
|
+
name: z41.string(),
|
|
11558
|
+
description: z41.string()
|
|
11157
11559
|
});
|
|
11158
11560
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
11159
11561
|
constructor({
|
|
11160
11562
|
baseDir = process.cwd(),
|
|
11161
|
-
relativeDirPath =
|
|
11563
|
+
relativeDirPath = join81(".roo", "skills"),
|
|
11162
11564
|
dirName,
|
|
11163
11565
|
frontmatter,
|
|
11164
11566
|
body,
|
|
@@ -11189,7 +11591,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
11189
11591
|
global: _global = false
|
|
11190
11592
|
} = {}) {
|
|
11191
11593
|
return {
|
|
11192
|
-
relativeDirPath:
|
|
11594
|
+
relativeDirPath: join81(".roo", "skills")
|
|
11193
11595
|
};
|
|
11194
11596
|
}
|
|
11195
11597
|
getFrontmatter() {
|
|
@@ -11277,13 +11679,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
11277
11679
|
});
|
|
11278
11680
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
11279
11681
|
if (!result.success) {
|
|
11280
|
-
const skillDirPath =
|
|
11682
|
+
const skillDirPath = join81(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
11281
11683
|
throw new Error(
|
|
11282
|
-
`Invalid frontmatter in ${
|
|
11684
|
+
`Invalid frontmatter in ${join81(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
11283
11685
|
);
|
|
11284
11686
|
}
|
|
11285
11687
|
if (result.data.name !== loaded.dirName) {
|
|
11286
|
-
const skillFilePath =
|
|
11688
|
+
const skillFilePath = join81(
|
|
11287
11689
|
loaded.baseDir,
|
|
11288
11690
|
loaded.relativeDirPath,
|
|
11289
11691
|
loaded.dirName,
|
|
@@ -11324,14 +11726,14 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
11324
11726
|
};
|
|
11325
11727
|
|
|
11326
11728
|
// src/features/skills/skills-utils.ts
|
|
11327
|
-
import { basename as basename4, join as
|
|
11729
|
+
import { basename as basename4, join as join82 } from "path";
|
|
11328
11730
|
async function getLocalSkillDirNames(baseDir) {
|
|
11329
|
-
const skillsDir =
|
|
11731
|
+
const skillsDir = join82(baseDir, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
11330
11732
|
const names = /* @__PURE__ */ new Set();
|
|
11331
11733
|
if (!await directoryExists(skillsDir)) {
|
|
11332
11734
|
return names;
|
|
11333
11735
|
}
|
|
11334
|
-
const dirPaths = await findFilesByGlobs(
|
|
11736
|
+
const dirPaths = await findFilesByGlobs(join82(skillsDir, "*"), { type: "dir" });
|
|
11335
11737
|
for (const dirPath of dirPaths) {
|
|
11336
11738
|
const name = basename4(dirPath);
|
|
11337
11739
|
if (name === basename4(RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH)) continue;
|
|
@@ -11359,9 +11761,10 @@ var skillsProcessorToolTargetTuple = [
|
|
|
11359
11761
|
"kiro",
|
|
11360
11762
|
"opencode",
|
|
11361
11763
|
"replit",
|
|
11362
|
-
"roo"
|
|
11764
|
+
"roo",
|
|
11765
|
+
"rovodev"
|
|
11363
11766
|
];
|
|
11364
|
-
var SkillsProcessorToolTargetSchema =
|
|
11767
|
+
var SkillsProcessorToolTargetSchema = z42.enum(skillsProcessorToolTargetTuple);
|
|
11365
11768
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
11366
11769
|
[
|
|
11367
11770
|
"agentsmd",
|
|
@@ -11488,6 +11891,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
11488
11891
|
class: RooSkill,
|
|
11489
11892
|
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
11490
11893
|
}
|
|
11894
|
+
],
|
|
11895
|
+
[
|
|
11896
|
+
"rovodev",
|
|
11897
|
+
{
|
|
11898
|
+
class: RovodevSkill,
|
|
11899
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
11900
|
+
}
|
|
11491
11901
|
]
|
|
11492
11902
|
]);
|
|
11493
11903
|
var defaultGetFactory4 = (target) => {
|
|
@@ -11578,10 +11988,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11578
11988
|
)
|
|
11579
11989
|
);
|
|
11580
11990
|
const localSkillNames = new Set(localDirNames);
|
|
11581
|
-
const curatedDirPath =
|
|
11991
|
+
const curatedDirPath = join83(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
11582
11992
|
let curatedSkills = [];
|
|
11583
11993
|
if (await directoryExists(curatedDirPath)) {
|
|
11584
|
-
const curatedDirPaths = await findFilesByGlobs(
|
|
11994
|
+
const curatedDirPaths = await findFilesByGlobs(join83(curatedDirPath, "*"), { type: "dir" });
|
|
11585
11995
|
const curatedDirNames = curatedDirPaths.map((path3) => basename5(path3));
|
|
11586
11996
|
const nonConflicting = curatedDirNames.filter((name) => {
|
|
11587
11997
|
if (localSkillNames.has(name)) {
|
|
@@ -11615,37 +12025,64 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11615
12025
|
async loadToolDirs() {
|
|
11616
12026
|
const factory = this.getFactory(this.toolTarget);
|
|
11617
12027
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
11618
|
-
const
|
|
11619
|
-
const
|
|
11620
|
-
const
|
|
12028
|
+
const roots = toolSkillSearchRoots(paths);
|
|
12029
|
+
const seenDirNames = /* @__PURE__ */ new Set();
|
|
12030
|
+
const loadEntries = [];
|
|
12031
|
+
for (const root of roots) {
|
|
12032
|
+
const skillsDirPath = join83(this.baseDir, root);
|
|
12033
|
+
if (!await directoryExists(skillsDirPath)) {
|
|
12034
|
+
continue;
|
|
12035
|
+
}
|
|
12036
|
+
const dirPaths = await findFilesByGlobs(join83(skillsDirPath, "*"), { type: "dir" });
|
|
12037
|
+
for (const dirPath of dirPaths) {
|
|
12038
|
+
const dirName = basename5(dirPath);
|
|
12039
|
+
if (seenDirNames.has(dirName)) {
|
|
12040
|
+
continue;
|
|
12041
|
+
}
|
|
12042
|
+
seenDirNames.add(dirName);
|
|
12043
|
+
loadEntries.push({ root, dirName });
|
|
12044
|
+
}
|
|
12045
|
+
}
|
|
11621
12046
|
const toolSkills = await Promise.all(
|
|
11622
|
-
|
|
11623
|
-
(dirName) => factory.class.fromDir({
|
|
12047
|
+
loadEntries.map(
|
|
12048
|
+
({ root, dirName }) => factory.class.fromDir({
|
|
11624
12049
|
baseDir: this.baseDir,
|
|
12050
|
+
relativeDirPath: root,
|
|
11625
12051
|
dirName,
|
|
11626
12052
|
global: this.global
|
|
11627
12053
|
})
|
|
11628
12054
|
)
|
|
11629
12055
|
);
|
|
11630
|
-
this.logger.debug(
|
|
12056
|
+
this.logger.debug(
|
|
12057
|
+
`Successfully loaded ${toolSkills.length} skills from ${roots.length} root(s): ${roots.join(", ")}`
|
|
12058
|
+
);
|
|
11631
12059
|
return toolSkills;
|
|
11632
12060
|
}
|
|
11633
12061
|
async loadToolDirsToDelete() {
|
|
11634
12062
|
const factory = this.getFactory(this.toolTarget);
|
|
11635
12063
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
11636
|
-
const
|
|
11637
|
-
const
|
|
11638
|
-
const
|
|
11639
|
-
|
|
11640
|
-
(
|
|
11641
|
-
|
|
11642
|
-
|
|
11643
|
-
|
|
11644
|
-
|
|
11645
|
-
|
|
11646
|
-
|
|
12064
|
+
const roots = toolSkillSearchRoots(paths);
|
|
12065
|
+
const toolSkills = [];
|
|
12066
|
+
for (const root of roots) {
|
|
12067
|
+
const skillsDirPath = join83(this.baseDir, root);
|
|
12068
|
+
if (!await directoryExists(skillsDirPath)) {
|
|
12069
|
+
continue;
|
|
12070
|
+
}
|
|
12071
|
+
const dirPaths = await findFilesByGlobs(join83(skillsDirPath, "*"), { type: "dir" });
|
|
12072
|
+
for (const dirPath of dirPaths) {
|
|
12073
|
+
const dirName = basename5(dirPath);
|
|
12074
|
+
toolSkills.push(
|
|
12075
|
+
factory.class.forDeletion({
|
|
12076
|
+
baseDir: this.baseDir,
|
|
12077
|
+
relativeDirPath: root,
|
|
12078
|
+
dirName,
|
|
12079
|
+
global: this.global
|
|
12080
|
+
})
|
|
12081
|
+
);
|
|
12082
|
+
}
|
|
12083
|
+
}
|
|
11647
12084
|
this.logger.debug(
|
|
11648
|
-
`Successfully loaded ${toolSkills.length}
|
|
12085
|
+
`Successfully loaded ${toolSkills.length} skills for deletion under ${roots.join(", ")}`
|
|
11649
12086
|
);
|
|
11650
12087
|
return toolSkills;
|
|
11651
12088
|
}
|
|
@@ -11696,11 +12133,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11696
12133
|
};
|
|
11697
12134
|
|
|
11698
12135
|
// src/features/subagents/agentsmd-subagent.ts
|
|
11699
|
-
import { join as
|
|
12136
|
+
import { join as join85 } from "path";
|
|
11700
12137
|
|
|
11701
12138
|
// src/features/subagents/simulated-subagent.ts
|
|
11702
|
-
import { basename as basename6, join as
|
|
11703
|
-
import { z as
|
|
12139
|
+
import { basename as basename6, join as join84 } from "path";
|
|
12140
|
+
import { z as z43 } from "zod/mini";
|
|
11704
12141
|
|
|
11705
12142
|
// src/features/subagents/tool-subagent.ts
|
|
11706
12143
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -11752,9 +12189,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
11752
12189
|
};
|
|
11753
12190
|
|
|
11754
12191
|
// src/features/subagents/simulated-subagent.ts
|
|
11755
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
11756
|
-
name:
|
|
11757
|
-
description:
|
|
12192
|
+
var SimulatedSubagentFrontmatterSchema = z43.object({
|
|
12193
|
+
name: z43.string(),
|
|
12194
|
+
description: z43.optional(z43.string())
|
|
11758
12195
|
});
|
|
11759
12196
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
11760
12197
|
frontmatter;
|
|
@@ -11764,7 +12201,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11764
12201
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11765
12202
|
if (!result.success) {
|
|
11766
12203
|
throw new Error(
|
|
11767
|
-
`Invalid frontmatter in ${
|
|
12204
|
+
`Invalid frontmatter in ${join84(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11768
12205
|
);
|
|
11769
12206
|
}
|
|
11770
12207
|
}
|
|
@@ -11815,7 +12252,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11815
12252
|
return {
|
|
11816
12253
|
success: false,
|
|
11817
12254
|
error: new Error(
|
|
11818
|
-
`Invalid frontmatter in ${
|
|
12255
|
+
`Invalid frontmatter in ${join84(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11819
12256
|
)
|
|
11820
12257
|
};
|
|
11821
12258
|
}
|
|
@@ -11825,7 +12262,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11825
12262
|
relativeFilePath,
|
|
11826
12263
|
validate = true
|
|
11827
12264
|
}) {
|
|
11828
|
-
const filePath =
|
|
12265
|
+
const filePath = join84(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
11829
12266
|
const fileContent = await readFileContent(filePath);
|
|
11830
12267
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11831
12268
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11861,7 +12298,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11861
12298
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
11862
12299
|
static getSettablePaths() {
|
|
11863
12300
|
return {
|
|
11864
|
-
relativeDirPath:
|
|
12301
|
+
relativeDirPath: join85(".agents", "subagents")
|
|
11865
12302
|
};
|
|
11866
12303
|
}
|
|
11867
12304
|
static async fromFile(params) {
|
|
@@ -11884,11 +12321,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
11884
12321
|
};
|
|
11885
12322
|
|
|
11886
12323
|
// src/features/subagents/factorydroid-subagent.ts
|
|
11887
|
-
import { join as
|
|
12324
|
+
import { join as join86 } from "path";
|
|
11888
12325
|
var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
|
|
11889
12326
|
static getSettablePaths(_options) {
|
|
11890
12327
|
return {
|
|
11891
|
-
relativeDirPath:
|
|
12328
|
+
relativeDirPath: join86(".factory", "droids")
|
|
11892
12329
|
};
|
|
11893
12330
|
}
|
|
11894
12331
|
static async fromFile(params) {
|
|
@@ -11911,11 +12348,11 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
11911
12348
|
};
|
|
11912
12349
|
|
|
11913
12350
|
// src/features/subagents/geminicli-subagent.ts
|
|
11914
|
-
import { join as
|
|
12351
|
+
import { join as join87 } from "path";
|
|
11915
12352
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
11916
12353
|
static getSettablePaths() {
|
|
11917
12354
|
return {
|
|
11918
|
-
relativeDirPath:
|
|
12355
|
+
relativeDirPath: join87(".gemini", "subagents")
|
|
11919
12356
|
};
|
|
11920
12357
|
}
|
|
11921
12358
|
static async fromFile(params) {
|
|
@@ -11938,11 +12375,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
11938
12375
|
};
|
|
11939
12376
|
|
|
11940
12377
|
// src/features/subagents/roo-subagent.ts
|
|
11941
|
-
import { join as
|
|
12378
|
+
import { join as join88 } from "path";
|
|
11942
12379
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
11943
12380
|
static getSettablePaths() {
|
|
11944
12381
|
return {
|
|
11945
|
-
relativeDirPath:
|
|
12382
|
+
relativeDirPath: join88(".roo", "subagents")
|
|
11946
12383
|
};
|
|
11947
12384
|
}
|
|
11948
12385
|
static async fromFile(params) {
|
|
@@ -11964,21 +12401,17 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
11964
12401
|
}
|
|
11965
12402
|
};
|
|
11966
12403
|
|
|
11967
|
-
// src/features/subagents/
|
|
11968
|
-
import {
|
|
11969
|
-
import { z as
|
|
11970
|
-
|
|
11971
|
-
// src/features/subagents/claudecode-subagent.ts
|
|
11972
|
-
import { join as join88 } from "path";
|
|
11973
|
-
import { z as z44 } from "zod/mini";
|
|
12404
|
+
// src/features/subagents/rovodev-subagent.ts
|
|
12405
|
+
import { join as join90 } from "path";
|
|
12406
|
+
import { z as z45 } from "zod/mini";
|
|
11974
12407
|
|
|
11975
12408
|
// src/features/subagents/rulesync-subagent.ts
|
|
11976
|
-
import { basename as basename7, join as
|
|
11977
|
-
import { z as
|
|
11978
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
11979
|
-
targets:
|
|
11980
|
-
name:
|
|
11981
|
-
description:
|
|
12409
|
+
import { basename as basename7, join as join89 } from "path";
|
|
12410
|
+
import { z as z44 } from "zod/mini";
|
|
12411
|
+
var RulesyncSubagentFrontmatterSchema = z44.looseObject({
|
|
12412
|
+
targets: z44._default(RulesyncTargetsSchema, ["*"]),
|
|
12413
|
+
name: z44.string(),
|
|
12414
|
+
description: z44.optional(z44.string())
|
|
11982
12415
|
});
|
|
11983
12416
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
11984
12417
|
frontmatter;
|
|
@@ -11987,7 +12420,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
11987
12420
|
const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11988
12421
|
if (!parseResult.success && rest.validate !== false) {
|
|
11989
12422
|
throw new Error(
|
|
11990
|
-
`Invalid frontmatter in ${
|
|
12423
|
+
`Invalid frontmatter in ${join89(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
11991
12424
|
);
|
|
11992
12425
|
}
|
|
11993
12426
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
|
|
@@ -12020,7 +12453,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
12020
12453
|
return {
|
|
12021
12454
|
success: false,
|
|
12022
12455
|
error: new Error(
|
|
12023
|
-
`Invalid frontmatter in ${
|
|
12456
|
+
`Invalid frontmatter in ${join89(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12024
12457
|
)
|
|
12025
12458
|
};
|
|
12026
12459
|
}
|
|
@@ -12028,7 +12461,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
12028
12461
|
static async fromFile({
|
|
12029
12462
|
relativeFilePath
|
|
12030
12463
|
}) {
|
|
12031
|
-
const filePath =
|
|
12464
|
+
const filePath = join89(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
|
|
12032
12465
|
const fileContent = await readFileContent(filePath);
|
|
12033
12466
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12034
12467
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12046,14 +12479,163 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
12046
12479
|
}
|
|
12047
12480
|
};
|
|
12048
12481
|
|
|
12482
|
+
// src/features/subagents/rovodev-subagent.ts
|
|
12483
|
+
var RovodevSubagentFrontmatterSchema = z45.looseObject({
|
|
12484
|
+
name: z45.string(),
|
|
12485
|
+
description: z45.optional(z45.string())
|
|
12486
|
+
});
|
|
12487
|
+
var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
12488
|
+
frontmatter;
|
|
12489
|
+
body;
|
|
12490
|
+
constructor({ frontmatter, body, ...rest }) {
|
|
12491
|
+
if (rest.validate !== false) {
|
|
12492
|
+
const result = RovodevSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12493
|
+
if (!result.success) {
|
|
12494
|
+
throw new Error(
|
|
12495
|
+
`Invalid frontmatter in ${join90(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12496
|
+
);
|
|
12497
|
+
}
|
|
12498
|
+
}
|
|
12499
|
+
super({
|
|
12500
|
+
...rest
|
|
12501
|
+
});
|
|
12502
|
+
this.frontmatter = frontmatter;
|
|
12503
|
+
this.body = body;
|
|
12504
|
+
}
|
|
12505
|
+
static getSettablePaths(_options = {}) {
|
|
12506
|
+
return {
|
|
12507
|
+
relativeDirPath: join90(".rovodev", "subagents")
|
|
12508
|
+
};
|
|
12509
|
+
}
|
|
12510
|
+
getFrontmatter() {
|
|
12511
|
+
return this.frontmatter;
|
|
12512
|
+
}
|
|
12513
|
+
getBody() {
|
|
12514
|
+
return this.body;
|
|
12515
|
+
}
|
|
12516
|
+
toRulesyncSubagent() {
|
|
12517
|
+
const { name, description, ...rest } = this.frontmatter;
|
|
12518
|
+
const rulesyncFrontmatter = {
|
|
12519
|
+
targets: ["*"],
|
|
12520
|
+
name,
|
|
12521
|
+
description,
|
|
12522
|
+
rovodev: {
|
|
12523
|
+
...rest
|
|
12524
|
+
}
|
|
12525
|
+
};
|
|
12526
|
+
return new RulesyncSubagent({
|
|
12527
|
+
baseDir: ".",
|
|
12528
|
+
frontmatter: rulesyncFrontmatter,
|
|
12529
|
+
body: this.body,
|
|
12530
|
+
relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
|
|
12531
|
+
relativeFilePath: this.getRelativeFilePath(),
|
|
12532
|
+
validate: true
|
|
12533
|
+
});
|
|
12534
|
+
}
|
|
12535
|
+
static fromRulesyncSubagent({
|
|
12536
|
+
baseDir = process.cwd(),
|
|
12537
|
+
rulesyncSubagent,
|
|
12538
|
+
validate = true,
|
|
12539
|
+
global = false
|
|
12540
|
+
}) {
|
|
12541
|
+
const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
|
|
12542
|
+
const rovodevSection = rulesyncFrontmatter.rovodev ?? {};
|
|
12543
|
+
const rovodevFrontmatter = {
|
|
12544
|
+
name: rulesyncFrontmatter.name,
|
|
12545
|
+
description: rulesyncFrontmatter.description,
|
|
12546
|
+
...rovodevSection
|
|
12547
|
+
};
|
|
12548
|
+
const body = rulesyncSubagent.getBody();
|
|
12549
|
+
const fileContent = stringifyFrontmatter(body, rovodevFrontmatter, { avoidBlockScalars: true });
|
|
12550
|
+
const paths = this.getSettablePaths({ global });
|
|
12551
|
+
return new _RovodevSubagent({
|
|
12552
|
+
baseDir,
|
|
12553
|
+
frontmatter: rovodevFrontmatter,
|
|
12554
|
+
body,
|
|
12555
|
+
relativeDirPath: paths.relativeDirPath,
|
|
12556
|
+
relativeFilePath: rulesyncSubagent.getRelativeFilePath(),
|
|
12557
|
+
fileContent,
|
|
12558
|
+
validate,
|
|
12559
|
+
global
|
|
12560
|
+
});
|
|
12561
|
+
}
|
|
12562
|
+
validate() {
|
|
12563
|
+
const result = RovodevSubagentFrontmatterSchema.safeParse(this.frontmatter);
|
|
12564
|
+
if (result.success) {
|
|
12565
|
+
return { success: true, error: null };
|
|
12566
|
+
}
|
|
12567
|
+
return {
|
|
12568
|
+
success: false,
|
|
12569
|
+
error: new Error(
|
|
12570
|
+
`Invalid frontmatter in ${join90(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12571
|
+
)
|
|
12572
|
+
};
|
|
12573
|
+
}
|
|
12574
|
+
static isTargetedByRulesyncSubagent(rulesyncSubagent) {
|
|
12575
|
+
return this.isTargetedByRulesyncSubagentDefault({
|
|
12576
|
+
rulesyncSubagent,
|
|
12577
|
+
toolTarget: "rovodev"
|
|
12578
|
+
});
|
|
12579
|
+
}
|
|
12580
|
+
static async fromFile({
|
|
12581
|
+
baseDir = process.cwd(),
|
|
12582
|
+
relativeFilePath,
|
|
12583
|
+
validate = true,
|
|
12584
|
+
global = false
|
|
12585
|
+
}) {
|
|
12586
|
+
const paths = this.getSettablePaths({ global });
|
|
12587
|
+
const filePath = join90(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12588
|
+
const fileContent = await readFileContent(filePath);
|
|
12589
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12590
|
+
const result = RovodevSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12591
|
+
if (!result.success) {
|
|
12592
|
+
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
12593
|
+
}
|
|
12594
|
+
return new _RovodevSubagent({
|
|
12595
|
+
baseDir,
|
|
12596
|
+
relativeDirPath: paths.relativeDirPath,
|
|
12597
|
+
relativeFilePath,
|
|
12598
|
+
frontmatter: result.data,
|
|
12599
|
+
body: content.trim(),
|
|
12600
|
+
fileContent,
|
|
12601
|
+
validate,
|
|
12602
|
+
global
|
|
12603
|
+
});
|
|
12604
|
+
}
|
|
12605
|
+
static forDeletion({
|
|
12606
|
+
baseDir = process.cwd(),
|
|
12607
|
+
relativeDirPath,
|
|
12608
|
+
relativeFilePath,
|
|
12609
|
+
global = false
|
|
12610
|
+
}) {
|
|
12611
|
+
const paths = this.getSettablePaths({ global });
|
|
12612
|
+
return new _RovodevSubagent({
|
|
12613
|
+
baseDir,
|
|
12614
|
+
relativeDirPath: relativeDirPath ?? paths.relativeDirPath,
|
|
12615
|
+
relativeFilePath,
|
|
12616
|
+
frontmatter: { name: "", description: "" },
|
|
12617
|
+
body: "",
|
|
12618
|
+
fileContent: "",
|
|
12619
|
+
validate: false,
|
|
12620
|
+
global
|
|
12621
|
+
});
|
|
12622
|
+
}
|
|
12623
|
+
};
|
|
12624
|
+
|
|
12625
|
+
// src/features/subagents/subagents-processor.ts
|
|
12626
|
+
import { basename as basename9, join as join99 } from "path";
|
|
12627
|
+
import { z as z54 } from "zod/mini";
|
|
12628
|
+
|
|
12049
12629
|
// src/features/subagents/claudecode-subagent.ts
|
|
12050
|
-
|
|
12051
|
-
|
|
12052
|
-
|
|
12053
|
-
|
|
12054
|
-
|
|
12055
|
-
|
|
12056
|
-
|
|
12630
|
+
import { join as join91 } from "path";
|
|
12631
|
+
import { z as z46 } from "zod/mini";
|
|
12632
|
+
var ClaudecodeSubagentFrontmatterSchema = z46.looseObject({
|
|
12633
|
+
name: z46.string(),
|
|
12634
|
+
description: z46.optional(z46.string()),
|
|
12635
|
+
model: z46.optional(z46.string()),
|
|
12636
|
+
tools: z46.optional(z46.union([z46.string(), z46.array(z46.string())])),
|
|
12637
|
+
permissionMode: z46.optional(z46.string()),
|
|
12638
|
+
skills: z46.optional(z46.union([z46.string(), z46.array(z46.string())]))
|
|
12057
12639
|
});
|
|
12058
12640
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
12059
12641
|
frontmatter;
|
|
@@ -12063,7 +12645,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
12063
12645
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12064
12646
|
if (!result.success) {
|
|
12065
12647
|
throw new Error(
|
|
12066
|
-
`Invalid frontmatter in ${
|
|
12648
|
+
`Invalid frontmatter in ${join91(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12067
12649
|
);
|
|
12068
12650
|
}
|
|
12069
12651
|
}
|
|
@@ -12075,7 +12657,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
12075
12657
|
}
|
|
12076
12658
|
static getSettablePaths(_options = {}) {
|
|
12077
12659
|
return {
|
|
12078
|
-
relativeDirPath:
|
|
12660
|
+
relativeDirPath: join91(".claude", "agents")
|
|
12079
12661
|
};
|
|
12080
12662
|
}
|
|
12081
12663
|
getFrontmatter() {
|
|
@@ -12154,7 +12736,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
12154
12736
|
return {
|
|
12155
12737
|
success: false,
|
|
12156
12738
|
error: new Error(
|
|
12157
|
-
`Invalid frontmatter in ${
|
|
12739
|
+
`Invalid frontmatter in ${join91(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12158
12740
|
)
|
|
12159
12741
|
};
|
|
12160
12742
|
}
|
|
@@ -12172,7 +12754,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
12172
12754
|
global = false
|
|
12173
12755
|
}) {
|
|
12174
12756
|
const paths = this.getSettablePaths({ global });
|
|
12175
|
-
const filePath =
|
|
12757
|
+
const filePath = join91(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12176
12758
|
const fileContent = await readFileContent(filePath);
|
|
12177
12759
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12178
12760
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12207,27 +12789,27 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
12207
12789
|
};
|
|
12208
12790
|
|
|
12209
12791
|
// src/features/subagents/codexcli-subagent.ts
|
|
12210
|
-
import { join as
|
|
12211
|
-
import * as
|
|
12212
|
-
import { z as
|
|
12213
|
-
var CodexCliSubagentTomlSchema =
|
|
12214
|
-
name:
|
|
12215
|
-
description:
|
|
12216
|
-
developer_instructions:
|
|
12217
|
-
model:
|
|
12218
|
-
model_reasoning_effort:
|
|
12219
|
-
sandbox_mode:
|
|
12792
|
+
import { join as join92 } from "path";
|
|
12793
|
+
import * as smolToml3 from "smol-toml";
|
|
12794
|
+
import { z as z47 } from "zod/mini";
|
|
12795
|
+
var CodexCliSubagentTomlSchema = z47.looseObject({
|
|
12796
|
+
name: z47.string(),
|
|
12797
|
+
description: z47.optional(z47.string()),
|
|
12798
|
+
developer_instructions: z47.optional(z47.string()),
|
|
12799
|
+
model: z47.optional(z47.string()),
|
|
12800
|
+
model_reasoning_effort: z47.optional(z47.string()),
|
|
12801
|
+
sandbox_mode: z47.optional(z47.string())
|
|
12220
12802
|
});
|
|
12221
12803
|
var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
12222
12804
|
body;
|
|
12223
12805
|
constructor({ body, ...rest }) {
|
|
12224
12806
|
if (rest.validate !== false) {
|
|
12225
12807
|
try {
|
|
12226
|
-
const parsed =
|
|
12808
|
+
const parsed = smolToml3.parse(body);
|
|
12227
12809
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
12228
12810
|
} catch (error) {
|
|
12229
12811
|
throw new Error(
|
|
12230
|
-
`Invalid TOML in ${
|
|
12812
|
+
`Invalid TOML in ${join92(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
12231
12813
|
{ cause: error }
|
|
12232
12814
|
);
|
|
12233
12815
|
}
|
|
@@ -12239,7 +12821,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
12239
12821
|
}
|
|
12240
12822
|
static getSettablePaths(_options = {}) {
|
|
12241
12823
|
return {
|
|
12242
|
-
relativeDirPath:
|
|
12824
|
+
relativeDirPath: join92(".codex", "agents")
|
|
12243
12825
|
};
|
|
12244
12826
|
}
|
|
12245
12827
|
getBody() {
|
|
@@ -12248,10 +12830,10 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
12248
12830
|
toRulesyncSubagent() {
|
|
12249
12831
|
let parsed;
|
|
12250
12832
|
try {
|
|
12251
|
-
parsed = CodexCliSubagentTomlSchema.parse(
|
|
12833
|
+
parsed = CodexCliSubagentTomlSchema.parse(smolToml3.parse(this.body));
|
|
12252
12834
|
} catch (error) {
|
|
12253
12835
|
throw new Error(
|
|
12254
|
-
`Failed to parse TOML in ${
|
|
12836
|
+
`Failed to parse TOML in ${join92(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
12255
12837
|
{ cause: error }
|
|
12256
12838
|
);
|
|
12257
12839
|
}
|
|
@@ -12294,7 +12876,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
12294
12876
|
...rulesyncSubagent.getBody() ? { developer_instructions: rulesyncSubagent.getBody() } : {},
|
|
12295
12877
|
...codexcliSection
|
|
12296
12878
|
};
|
|
12297
|
-
const body =
|
|
12879
|
+
const body = smolToml3.stringify(tomlObj);
|
|
12298
12880
|
const paths = this.getSettablePaths({ global });
|
|
12299
12881
|
const relativeFilePath = rulesyncSubagent.getRelativeFilePath().replace(/\.md$/, ".toml");
|
|
12300
12882
|
return new _CodexCliSubagent({
|
|
@@ -12309,7 +12891,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
12309
12891
|
}
|
|
12310
12892
|
validate() {
|
|
12311
12893
|
try {
|
|
12312
|
-
const parsed =
|
|
12894
|
+
const parsed = smolToml3.parse(this.body);
|
|
12313
12895
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
12314
12896
|
return { success: true, error: null };
|
|
12315
12897
|
} catch (error) {
|
|
@@ -12332,7 +12914,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
12332
12914
|
global = false
|
|
12333
12915
|
}) {
|
|
12334
12916
|
const paths = this.getSettablePaths({ global });
|
|
12335
|
-
const filePath =
|
|
12917
|
+
const filePath = join92(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12336
12918
|
const fileContent = await readFileContent(filePath);
|
|
12337
12919
|
const subagent = new _CodexCliSubagent({
|
|
12338
12920
|
baseDir,
|
|
@@ -12370,13 +12952,13 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
12370
12952
|
};
|
|
12371
12953
|
|
|
12372
12954
|
// src/features/subagents/copilot-subagent.ts
|
|
12373
|
-
import { join as
|
|
12374
|
-
import { z as
|
|
12955
|
+
import { join as join93 } from "path";
|
|
12956
|
+
import { z as z48 } from "zod/mini";
|
|
12375
12957
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
12376
|
-
var CopilotSubagentFrontmatterSchema =
|
|
12377
|
-
name:
|
|
12378
|
-
description:
|
|
12379
|
-
tools:
|
|
12958
|
+
var CopilotSubagentFrontmatterSchema = z48.looseObject({
|
|
12959
|
+
name: z48.string(),
|
|
12960
|
+
description: z48.optional(z48.string()),
|
|
12961
|
+
tools: z48.optional(z48.union([z48.string(), z48.array(z48.string())]))
|
|
12380
12962
|
});
|
|
12381
12963
|
var normalizeTools = (tools) => {
|
|
12382
12964
|
if (!tools) {
|
|
@@ -12396,7 +12978,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
12396
12978
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12397
12979
|
if (!result.success) {
|
|
12398
12980
|
throw new Error(
|
|
12399
|
-
`Invalid frontmatter in ${
|
|
12981
|
+
`Invalid frontmatter in ${join93(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12400
12982
|
);
|
|
12401
12983
|
}
|
|
12402
12984
|
}
|
|
@@ -12408,7 +12990,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
12408
12990
|
}
|
|
12409
12991
|
static getSettablePaths(_options = {}) {
|
|
12410
12992
|
return {
|
|
12411
|
-
relativeDirPath:
|
|
12993
|
+
relativeDirPath: join93(".github", "agents")
|
|
12412
12994
|
};
|
|
12413
12995
|
}
|
|
12414
12996
|
getFrontmatter() {
|
|
@@ -12482,7 +13064,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
12482
13064
|
return {
|
|
12483
13065
|
success: false,
|
|
12484
13066
|
error: new Error(
|
|
12485
|
-
`Invalid frontmatter in ${
|
|
13067
|
+
`Invalid frontmatter in ${join93(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12486
13068
|
)
|
|
12487
13069
|
};
|
|
12488
13070
|
}
|
|
@@ -12500,7 +13082,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
12500
13082
|
global = false
|
|
12501
13083
|
}) {
|
|
12502
13084
|
const paths = this.getSettablePaths({ global });
|
|
12503
|
-
const filePath =
|
|
13085
|
+
const filePath = join93(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12504
13086
|
const fileContent = await readFileContent(filePath);
|
|
12505
13087
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12506
13088
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12536,11 +13118,11 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
12536
13118
|
};
|
|
12537
13119
|
|
|
12538
13120
|
// src/features/subagents/cursor-subagent.ts
|
|
12539
|
-
import { join as
|
|
12540
|
-
import { z as
|
|
12541
|
-
var CursorSubagentFrontmatterSchema =
|
|
12542
|
-
name:
|
|
12543
|
-
description:
|
|
13121
|
+
import { join as join94 } from "path";
|
|
13122
|
+
import { z as z49 } from "zod/mini";
|
|
13123
|
+
var CursorSubagentFrontmatterSchema = z49.looseObject({
|
|
13124
|
+
name: z49.string(),
|
|
13125
|
+
description: z49.optional(z49.string())
|
|
12544
13126
|
});
|
|
12545
13127
|
var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
12546
13128
|
frontmatter;
|
|
@@ -12550,7 +13132,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12550
13132
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12551
13133
|
if (!result.success) {
|
|
12552
13134
|
throw new Error(
|
|
12553
|
-
`Invalid frontmatter in ${
|
|
13135
|
+
`Invalid frontmatter in ${join94(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12554
13136
|
);
|
|
12555
13137
|
}
|
|
12556
13138
|
}
|
|
@@ -12562,7 +13144,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12562
13144
|
}
|
|
12563
13145
|
static getSettablePaths(_options = {}) {
|
|
12564
13146
|
return {
|
|
12565
|
-
relativeDirPath:
|
|
13147
|
+
relativeDirPath: join94(".cursor", "agents")
|
|
12566
13148
|
};
|
|
12567
13149
|
}
|
|
12568
13150
|
getFrontmatter() {
|
|
@@ -12629,7 +13211,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12629
13211
|
return {
|
|
12630
13212
|
success: false,
|
|
12631
13213
|
error: new Error(
|
|
12632
|
-
`Invalid frontmatter in ${
|
|
13214
|
+
`Invalid frontmatter in ${join94(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12633
13215
|
)
|
|
12634
13216
|
};
|
|
12635
13217
|
}
|
|
@@ -12647,7 +13229,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12647
13229
|
global = false
|
|
12648
13230
|
}) {
|
|
12649
13231
|
const paths = this.getSettablePaths({ global });
|
|
12650
|
-
const filePath =
|
|
13232
|
+
const filePath = join94(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12651
13233
|
const fileContent = await readFileContent(filePath);
|
|
12652
13234
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12653
13235
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12683,12 +13265,12 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12683
13265
|
};
|
|
12684
13266
|
|
|
12685
13267
|
// src/features/subagents/deepagents-subagent.ts
|
|
12686
|
-
import { join as
|
|
12687
|
-
import { z as
|
|
12688
|
-
var DeepagentsSubagentFrontmatterSchema =
|
|
12689
|
-
name:
|
|
12690
|
-
description:
|
|
12691
|
-
model:
|
|
13268
|
+
import { join as join95 } from "path";
|
|
13269
|
+
import { z as z50 } from "zod/mini";
|
|
13270
|
+
var DeepagentsSubagentFrontmatterSchema = z50.looseObject({
|
|
13271
|
+
name: z50.string(),
|
|
13272
|
+
description: z50.optional(z50.string()),
|
|
13273
|
+
model: z50.optional(z50.string())
|
|
12692
13274
|
});
|
|
12693
13275
|
var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
12694
13276
|
frontmatter;
|
|
@@ -12698,7 +13280,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
12698
13280
|
const result = DeepagentsSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12699
13281
|
if (!result.success) {
|
|
12700
13282
|
throw new Error(
|
|
12701
|
-
`Invalid frontmatter in ${
|
|
13283
|
+
`Invalid frontmatter in ${join95(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12702
13284
|
);
|
|
12703
13285
|
}
|
|
12704
13286
|
}
|
|
@@ -12708,7 +13290,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
12708
13290
|
}
|
|
12709
13291
|
static getSettablePaths(_options = {}) {
|
|
12710
13292
|
return {
|
|
12711
|
-
relativeDirPath:
|
|
13293
|
+
relativeDirPath: join95(".deepagents", "agents")
|
|
12712
13294
|
};
|
|
12713
13295
|
}
|
|
12714
13296
|
getFrontmatter() {
|
|
@@ -12783,7 +13365,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
12783
13365
|
return {
|
|
12784
13366
|
success: false,
|
|
12785
13367
|
error: new Error(
|
|
12786
|
-
`Invalid frontmatter in ${
|
|
13368
|
+
`Invalid frontmatter in ${join95(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12787
13369
|
)
|
|
12788
13370
|
};
|
|
12789
13371
|
}
|
|
@@ -12801,7 +13383,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
12801
13383
|
global = false
|
|
12802
13384
|
}) {
|
|
12803
13385
|
const paths = this.getSettablePaths({ global });
|
|
12804
|
-
const filePath =
|
|
13386
|
+
const filePath = join95(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12805
13387
|
const fileContent = await readFileContent(filePath);
|
|
12806
13388
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12807
13389
|
const result = DeepagentsSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12836,11 +13418,11 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
12836
13418
|
};
|
|
12837
13419
|
|
|
12838
13420
|
// src/features/subagents/junie-subagent.ts
|
|
12839
|
-
import { join as
|
|
12840
|
-
import { z as
|
|
12841
|
-
var JunieSubagentFrontmatterSchema =
|
|
12842
|
-
name:
|
|
12843
|
-
description:
|
|
13421
|
+
import { join as join96 } from "path";
|
|
13422
|
+
import { z as z51 } from "zod/mini";
|
|
13423
|
+
var JunieSubagentFrontmatterSchema = z51.looseObject({
|
|
13424
|
+
name: z51.optional(z51.string()),
|
|
13425
|
+
description: z51.string()
|
|
12844
13426
|
});
|
|
12845
13427
|
var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
12846
13428
|
frontmatter;
|
|
@@ -12850,7 +13432,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12850
13432
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12851
13433
|
if (!result.success) {
|
|
12852
13434
|
throw new Error(
|
|
12853
|
-
`Invalid frontmatter in ${
|
|
13435
|
+
`Invalid frontmatter in ${join96(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12854
13436
|
);
|
|
12855
13437
|
}
|
|
12856
13438
|
}
|
|
@@ -12865,7 +13447,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12865
13447
|
throw new Error("JunieSubagent does not support global mode.");
|
|
12866
13448
|
}
|
|
12867
13449
|
return {
|
|
12868
|
-
relativeDirPath:
|
|
13450
|
+
relativeDirPath: join96(".junie", "agents")
|
|
12869
13451
|
};
|
|
12870
13452
|
}
|
|
12871
13453
|
getFrontmatter() {
|
|
@@ -12941,7 +13523,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12941
13523
|
return {
|
|
12942
13524
|
success: false,
|
|
12943
13525
|
error: new Error(
|
|
12944
|
-
`Invalid frontmatter in ${
|
|
13526
|
+
`Invalid frontmatter in ${join96(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12945
13527
|
)
|
|
12946
13528
|
};
|
|
12947
13529
|
}
|
|
@@ -12959,7 +13541,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12959
13541
|
global = false
|
|
12960
13542
|
}) {
|
|
12961
13543
|
const paths = this.getSettablePaths({ global });
|
|
12962
|
-
const filePath =
|
|
13544
|
+
const filePath = join96(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12963
13545
|
const fileContent = await readFileContent(filePath);
|
|
12964
13546
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12965
13547
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12994,23 +13576,23 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12994
13576
|
};
|
|
12995
13577
|
|
|
12996
13578
|
// src/features/subagents/kiro-subagent.ts
|
|
12997
|
-
import { join as
|
|
12998
|
-
import { z as
|
|
12999
|
-
var KiroCliSubagentJsonSchema =
|
|
13000
|
-
name:
|
|
13001
|
-
description:
|
|
13002
|
-
prompt:
|
|
13003
|
-
tools:
|
|
13004
|
-
toolAliases:
|
|
13005
|
-
toolSettings:
|
|
13006
|
-
toolSchema:
|
|
13007
|
-
hooks:
|
|
13008
|
-
model:
|
|
13009
|
-
mcpServers:
|
|
13010
|
-
useLegacyMcpJson:
|
|
13011
|
-
resources:
|
|
13012
|
-
allowedTools:
|
|
13013
|
-
includeMcpJson:
|
|
13579
|
+
import { join as join97 } from "path";
|
|
13580
|
+
import { z as z52 } from "zod/mini";
|
|
13581
|
+
var KiroCliSubagentJsonSchema = z52.looseObject({
|
|
13582
|
+
name: z52.string(),
|
|
13583
|
+
description: z52.optional(z52.nullable(z52.string())),
|
|
13584
|
+
prompt: z52.optional(z52.nullable(z52.string())),
|
|
13585
|
+
tools: z52.optional(z52.nullable(z52.array(z52.string()))),
|
|
13586
|
+
toolAliases: z52.optional(z52.nullable(z52.record(z52.string(), z52.string()))),
|
|
13587
|
+
toolSettings: z52.optional(z52.nullable(z52.unknown())),
|
|
13588
|
+
toolSchema: z52.optional(z52.nullable(z52.unknown())),
|
|
13589
|
+
hooks: z52.optional(z52.nullable(z52.record(z52.string(), z52.array(z52.unknown())))),
|
|
13590
|
+
model: z52.optional(z52.nullable(z52.string())),
|
|
13591
|
+
mcpServers: z52.optional(z52.nullable(z52.record(z52.string(), z52.unknown()))),
|
|
13592
|
+
useLegacyMcpJson: z52.optional(z52.nullable(z52.boolean())),
|
|
13593
|
+
resources: z52.optional(z52.nullable(z52.array(z52.string()))),
|
|
13594
|
+
allowedTools: z52.optional(z52.nullable(z52.array(z52.string()))),
|
|
13595
|
+
includeMcpJson: z52.optional(z52.nullable(z52.boolean()))
|
|
13014
13596
|
});
|
|
13015
13597
|
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
13016
13598
|
body;
|
|
@@ -13021,7 +13603,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
13021
13603
|
KiroCliSubagentJsonSchema.parse(parsed);
|
|
13022
13604
|
} catch (error) {
|
|
13023
13605
|
throw new Error(
|
|
13024
|
-
`Invalid JSON in ${
|
|
13606
|
+
`Invalid JSON in ${join97(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
13025
13607
|
{ cause: error }
|
|
13026
13608
|
);
|
|
13027
13609
|
}
|
|
@@ -13033,7 +13615,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
13033
13615
|
}
|
|
13034
13616
|
static getSettablePaths(_options = {}) {
|
|
13035
13617
|
return {
|
|
13036
|
-
relativeDirPath:
|
|
13618
|
+
relativeDirPath: join97(".kiro", "agents")
|
|
13037
13619
|
};
|
|
13038
13620
|
}
|
|
13039
13621
|
getBody() {
|
|
@@ -13045,7 +13627,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
13045
13627
|
parsed = JSON.parse(this.body);
|
|
13046
13628
|
} catch (error) {
|
|
13047
13629
|
throw new Error(
|
|
13048
|
-
`Failed to parse JSON in ${
|
|
13630
|
+
`Failed to parse JSON in ${join97(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
13049
13631
|
{ cause: error }
|
|
13050
13632
|
);
|
|
13051
13633
|
}
|
|
@@ -13126,7 +13708,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
13126
13708
|
global = false
|
|
13127
13709
|
}) {
|
|
13128
13710
|
const paths = this.getSettablePaths({ global });
|
|
13129
|
-
const filePath =
|
|
13711
|
+
const filePath = join97(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
13130
13712
|
const fileContent = await readFileContent(filePath);
|
|
13131
13713
|
const subagent = new _KiroSubagent({
|
|
13132
13714
|
baseDir,
|
|
@@ -13164,12 +13746,12 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
13164
13746
|
};
|
|
13165
13747
|
|
|
13166
13748
|
// src/features/subagents/opencode-subagent.ts
|
|
13167
|
-
import { basename as basename8, join as
|
|
13168
|
-
import { z as
|
|
13169
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
13170
|
-
description:
|
|
13171
|
-
mode:
|
|
13172
|
-
name:
|
|
13749
|
+
import { basename as basename8, join as join98 } from "path";
|
|
13750
|
+
import { z as z53 } from "zod/mini";
|
|
13751
|
+
var OpenCodeSubagentFrontmatterSchema = z53.looseObject({
|
|
13752
|
+
description: z53.optional(z53.string()),
|
|
13753
|
+
mode: z53._default(z53.string(), "subagent"),
|
|
13754
|
+
name: z53.optional(z53.string())
|
|
13173
13755
|
});
|
|
13174
13756
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
13175
13757
|
frontmatter;
|
|
@@ -13179,7 +13761,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
13179
13761
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
13180
13762
|
if (!result.success) {
|
|
13181
13763
|
throw new Error(
|
|
13182
|
-
`Invalid frontmatter in ${
|
|
13764
|
+
`Invalid frontmatter in ${join98(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13183
13765
|
);
|
|
13184
13766
|
}
|
|
13185
13767
|
}
|
|
@@ -13193,7 +13775,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
13193
13775
|
global = false
|
|
13194
13776
|
} = {}) {
|
|
13195
13777
|
return {
|
|
13196
|
-
relativeDirPath: global ?
|
|
13778
|
+
relativeDirPath: global ? join98(".config", "opencode", "agent") : join98(".opencode", "agent")
|
|
13197
13779
|
};
|
|
13198
13780
|
}
|
|
13199
13781
|
getFrontmatter() {
|
|
@@ -13259,7 +13841,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
13259
13841
|
return {
|
|
13260
13842
|
success: false,
|
|
13261
13843
|
error: new Error(
|
|
13262
|
-
`Invalid frontmatter in ${
|
|
13844
|
+
`Invalid frontmatter in ${join98(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13263
13845
|
)
|
|
13264
13846
|
};
|
|
13265
13847
|
}
|
|
@@ -13276,7 +13858,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
13276
13858
|
global = false
|
|
13277
13859
|
}) {
|
|
13278
13860
|
const paths = this.getSettablePaths({ global });
|
|
13279
|
-
const filePath =
|
|
13861
|
+
const filePath = join98(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
13280
13862
|
const fileContent = await readFileContent(filePath);
|
|
13281
13863
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13282
13864
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -13325,9 +13907,10 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
13325
13907
|
"junie",
|
|
13326
13908
|
"kiro",
|
|
13327
13909
|
"opencode",
|
|
13328
|
-
"roo"
|
|
13910
|
+
"roo",
|
|
13911
|
+
"rovodev"
|
|
13329
13912
|
];
|
|
13330
|
-
var SubagentsProcessorToolTargetSchema =
|
|
13913
|
+
var SubagentsProcessorToolTargetSchema = z54.enum(subagentsProcessorToolTargetTuple);
|
|
13331
13914
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
13332
13915
|
[
|
|
13333
13916
|
"agentsmd",
|
|
@@ -13419,6 +14002,13 @@ var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
|
13419
14002
|
class: RooSubagent,
|
|
13420
14003
|
meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
|
|
13421
14004
|
}
|
|
14005
|
+
],
|
|
14006
|
+
[
|
|
14007
|
+
"rovodev",
|
|
14008
|
+
{
|
|
14009
|
+
class: RovodevSubagent,
|
|
14010
|
+
meta: { supportsSimulated: false, supportsGlobal: true, filePattern: "*.md" }
|
|
14011
|
+
}
|
|
13422
14012
|
]
|
|
13423
14013
|
]);
|
|
13424
14014
|
var defaultGetFactory5 = (target) => {
|
|
@@ -13504,7 +14094,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
13504
14094
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
13505
14095
|
*/
|
|
13506
14096
|
async loadRulesyncFiles() {
|
|
13507
|
-
const subagentsDir =
|
|
14097
|
+
const subagentsDir = join99(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
13508
14098
|
const dirExists = await directoryExists(subagentsDir);
|
|
13509
14099
|
if (!dirExists) {
|
|
13510
14100
|
this.logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -13519,7 +14109,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
13519
14109
|
this.logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
13520
14110
|
const rulesyncSubagents = [];
|
|
13521
14111
|
for (const mdFile of mdFiles) {
|
|
13522
|
-
const filepath =
|
|
14112
|
+
const filepath = join99(subagentsDir, mdFile);
|
|
13523
14113
|
try {
|
|
13524
14114
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
13525
14115
|
relativeFilePath: mdFile,
|
|
@@ -13549,7 +14139,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
13549
14139
|
const factory = this.getFactory(this.toolTarget);
|
|
13550
14140
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
13551
14141
|
const subagentFilePaths = await findFilesByGlobs(
|
|
13552
|
-
|
|
14142
|
+
join99(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
13553
14143
|
);
|
|
13554
14144
|
if (forDeletion) {
|
|
13555
14145
|
const toolSubagents2 = subagentFilePaths.map(
|
|
@@ -13616,49 +14206,49 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
13616
14206
|
};
|
|
13617
14207
|
|
|
13618
14208
|
// src/features/rules/agentsmd-rule.ts
|
|
13619
|
-
import { join as
|
|
14209
|
+
import { join as join102 } from "path";
|
|
13620
14210
|
|
|
13621
14211
|
// src/features/rules/tool-rule.ts
|
|
13622
|
-
import { join as
|
|
14212
|
+
import { join as join101 } from "path";
|
|
13623
14213
|
|
|
13624
14214
|
// src/features/rules/rulesync-rule.ts
|
|
13625
|
-
import { join as
|
|
13626
|
-
import { z as
|
|
13627
|
-
var RulesyncRuleFrontmatterSchema =
|
|
13628
|
-
root:
|
|
13629
|
-
localRoot:
|
|
13630
|
-
targets:
|
|
13631
|
-
description:
|
|
13632
|
-
globs:
|
|
13633
|
-
agentsmd:
|
|
13634
|
-
|
|
14215
|
+
import { join as join100 } from "path";
|
|
14216
|
+
import { z as z55 } from "zod/mini";
|
|
14217
|
+
var RulesyncRuleFrontmatterSchema = z55.object({
|
|
14218
|
+
root: z55.optional(z55.boolean()),
|
|
14219
|
+
localRoot: z55.optional(z55.boolean()),
|
|
14220
|
+
targets: z55._default(RulesyncTargetsSchema, ["*"]),
|
|
14221
|
+
description: z55.optional(z55.string()),
|
|
14222
|
+
globs: z55.optional(z55.array(z55.string())),
|
|
14223
|
+
agentsmd: z55.optional(
|
|
14224
|
+
z55.looseObject({
|
|
13635
14225
|
// @example "path/to/subproject"
|
|
13636
|
-
subprojectPath:
|
|
14226
|
+
subprojectPath: z55.optional(z55.string())
|
|
13637
14227
|
})
|
|
13638
14228
|
),
|
|
13639
|
-
claudecode:
|
|
13640
|
-
|
|
14229
|
+
claudecode: z55.optional(
|
|
14230
|
+
z55.looseObject({
|
|
13641
14231
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
13642
14232
|
// @example ["src/**/*.ts", "tests/**/*.test.ts"]
|
|
13643
|
-
paths:
|
|
14233
|
+
paths: z55.optional(z55.array(z55.string()))
|
|
13644
14234
|
})
|
|
13645
14235
|
),
|
|
13646
|
-
cursor:
|
|
13647
|
-
|
|
13648
|
-
alwaysApply:
|
|
13649
|
-
description:
|
|
13650
|
-
globs:
|
|
14236
|
+
cursor: z55.optional(
|
|
14237
|
+
z55.looseObject({
|
|
14238
|
+
alwaysApply: z55.optional(z55.boolean()),
|
|
14239
|
+
description: z55.optional(z55.string()),
|
|
14240
|
+
globs: z55.optional(z55.array(z55.string()))
|
|
13651
14241
|
})
|
|
13652
14242
|
),
|
|
13653
|
-
copilot:
|
|
13654
|
-
|
|
13655
|
-
excludeAgent:
|
|
14243
|
+
copilot: z55.optional(
|
|
14244
|
+
z55.looseObject({
|
|
14245
|
+
excludeAgent: z55.optional(z55.union([z55.literal("code-review"), z55.literal("coding-agent")]))
|
|
13656
14246
|
})
|
|
13657
14247
|
),
|
|
13658
|
-
antigravity:
|
|
13659
|
-
|
|
13660
|
-
trigger:
|
|
13661
|
-
globs:
|
|
14248
|
+
antigravity: z55.optional(
|
|
14249
|
+
z55.looseObject({
|
|
14250
|
+
trigger: z55.optional(z55.string()),
|
|
14251
|
+
globs: z55.optional(z55.array(z55.string()))
|
|
13662
14252
|
})
|
|
13663
14253
|
)
|
|
13664
14254
|
});
|
|
@@ -13669,7 +14259,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
13669
14259
|
const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13670
14260
|
if (!parseResult.success && rest.validate !== false) {
|
|
13671
14261
|
throw new Error(
|
|
13672
|
-
`Invalid frontmatter in ${
|
|
14262
|
+
`Invalid frontmatter in ${join100(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
13673
14263
|
);
|
|
13674
14264
|
}
|
|
13675
14265
|
const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
|
|
@@ -13704,7 +14294,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
13704
14294
|
return {
|
|
13705
14295
|
success: false,
|
|
13706
14296
|
error: new Error(
|
|
13707
|
-
`Invalid frontmatter in ${
|
|
14297
|
+
`Invalid frontmatter in ${join100(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13708
14298
|
)
|
|
13709
14299
|
};
|
|
13710
14300
|
}
|
|
@@ -13713,7 +14303,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
13713
14303
|
relativeFilePath,
|
|
13714
14304
|
validate = true
|
|
13715
14305
|
}) {
|
|
13716
|
-
const filePath =
|
|
14306
|
+
const filePath = join100(
|
|
13717
14307
|
process.cwd(),
|
|
13718
14308
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
13719
14309
|
relativeFilePath
|
|
@@ -13725,16 +14315,10 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
13725
14315
|
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
13726
14316
|
}
|
|
13727
14317
|
const validatedFrontmatter = {
|
|
14318
|
+
...result.data,
|
|
13728
14319
|
root: result.data.root ?? false,
|
|
13729
14320
|
localRoot: result.data.localRoot ?? false,
|
|
13730
|
-
|
|
13731
|
-
description: result.data.description,
|
|
13732
|
-
globs: result.data.globs ?? [],
|
|
13733
|
-
agentsmd: result.data.agentsmd,
|
|
13734
|
-
claudecode: result.data.claudecode,
|
|
13735
|
-
cursor: result.data.cursor,
|
|
13736
|
-
copilot: result.data.copilot,
|
|
13737
|
-
antigravity: result.data.antigravity
|
|
14321
|
+
globs: result.data.globs ?? []
|
|
13738
14322
|
};
|
|
13739
14323
|
return new _RulesyncRule({
|
|
13740
14324
|
baseDir: process.cwd(),
|
|
@@ -13818,7 +14402,7 @@ var ToolRule = class extends ToolFile {
|
|
|
13818
14402
|
rulesyncRule,
|
|
13819
14403
|
validate = true,
|
|
13820
14404
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
13821
|
-
nonRootPath = { relativeDirPath:
|
|
14405
|
+
nonRootPath = { relativeDirPath: join101(".agents", "memories") }
|
|
13822
14406
|
}) {
|
|
13823
14407
|
const params = this.buildToolRuleParamsDefault({
|
|
13824
14408
|
baseDir,
|
|
@@ -13829,7 +14413,7 @@ var ToolRule = class extends ToolFile {
|
|
|
13829
14413
|
});
|
|
13830
14414
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
13831
14415
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
13832
|
-
params.relativeDirPath =
|
|
14416
|
+
params.relativeDirPath = join101(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
13833
14417
|
params.relativeFilePath = "AGENTS.md";
|
|
13834
14418
|
}
|
|
13835
14419
|
return params;
|
|
@@ -13878,7 +14462,7 @@ var ToolRule = class extends ToolFile {
|
|
|
13878
14462
|
}
|
|
13879
14463
|
};
|
|
13880
14464
|
function buildToolPath(toolDir, subDir, excludeToolDir) {
|
|
13881
|
-
return excludeToolDir ? subDir :
|
|
14465
|
+
return excludeToolDir ? subDir : join101(toolDir, subDir);
|
|
13882
14466
|
}
|
|
13883
14467
|
|
|
13884
14468
|
// src/features/rules/agentsmd-rule.ts
|
|
@@ -13907,8 +14491,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
13907
14491
|
validate = true
|
|
13908
14492
|
}) {
|
|
13909
14493
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
13910
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
13911
|
-
const fileContent = await readFileContent(
|
|
14494
|
+
const relativePath = isRoot ? "AGENTS.md" : join102(".agents", "memories", relativeFilePath);
|
|
14495
|
+
const fileContent = await readFileContent(join102(baseDir, relativePath));
|
|
13912
14496
|
return new _AgentsMdRule({
|
|
13913
14497
|
baseDir,
|
|
13914
14498
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -13963,21 +14547,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
13963
14547
|
};
|
|
13964
14548
|
|
|
13965
14549
|
// src/features/rules/antigravity-rule.ts
|
|
13966
|
-
import { join as
|
|
13967
|
-
import { z as
|
|
13968
|
-
var AntigravityRuleFrontmatterSchema =
|
|
13969
|
-
trigger:
|
|
13970
|
-
|
|
13971
|
-
|
|
13972
|
-
|
|
13973
|
-
|
|
13974
|
-
|
|
13975
|
-
|
|
14550
|
+
import { join as join103 } from "path";
|
|
14551
|
+
import { z as z56 } from "zod/mini";
|
|
14552
|
+
var AntigravityRuleFrontmatterSchema = z56.looseObject({
|
|
14553
|
+
trigger: z56.optional(
|
|
14554
|
+
z56.union([
|
|
14555
|
+
z56.literal("always_on"),
|
|
14556
|
+
z56.literal("glob"),
|
|
14557
|
+
z56.literal("manual"),
|
|
14558
|
+
z56.literal("model_decision"),
|
|
14559
|
+
z56.string()
|
|
13976
14560
|
// accepts any string for forward compatibility
|
|
13977
14561
|
])
|
|
13978
14562
|
),
|
|
13979
|
-
globs:
|
|
13980
|
-
description:
|
|
14563
|
+
globs: z56.optional(z56.string()),
|
|
14564
|
+
description: z56.optional(z56.string())
|
|
13981
14565
|
});
|
|
13982
14566
|
function parseGlobsString(globs) {
|
|
13983
14567
|
if (!globs) {
|
|
@@ -14122,7 +14706,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
14122
14706
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14123
14707
|
if (!result.success) {
|
|
14124
14708
|
throw new Error(
|
|
14125
|
-
`Invalid frontmatter in ${
|
|
14709
|
+
`Invalid frontmatter in ${join103(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14126
14710
|
);
|
|
14127
14711
|
}
|
|
14128
14712
|
}
|
|
@@ -14146,7 +14730,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
14146
14730
|
relativeFilePath,
|
|
14147
14731
|
validate = true
|
|
14148
14732
|
}) {
|
|
14149
|
-
const filePath =
|
|
14733
|
+
const filePath = join103(
|
|
14150
14734
|
baseDir,
|
|
14151
14735
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
14152
14736
|
relativeFilePath
|
|
@@ -14286,7 +14870,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
14286
14870
|
};
|
|
14287
14871
|
|
|
14288
14872
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
14289
|
-
import { join as
|
|
14873
|
+
import { join as join104 } from "path";
|
|
14290
14874
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
14291
14875
|
toRulesyncRule() {
|
|
14292
14876
|
const rulesyncFrontmatter = {
|
|
@@ -14346,8 +14930,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
14346
14930
|
}) {
|
|
14347
14931
|
const settablePaths = this.getSettablePaths();
|
|
14348
14932
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
14349
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
14350
|
-
const fileContent = await readFileContent(
|
|
14933
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join104(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14934
|
+
const fileContent = await readFileContent(join104(baseDir, relativePath));
|
|
14351
14935
|
return new _AugmentcodeLegacyRule({
|
|
14352
14936
|
baseDir,
|
|
14353
14937
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -14376,7 +14960,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
14376
14960
|
};
|
|
14377
14961
|
|
|
14378
14962
|
// src/features/rules/augmentcode-rule.ts
|
|
14379
|
-
import { join as
|
|
14963
|
+
import { join as join105 } from "path";
|
|
14380
14964
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
14381
14965
|
toRulesyncRule() {
|
|
14382
14966
|
return this.toRulesyncRuleDefault();
|
|
@@ -14407,7 +14991,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
14407
14991
|
relativeFilePath,
|
|
14408
14992
|
validate = true
|
|
14409
14993
|
}) {
|
|
14410
|
-
const filePath =
|
|
14994
|
+
const filePath = join105(
|
|
14411
14995
|
baseDir,
|
|
14412
14996
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
14413
14997
|
relativeFilePath
|
|
@@ -14447,7 +15031,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
14447
15031
|
};
|
|
14448
15032
|
|
|
14449
15033
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
14450
|
-
import { join as
|
|
15034
|
+
import { join as join106 } from "path";
|
|
14451
15035
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
14452
15036
|
static getSettablePaths({
|
|
14453
15037
|
global,
|
|
@@ -14489,7 +15073,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
14489
15073
|
if (isRoot) {
|
|
14490
15074
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
14491
15075
|
const fileContent2 = await readFileContent(
|
|
14492
|
-
|
|
15076
|
+
join106(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
14493
15077
|
);
|
|
14494
15078
|
return new _ClaudecodeLegacyRule({
|
|
14495
15079
|
baseDir,
|
|
@@ -14503,8 +15087,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
14503
15087
|
if (!paths.nonRoot) {
|
|
14504
15088
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14505
15089
|
}
|
|
14506
|
-
const relativePath =
|
|
14507
|
-
const fileContent = await readFileContent(
|
|
15090
|
+
const relativePath = join106(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
15091
|
+
const fileContent = await readFileContent(join106(baseDir, relativePath));
|
|
14508
15092
|
return new _ClaudecodeLegacyRule({
|
|
14509
15093
|
baseDir,
|
|
14510
15094
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14563,10 +15147,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
14563
15147
|
};
|
|
14564
15148
|
|
|
14565
15149
|
// src/features/rules/claudecode-rule.ts
|
|
14566
|
-
import { join as
|
|
14567
|
-
import { z as
|
|
14568
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
14569
|
-
paths:
|
|
15150
|
+
import { join as join107 } from "path";
|
|
15151
|
+
import { z as z57 } from "zod/mini";
|
|
15152
|
+
var ClaudecodeRuleFrontmatterSchema = z57.object({
|
|
15153
|
+
paths: z57.optional(z57.array(z57.string()))
|
|
14570
15154
|
});
|
|
14571
15155
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
14572
15156
|
frontmatter;
|
|
@@ -14604,7 +15188,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14604
15188
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14605
15189
|
if (!result.success) {
|
|
14606
15190
|
throw new Error(
|
|
14607
|
-
`Invalid frontmatter in ${
|
|
15191
|
+
`Invalid frontmatter in ${join107(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14608
15192
|
);
|
|
14609
15193
|
}
|
|
14610
15194
|
}
|
|
@@ -14634,7 +15218,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14634
15218
|
if (isRoot) {
|
|
14635
15219
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
14636
15220
|
const fileContent2 = await readFileContent(
|
|
14637
|
-
|
|
15221
|
+
join107(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
14638
15222
|
);
|
|
14639
15223
|
return new _ClaudecodeRule({
|
|
14640
15224
|
baseDir,
|
|
@@ -14649,8 +15233,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14649
15233
|
if (!paths.nonRoot) {
|
|
14650
15234
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14651
15235
|
}
|
|
14652
|
-
const relativePath =
|
|
14653
|
-
const filePath =
|
|
15236
|
+
const relativePath = join107(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
15237
|
+
const filePath = join107(baseDir, relativePath);
|
|
14654
15238
|
const fileContent = await readFileContent(filePath);
|
|
14655
15239
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14656
15240
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14761,7 +15345,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14761
15345
|
return {
|
|
14762
15346
|
success: false,
|
|
14763
15347
|
error: new Error(
|
|
14764
|
-
`Invalid frontmatter in ${
|
|
15348
|
+
`Invalid frontmatter in ${join107(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14765
15349
|
)
|
|
14766
15350
|
};
|
|
14767
15351
|
}
|
|
@@ -14781,10 +15365,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14781
15365
|
};
|
|
14782
15366
|
|
|
14783
15367
|
// src/features/rules/cline-rule.ts
|
|
14784
|
-
import { join as
|
|
14785
|
-
import { z as
|
|
14786
|
-
var ClineRuleFrontmatterSchema =
|
|
14787
|
-
description:
|
|
15368
|
+
import { join as join108 } from "path";
|
|
15369
|
+
import { z as z58 } from "zod/mini";
|
|
15370
|
+
var ClineRuleFrontmatterSchema = z58.object({
|
|
15371
|
+
description: z58.string()
|
|
14788
15372
|
});
|
|
14789
15373
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
14790
15374
|
static getSettablePaths(_options = {}) {
|
|
@@ -14827,7 +15411,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
14827
15411
|
validate = true
|
|
14828
15412
|
}) {
|
|
14829
15413
|
const fileContent = await readFileContent(
|
|
14830
|
-
|
|
15414
|
+
join108(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14831
15415
|
);
|
|
14832
15416
|
return new _ClineRule({
|
|
14833
15417
|
baseDir,
|
|
@@ -14853,7 +15437,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
14853
15437
|
};
|
|
14854
15438
|
|
|
14855
15439
|
// src/features/rules/codexcli-rule.ts
|
|
14856
|
-
import { join as
|
|
15440
|
+
import { join as join109 } from "path";
|
|
14857
15441
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
14858
15442
|
static getSettablePaths({
|
|
14859
15443
|
global,
|
|
@@ -14888,7 +15472,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
14888
15472
|
if (isRoot) {
|
|
14889
15473
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14890
15474
|
const fileContent2 = await readFileContent(
|
|
14891
|
-
|
|
15475
|
+
join109(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14892
15476
|
);
|
|
14893
15477
|
return new _CodexcliRule({
|
|
14894
15478
|
baseDir,
|
|
@@ -14902,8 +15486,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
14902
15486
|
if (!paths.nonRoot) {
|
|
14903
15487
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14904
15488
|
}
|
|
14905
|
-
const relativePath =
|
|
14906
|
-
const fileContent = await readFileContent(
|
|
15489
|
+
const relativePath = join109(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
15490
|
+
const fileContent = await readFileContent(join109(baseDir, relativePath));
|
|
14907
15491
|
return new _CodexcliRule({
|
|
14908
15492
|
baseDir,
|
|
14909
15493
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14962,12 +15546,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
14962
15546
|
};
|
|
14963
15547
|
|
|
14964
15548
|
// src/features/rules/copilot-rule.ts
|
|
14965
|
-
import { join as
|
|
14966
|
-
import { z as
|
|
14967
|
-
var CopilotRuleFrontmatterSchema =
|
|
14968
|
-
description:
|
|
14969
|
-
applyTo:
|
|
14970
|
-
excludeAgent:
|
|
15549
|
+
import { join as join110 } from "path";
|
|
15550
|
+
import { z as z59 } from "zod/mini";
|
|
15551
|
+
var CopilotRuleFrontmatterSchema = z59.object({
|
|
15552
|
+
description: z59.optional(z59.string()),
|
|
15553
|
+
applyTo: z59.optional(z59.string()),
|
|
15554
|
+
excludeAgent: z59.optional(z59.union([z59.literal("code-review"), z59.literal("coding-agent")]))
|
|
14971
15555
|
});
|
|
14972
15556
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
14973
15557
|
frontmatter;
|
|
@@ -14999,7 +15583,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14999
15583
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
15000
15584
|
if (!result.success) {
|
|
15001
15585
|
throw new Error(
|
|
15002
|
-
`Invalid frontmatter in ${
|
|
15586
|
+
`Invalid frontmatter in ${join110(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
15003
15587
|
);
|
|
15004
15588
|
}
|
|
15005
15589
|
}
|
|
@@ -15089,8 +15673,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
15089
15673
|
const paths = this.getSettablePaths({ global });
|
|
15090
15674
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
15091
15675
|
if (isRoot) {
|
|
15092
|
-
const relativePath2 =
|
|
15093
|
-
const filePath2 =
|
|
15676
|
+
const relativePath2 = join110(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
15677
|
+
const filePath2 = join110(baseDir, relativePath2);
|
|
15094
15678
|
const fileContent2 = await readFileContent(filePath2);
|
|
15095
15679
|
return new _CopilotRule({
|
|
15096
15680
|
baseDir,
|
|
@@ -15105,8 +15689,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
15105
15689
|
if (!paths.nonRoot) {
|
|
15106
15690
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
15107
15691
|
}
|
|
15108
|
-
const relativePath =
|
|
15109
|
-
const filePath =
|
|
15692
|
+
const relativePath = join110(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
15693
|
+
const filePath = join110(baseDir, relativePath);
|
|
15110
15694
|
const fileContent = await readFileContent(filePath);
|
|
15111
15695
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
15112
15696
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -15152,7 +15736,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
15152
15736
|
return {
|
|
15153
15737
|
success: false,
|
|
15154
15738
|
error: new Error(
|
|
15155
|
-
`Invalid frontmatter in ${
|
|
15739
|
+
`Invalid frontmatter in ${join110(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
15156
15740
|
)
|
|
15157
15741
|
};
|
|
15158
15742
|
}
|
|
@@ -15172,12 +15756,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
15172
15756
|
};
|
|
15173
15757
|
|
|
15174
15758
|
// src/features/rules/cursor-rule.ts
|
|
15175
|
-
import { join as
|
|
15176
|
-
import { z as
|
|
15177
|
-
var CursorRuleFrontmatterSchema =
|
|
15178
|
-
description:
|
|
15179
|
-
globs:
|
|
15180
|
-
alwaysApply:
|
|
15759
|
+
import { join as join111 } from "path";
|
|
15760
|
+
import { z as z60 } from "zod/mini";
|
|
15761
|
+
var CursorRuleFrontmatterSchema = z60.object({
|
|
15762
|
+
description: z60.optional(z60.string()),
|
|
15763
|
+
globs: z60.optional(z60.string()),
|
|
15764
|
+
alwaysApply: z60.optional(z60.boolean())
|
|
15181
15765
|
});
|
|
15182
15766
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
15183
15767
|
frontmatter;
|
|
@@ -15194,7 +15778,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
15194
15778
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
15195
15779
|
if (!result.success) {
|
|
15196
15780
|
throw new Error(
|
|
15197
|
-
`Invalid frontmatter in ${
|
|
15781
|
+
`Invalid frontmatter in ${join111(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
15198
15782
|
);
|
|
15199
15783
|
}
|
|
15200
15784
|
}
|
|
@@ -15310,7 +15894,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
15310
15894
|
relativeFilePath,
|
|
15311
15895
|
validate = true
|
|
15312
15896
|
}) {
|
|
15313
|
-
const filePath =
|
|
15897
|
+
const filePath = join111(
|
|
15314
15898
|
baseDir,
|
|
15315
15899
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
15316
15900
|
relativeFilePath
|
|
@@ -15320,7 +15904,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
15320
15904
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
15321
15905
|
if (!result.success) {
|
|
15322
15906
|
throw new Error(
|
|
15323
|
-
`Invalid frontmatter in ${
|
|
15907
|
+
`Invalid frontmatter in ${join111(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
15324
15908
|
);
|
|
15325
15909
|
}
|
|
15326
15910
|
return new _CursorRule({
|
|
@@ -15357,7 +15941,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
15357
15941
|
return {
|
|
15358
15942
|
success: false,
|
|
15359
15943
|
error: new Error(
|
|
15360
|
-
`Invalid frontmatter in ${
|
|
15944
|
+
`Invalid frontmatter in ${join111(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
15361
15945
|
)
|
|
15362
15946
|
};
|
|
15363
15947
|
}
|
|
@@ -15377,7 +15961,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
15377
15961
|
};
|
|
15378
15962
|
|
|
15379
15963
|
// src/features/rules/deepagents-rule.ts
|
|
15380
|
-
import { join as
|
|
15964
|
+
import { join as join112 } from "path";
|
|
15381
15965
|
var DeepagentsRule = class _DeepagentsRule extends ToolRule {
|
|
15382
15966
|
constructor({ fileContent, root, ...rest }) {
|
|
15383
15967
|
super({
|
|
@@ -15403,8 +15987,8 @@ var DeepagentsRule = class _DeepagentsRule extends ToolRule {
|
|
|
15403
15987
|
validate = true
|
|
15404
15988
|
}) {
|
|
15405
15989
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
15406
|
-
const relativePath = isRoot ?
|
|
15407
|
-
const fileContent = await readFileContent(
|
|
15990
|
+
const relativePath = isRoot ? join112(".deepagents", "AGENTS.md") : join112(".deepagents", "memories", relativeFilePath);
|
|
15991
|
+
const fileContent = await readFileContent(join112(baseDir, relativePath));
|
|
15408
15992
|
return new _DeepagentsRule({
|
|
15409
15993
|
baseDir,
|
|
15410
15994
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -15459,7 +16043,7 @@ var DeepagentsRule = class _DeepagentsRule extends ToolRule {
|
|
|
15459
16043
|
};
|
|
15460
16044
|
|
|
15461
16045
|
// src/features/rules/factorydroid-rule.ts
|
|
15462
|
-
import { join as
|
|
16046
|
+
import { join as join113 } from "path";
|
|
15463
16047
|
var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
15464
16048
|
constructor({ fileContent, root, ...rest }) {
|
|
15465
16049
|
super({
|
|
@@ -15499,8 +16083,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
15499
16083
|
const paths = this.getSettablePaths({ global });
|
|
15500
16084
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
15501
16085
|
if (isRoot) {
|
|
15502
|
-
const relativePath2 =
|
|
15503
|
-
const fileContent2 = await readFileContent(
|
|
16086
|
+
const relativePath2 = join113(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
16087
|
+
const fileContent2 = await readFileContent(join113(baseDir, relativePath2));
|
|
15504
16088
|
return new _FactorydroidRule({
|
|
15505
16089
|
baseDir,
|
|
15506
16090
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -15513,8 +16097,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
15513
16097
|
if (!paths.nonRoot) {
|
|
15514
16098
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
15515
16099
|
}
|
|
15516
|
-
const relativePath =
|
|
15517
|
-
const fileContent = await readFileContent(
|
|
16100
|
+
const relativePath = join113(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
16101
|
+
const fileContent = await readFileContent(join113(baseDir, relativePath));
|
|
15518
16102
|
return new _FactorydroidRule({
|
|
15519
16103
|
baseDir,
|
|
15520
16104
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -15573,7 +16157,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
15573
16157
|
};
|
|
15574
16158
|
|
|
15575
16159
|
// src/features/rules/geminicli-rule.ts
|
|
15576
|
-
import { join as
|
|
16160
|
+
import { join as join114 } from "path";
|
|
15577
16161
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
15578
16162
|
static getSettablePaths({
|
|
15579
16163
|
global,
|
|
@@ -15608,7 +16192,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
15608
16192
|
if (isRoot) {
|
|
15609
16193
|
const relativePath2 = paths.root.relativeFilePath;
|
|
15610
16194
|
const fileContent2 = await readFileContent(
|
|
15611
|
-
|
|
16195
|
+
join114(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
15612
16196
|
);
|
|
15613
16197
|
return new _GeminiCliRule({
|
|
15614
16198
|
baseDir,
|
|
@@ -15622,8 +16206,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
15622
16206
|
if (!paths.nonRoot) {
|
|
15623
16207
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
15624
16208
|
}
|
|
15625
|
-
const relativePath =
|
|
15626
|
-
const fileContent = await readFileContent(
|
|
16209
|
+
const relativePath = join114(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
16210
|
+
const fileContent = await readFileContent(join114(baseDir, relativePath));
|
|
15627
16211
|
return new _GeminiCliRule({
|
|
15628
16212
|
baseDir,
|
|
15629
16213
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -15682,7 +16266,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
15682
16266
|
};
|
|
15683
16267
|
|
|
15684
16268
|
// src/features/rules/goose-rule.ts
|
|
15685
|
-
import { join as
|
|
16269
|
+
import { join as join115 } from "path";
|
|
15686
16270
|
var GooseRule = class _GooseRule extends ToolRule {
|
|
15687
16271
|
static getSettablePaths({
|
|
15688
16272
|
global,
|
|
@@ -15717,7 +16301,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
15717
16301
|
if (isRoot) {
|
|
15718
16302
|
const relativePath2 = paths.root.relativeFilePath;
|
|
15719
16303
|
const fileContent2 = await readFileContent(
|
|
15720
|
-
|
|
16304
|
+
join115(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
15721
16305
|
);
|
|
15722
16306
|
return new _GooseRule({
|
|
15723
16307
|
baseDir,
|
|
@@ -15731,8 +16315,8 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
15731
16315
|
if (!paths.nonRoot) {
|
|
15732
16316
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
15733
16317
|
}
|
|
15734
|
-
const relativePath =
|
|
15735
|
-
const fileContent = await readFileContent(
|
|
16318
|
+
const relativePath = join115(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
16319
|
+
const fileContent = await readFileContent(join115(baseDir, relativePath));
|
|
15736
16320
|
return new _GooseRule({
|
|
15737
16321
|
baseDir,
|
|
15738
16322
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -15791,7 +16375,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
15791
16375
|
};
|
|
15792
16376
|
|
|
15793
16377
|
// src/features/rules/junie-rule.ts
|
|
15794
|
-
import { join as
|
|
16378
|
+
import { join as join116 } from "path";
|
|
15795
16379
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
15796
16380
|
static getSettablePaths(_options = {}) {
|
|
15797
16381
|
return {
|
|
@@ -15810,8 +16394,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
15810
16394
|
validate = true
|
|
15811
16395
|
}) {
|
|
15812
16396
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
15813
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
15814
|
-
const fileContent = await readFileContent(
|
|
16397
|
+
const relativePath = isRoot ? "guidelines.md" : join116(".junie", "memories", relativeFilePath);
|
|
16398
|
+
const fileContent = await readFileContent(join116(baseDir, relativePath));
|
|
15815
16399
|
return new _JunieRule({
|
|
15816
16400
|
baseDir,
|
|
15817
16401
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -15866,7 +16450,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
15866
16450
|
};
|
|
15867
16451
|
|
|
15868
16452
|
// src/features/rules/kilo-rule.ts
|
|
15869
|
-
import { join as
|
|
16453
|
+
import { join as join117 } from "path";
|
|
15870
16454
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
15871
16455
|
static getSettablePaths(_options = {}) {
|
|
15872
16456
|
return {
|
|
@@ -15881,7 +16465,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
15881
16465
|
validate = true
|
|
15882
16466
|
}) {
|
|
15883
16467
|
const fileContent = await readFileContent(
|
|
15884
|
-
|
|
16468
|
+
join117(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15885
16469
|
);
|
|
15886
16470
|
return new _KiloRule({
|
|
15887
16471
|
baseDir,
|
|
@@ -15933,7 +16517,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
15933
16517
|
};
|
|
15934
16518
|
|
|
15935
16519
|
// src/features/rules/kiro-rule.ts
|
|
15936
|
-
import { join as
|
|
16520
|
+
import { join as join118 } from "path";
|
|
15937
16521
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
15938
16522
|
static getSettablePaths(_options = {}) {
|
|
15939
16523
|
return {
|
|
@@ -15948,7 +16532,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
15948
16532
|
validate = true
|
|
15949
16533
|
}) {
|
|
15950
16534
|
const fileContent = await readFileContent(
|
|
15951
|
-
|
|
16535
|
+
join118(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15952
16536
|
);
|
|
15953
16537
|
return new _KiroRule({
|
|
15954
16538
|
baseDir,
|
|
@@ -16002,7 +16586,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
16002
16586
|
};
|
|
16003
16587
|
|
|
16004
16588
|
// src/features/rules/opencode-rule.ts
|
|
16005
|
-
import { join as
|
|
16589
|
+
import { join as join119 } from "path";
|
|
16006
16590
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
16007
16591
|
static getSettablePaths({
|
|
16008
16592
|
global,
|
|
@@ -16037,7 +16621,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
16037
16621
|
if (isRoot) {
|
|
16038
16622
|
const relativePath2 = paths.root.relativeFilePath;
|
|
16039
16623
|
const fileContent2 = await readFileContent(
|
|
16040
|
-
|
|
16624
|
+
join119(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
16041
16625
|
);
|
|
16042
16626
|
return new _OpenCodeRule({
|
|
16043
16627
|
baseDir,
|
|
@@ -16051,8 +16635,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
16051
16635
|
if (!paths.nonRoot) {
|
|
16052
16636
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
16053
16637
|
}
|
|
16054
|
-
const relativePath =
|
|
16055
|
-
const fileContent = await readFileContent(
|
|
16638
|
+
const relativePath = join119(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
16639
|
+
const fileContent = await readFileContent(join119(baseDir, relativePath));
|
|
16056
16640
|
return new _OpenCodeRule({
|
|
16057
16641
|
baseDir,
|
|
16058
16642
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -16070,7 +16654,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
16070
16654
|
}) {
|
|
16071
16655
|
const paths = this.getSettablePaths({ global });
|
|
16072
16656
|
return new _OpenCodeRule(
|
|
16073
|
-
this.
|
|
16657
|
+
this.buildToolRuleParamsAgentsmd({
|
|
16074
16658
|
baseDir,
|
|
16075
16659
|
rulesyncRule,
|
|
16076
16660
|
validate,
|
|
@@ -16111,7 +16695,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
16111
16695
|
};
|
|
16112
16696
|
|
|
16113
16697
|
// src/features/rules/qwencode-rule.ts
|
|
16114
|
-
import { join as
|
|
16698
|
+
import { join as join120 } from "path";
|
|
16115
16699
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
16116
16700
|
static getSettablePaths(_options = {}) {
|
|
16117
16701
|
return {
|
|
@@ -16130,8 +16714,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
16130
16714
|
validate = true
|
|
16131
16715
|
}) {
|
|
16132
16716
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
16133
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
16134
|
-
const fileContent = await readFileContent(
|
|
16717
|
+
const relativePath = isRoot ? "QWEN.md" : join120(".qwen", "memories", relativeFilePath);
|
|
16718
|
+
const fileContent = await readFileContent(join120(baseDir, relativePath));
|
|
16135
16719
|
return new _QwencodeRule({
|
|
16136
16720
|
baseDir,
|
|
16137
16721
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -16183,7 +16767,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
16183
16767
|
};
|
|
16184
16768
|
|
|
16185
16769
|
// src/features/rules/replit-rule.ts
|
|
16186
|
-
import { join as
|
|
16770
|
+
import { join as join121 } from "path";
|
|
16187
16771
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
16188
16772
|
static getSettablePaths(_options = {}) {
|
|
16189
16773
|
return {
|
|
@@ -16205,7 +16789,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
16205
16789
|
}
|
|
16206
16790
|
const relativePath = paths.root.relativeFilePath;
|
|
16207
16791
|
const fileContent = await readFileContent(
|
|
16208
|
-
|
|
16792
|
+
join121(baseDir, paths.root.relativeDirPath, relativePath)
|
|
16209
16793
|
);
|
|
16210
16794
|
return new _ReplitRule({
|
|
16211
16795
|
baseDir,
|
|
@@ -16271,7 +16855,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
16271
16855
|
};
|
|
16272
16856
|
|
|
16273
16857
|
// src/features/rules/roo-rule.ts
|
|
16274
|
-
import { join as
|
|
16858
|
+
import { join as join122 } from "path";
|
|
16275
16859
|
var RooRule = class _RooRule extends ToolRule {
|
|
16276
16860
|
static getSettablePaths(_options = {}) {
|
|
16277
16861
|
return {
|
|
@@ -16286,7 +16870,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
16286
16870
|
validate = true
|
|
16287
16871
|
}) {
|
|
16288
16872
|
const fileContent = await readFileContent(
|
|
16289
|
-
|
|
16873
|
+
join122(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
16290
16874
|
);
|
|
16291
16875
|
return new _RooRule({
|
|
16292
16876
|
baseDir,
|
|
@@ -16354,8 +16938,210 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
16354
16938
|
}
|
|
16355
16939
|
};
|
|
16356
16940
|
|
|
16941
|
+
// src/features/rules/rovodev-rule.ts
|
|
16942
|
+
import { join as join123 } from "path";
|
|
16943
|
+
var DISALLOWED_ROVODEV_MODULAR_RULE_BASENAMES = /* @__PURE__ */ new Set(["AGENTS.md", "AGENTS.local.md"]);
|
|
16944
|
+
var RovodevRule = class _RovodevRule extends ToolRule {
|
|
16945
|
+
/**
|
|
16946
|
+
* Whether `relativePath` (posix-style path relative to modular-rules root) may be imported as a modular rule.
|
|
16947
|
+
* Rejects memory filenames that belong at repo root or under `.rovodev/AGENTS.md`.
|
|
16948
|
+
*/
|
|
16949
|
+
static isAllowedModularRulesRelativePath(relativePath) {
|
|
16950
|
+
if (!relativePath) {
|
|
16951
|
+
return false;
|
|
16952
|
+
}
|
|
16953
|
+
for (const segment of relativePath.split(/[/\\]/)) {
|
|
16954
|
+
if (segment === "" || segment === "." || segment === "..") {
|
|
16955
|
+
continue;
|
|
16956
|
+
}
|
|
16957
|
+
if (DISALLOWED_ROVODEV_MODULAR_RULE_BASENAMES.has(segment)) {
|
|
16958
|
+
return false;
|
|
16959
|
+
}
|
|
16960
|
+
}
|
|
16961
|
+
return true;
|
|
16962
|
+
}
|
|
16963
|
+
constructor({ fileContent, root, ...rest }) {
|
|
16964
|
+
super({
|
|
16965
|
+
...rest,
|
|
16966
|
+
fileContent,
|
|
16967
|
+
root: root ?? false
|
|
16968
|
+
});
|
|
16969
|
+
}
|
|
16970
|
+
static getSettablePaths({
|
|
16971
|
+
global = false
|
|
16972
|
+
} = {}) {
|
|
16973
|
+
const rovodevAgents = {
|
|
16974
|
+
relativeDirPath: ".rovodev",
|
|
16975
|
+
relativeFilePath: "AGENTS.md"
|
|
16976
|
+
};
|
|
16977
|
+
if (global) {
|
|
16978
|
+
return {
|
|
16979
|
+
root: rovodevAgents
|
|
16980
|
+
};
|
|
16981
|
+
}
|
|
16982
|
+
return {
|
|
16983
|
+
root: rovodevAgents,
|
|
16984
|
+
alternativeRoots: [{ relativeDirPath: ".", relativeFilePath: "AGENTS.md" }],
|
|
16985
|
+
nonRoot: {
|
|
16986
|
+
relativeDirPath: join123(".rovodev", ".rulesync", "modular-rules")
|
|
16987
|
+
}
|
|
16988
|
+
};
|
|
16989
|
+
}
|
|
16990
|
+
static async fromFile({
|
|
16991
|
+
baseDir = process.cwd(),
|
|
16992
|
+
relativeFilePath,
|
|
16993
|
+
relativeDirPath: overrideDirPath,
|
|
16994
|
+
validate = true,
|
|
16995
|
+
global = false
|
|
16996
|
+
}) {
|
|
16997
|
+
const paths = this.getSettablePaths({ global });
|
|
16998
|
+
if (!global && "nonRoot" in paths && paths.nonRoot && overrideDirPath === paths.nonRoot.relativeDirPath) {
|
|
16999
|
+
if (!this.isAllowedModularRulesRelativePath(relativeFilePath)) {
|
|
17000
|
+
throw new Error(
|
|
17001
|
+
`Reserved Rovodev memory basename under modular-rules (not a modular rule): ${join123(overrideDirPath, relativeFilePath)}`
|
|
17002
|
+
);
|
|
17003
|
+
}
|
|
17004
|
+
const fileContent2 = await readFileContent(join123(baseDir, overrideDirPath, relativeFilePath));
|
|
17005
|
+
return new _RovodevRule({
|
|
17006
|
+
baseDir,
|
|
17007
|
+
relativeDirPath: overrideDirPath,
|
|
17008
|
+
relativeFilePath,
|
|
17009
|
+
fileContent: fileContent2,
|
|
17010
|
+
validate,
|
|
17011
|
+
global,
|
|
17012
|
+
root: false
|
|
17013
|
+
});
|
|
17014
|
+
}
|
|
17015
|
+
const relativeDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
17016
|
+
const agentsMdExpectedLocationsDescription = "alternativeRoots" in paths && paths.alternativeRoots && paths.alternativeRoots.length > 0 ? `${join123(paths.root.relativeDirPath, paths.root.relativeFilePath)} or project root` : join123(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
17017
|
+
if (relativeFilePath !== "AGENTS.md") {
|
|
17018
|
+
throw new Error(
|
|
17019
|
+
`Rovodev rules support only AGENTS.md at ${agentsMdExpectedLocationsDescription}, got: ${join123(relativeDirPath, relativeFilePath)}`
|
|
17020
|
+
);
|
|
17021
|
+
}
|
|
17022
|
+
const allowed = relativeDirPath === paths.root.relativeDirPath || "alternativeRoots" in paths && paths.alternativeRoots?.some(
|
|
17023
|
+
(alt) => alt.relativeDirPath === relativeDirPath && alt.relativeFilePath === relativeFilePath
|
|
17024
|
+
);
|
|
17025
|
+
if (!allowed) {
|
|
17026
|
+
throw new Error(
|
|
17027
|
+
`Rovodev AGENTS.md must be at ${agentsMdExpectedLocationsDescription}, got: ${join123(relativeDirPath, relativeFilePath)}`
|
|
17028
|
+
);
|
|
17029
|
+
}
|
|
17030
|
+
const fileContent = await readFileContent(join123(baseDir, relativeDirPath, relativeFilePath));
|
|
17031
|
+
return new _RovodevRule({
|
|
17032
|
+
baseDir,
|
|
17033
|
+
relativeDirPath,
|
|
17034
|
+
relativeFilePath,
|
|
17035
|
+
fileContent,
|
|
17036
|
+
validate,
|
|
17037
|
+
global,
|
|
17038
|
+
root: true
|
|
17039
|
+
});
|
|
17040
|
+
}
|
|
17041
|
+
static forDeletion({
|
|
17042
|
+
baseDir = process.cwd(),
|
|
17043
|
+
relativeDirPath,
|
|
17044
|
+
relativeFilePath,
|
|
17045
|
+
global = false
|
|
17046
|
+
}) {
|
|
17047
|
+
return new _RovodevRule({
|
|
17048
|
+
baseDir,
|
|
17049
|
+
relativeDirPath: relativeDirPath ?? ".",
|
|
17050
|
+
relativeFilePath: relativeFilePath ?? "AGENTS.md",
|
|
17051
|
+
fileContent: "",
|
|
17052
|
+
validate: false,
|
|
17053
|
+
global,
|
|
17054
|
+
root: relativeFilePath === "AGENTS.md"
|
|
17055
|
+
});
|
|
17056
|
+
}
|
|
17057
|
+
static fromRulesyncRule({
|
|
17058
|
+
baseDir = process.cwd(),
|
|
17059
|
+
rulesyncRule,
|
|
17060
|
+
validate = true,
|
|
17061
|
+
global = false
|
|
17062
|
+
}) {
|
|
17063
|
+
const paths = this.getSettablePaths({ global });
|
|
17064
|
+
const isRoot = rulesyncRule.getFrontmatter().root ?? false;
|
|
17065
|
+
if (isRoot) {
|
|
17066
|
+
return new _RovodevRule(
|
|
17067
|
+
this.buildToolRuleParamsDefault({
|
|
17068
|
+
baseDir,
|
|
17069
|
+
rulesyncRule,
|
|
17070
|
+
validate,
|
|
17071
|
+
global,
|
|
17072
|
+
rootPath: paths.root,
|
|
17073
|
+
nonRootPath: void 0
|
|
17074
|
+
})
|
|
17075
|
+
);
|
|
17076
|
+
}
|
|
17077
|
+
if (global || !("nonRoot" in paths) || !paths.nonRoot) {
|
|
17078
|
+
throw new Error(
|
|
17079
|
+
"Rovodev non-root (modular) rules are only supported in project mode with .rovodev/.rulesync/modular-rules."
|
|
17080
|
+
);
|
|
17081
|
+
}
|
|
17082
|
+
const modularRelativePath = rulesyncRule.getRelativeFilePath();
|
|
17083
|
+
if (!this.isAllowedModularRulesRelativePath(modularRelativePath)) {
|
|
17084
|
+
throw new Error(
|
|
17085
|
+
`Reserved Rovodev memory basename in modular rule path: ${modularRelativePath}`
|
|
17086
|
+
);
|
|
17087
|
+
}
|
|
17088
|
+
return new _RovodevRule(
|
|
17089
|
+
this.buildToolRuleParamsDefault({
|
|
17090
|
+
baseDir,
|
|
17091
|
+
rulesyncRule,
|
|
17092
|
+
validate,
|
|
17093
|
+
global,
|
|
17094
|
+
rootPath: paths.root,
|
|
17095
|
+
nonRootPath: paths.nonRoot
|
|
17096
|
+
})
|
|
17097
|
+
);
|
|
17098
|
+
}
|
|
17099
|
+
toRulesyncRule() {
|
|
17100
|
+
if (this.getRelativeFilePath() === "AGENTS.local.md") {
|
|
17101
|
+
return new RulesyncRule({
|
|
17102
|
+
baseDir: this.getBaseDir(),
|
|
17103
|
+
relativeDirPath: RULESYNC_RULES_RELATIVE_DIR_PATH,
|
|
17104
|
+
relativeFilePath: "AGENTS.local.md",
|
|
17105
|
+
frontmatter: {
|
|
17106
|
+
targets: ["rovodev"],
|
|
17107
|
+
root: false,
|
|
17108
|
+
localRoot: true,
|
|
17109
|
+
globs: []
|
|
17110
|
+
},
|
|
17111
|
+
body: this.getFileContent(),
|
|
17112
|
+
validate: true
|
|
17113
|
+
});
|
|
17114
|
+
}
|
|
17115
|
+
if (!this.isRoot()) {
|
|
17116
|
+
return new RulesyncRule({
|
|
17117
|
+
baseDir: this.getBaseDir(),
|
|
17118
|
+
relativeDirPath: RULESYNC_RULES_RELATIVE_DIR_PATH,
|
|
17119
|
+
relativeFilePath: this.getRelativeFilePath(),
|
|
17120
|
+
frontmatter: {
|
|
17121
|
+
targets: ["rovodev"],
|
|
17122
|
+
root: false,
|
|
17123
|
+
globs: this.globs ?? [],
|
|
17124
|
+
...this.description !== void 0 ? { description: this.description } : {}
|
|
17125
|
+
},
|
|
17126
|
+
body: this.getFileContent(),
|
|
17127
|
+
validate: true
|
|
17128
|
+
});
|
|
17129
|
+
}
|
|
17130
|
+
return this.toRulesyncRuleDefault();
|
|
17131
|
+
}
|
|
17132
|
+
validate() {
|
|
17133
|
+
return { success: true, error: null };
|
|
17134
|
+
}
|
|
17135
|
+
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
17136
|
+
return this.isTargetedByRulesyncRuleDefault({
|
|
17137
|
+
rulesyncRule,
|
|
17138
|
+
toolTarget: "rovodev"
|
|
17139
|
+
});
|
|
17140
|
+
}
|
|
17141
|
+
};
|
|
17142
|
+
|
|
16357
17143
|
// src/features/rules/warp-rule.ts
|
|
16358
|
-
import { join as
|
|
17144
|
+
import { join as join124 } from "path";
|
|
16359
17145
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
16360
17146
|
constructor({ fileContent, root, ...rest }) {
|
|
16361
17147
|
super({
|
|
@@ -16381,8 +17167,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
16381
17167
|
validate = true
|
|
16382
17168
|
}) {
|
|
16383
17169
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
16384
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
16385
|
-
const fileContent = await readFileContent(
|
|
17170
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join124(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
17171
|
+
const fileContent = await readFileContent(join124(baseDir, relativePath));
|
|
16386
17172
|
return new _WarpRule({
|
|
16387
17173
|
baseDir,
|
|
16388
17174
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -16437,7 +17223,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
16437
17223
|
};
|
|
16438
17224
|
|
|
16439
17225
|
// src/features/rules/windsurf-rule.ts
|
|
16440
|
-
import { join as
|
|
17226
|
+
import { join as join125 } from "path";
|
|
16441
17227
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
16442
17228
|
static getSettablePaths(_options = {}) {
|
|
16443
17229
|
return {
|
|
@@ -16452,7 +17238,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
16452
17238
|
validate = true
|
|
16453
17239
|
}) {
|
|
16454
17240
|
const fileContent = await readFileContent(
|
|
16455
|
-
|
|
17241
|
+
join125(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
16456
17242
|
);
|
|
16457
17243
|
return new _WindsurfRule({
|
|
16458
17244
|
baseDir,
|
|
@@ -16526,11 +17312,12 @@ var rulesProcessorToolTargets = [
|
|
|
16526
17312
|
"qwencode",
|
|
16527
17313
|
"replit",
|
|
16528
17314
|
"roo",
|
|
17315
|
+
"rovodev",
|
|
16529
17316
|
"warp",
|
|
16530
17317
|
"windsurf"
|
|
16531
17318
|
];
|
|
16532
|
-
var RulesProcessorToolTargetSchema =
|
|
16533
|
-
var formatRulePaths = (rules) => rules.map((r) =>
|
|
17319
|
+
var RulesProcessorToolTargetSchema = z61.enum(rulesProcessorToolTargets);
|
|
17320
|
+
var formatRulePaths = (rules) => rules.map((r) => join126(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
16534
17321
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
16535
17322
|
[
|
|
16536
17323
|
"agentsmd",
|
|
@@ -16780,6 +17567,21 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
16780
17567
|
}
|
|
16781
17568
|
}
|
|
16782
17569
|
],
|
|
17570
|
+
[
|
|
17571
|
+
"rovodev",
|
|
17572
|
+
{
|
|
17573
|
+
class: RovodevRule,
|
|
17574
|
+
meta: {
|
|
17575
|
+
extension: "md",
|
|
17576
|
+
supportsGlobal: true,
|
|
17577
|
+
ruleDiscoveryMode: "toon",
|
|
17578
|
+
additionalConventions: {
|
|
17579
|
+
subagents: { subagentClass: RovodevSubagent },
|
|
17580
|
+
skills: { skillClass: RovodevSkill }
|
|
17581
|
+
}
|
|
17582
|
+
}
|
|
17583
|
+
}
|
|
17584
|
+
],
|
|
16783
17585
|
[
|
|
16784
17586
|
"warp",
|
|
16785
17587
|
{
|
|
@@ -16908,6 +17710,21 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16908
17710
|
const conventionsSection = !meta.createsSeparateConventionsRule && meta.additionalConventions ? this.generateAdditionalConventionsSectionFromMeta(meta) : "";
|
|
16909
17711
|
const newContent = referenceSection + conventionsSection + rootRule.getFileContent();
|
|
16910
17712
|
rootRule.setFileContent(newContent);
|
|
17713
|
+
if (this.toolTarget === "rovodev" && !this.global && rootRule instanceof RovodevRule) {
|
|
17714
|
+
const primary = RovodevRule.getSettablePaths({ global: false }).root;
|
|
17715
|
+
if (rootRule.getRelativeDirPath() === primary.relativeDirPath && rootRule.getRelativeFilePath() === primary.relativeFilePath) {
|
|
17716
|
+
toolRules.push(
|
|
17717
|
+
new RovodevRule({
|
|
17718
|
+
baseDir: this.baseDir,
|
|
17719
|
+
relativeDirPath: ".",
|
|
17720
|
+
relativeFilePath: "AGENTS.md",
|
|
17721
|
+
fileContent: newContent,
|
|
17722
|
+
validate: true,
|
|
17723
|
+
root: true
|
|
17724
|
+
})
|
|
17725
|
+
);
|
|
17726
|
+
}
|
|
17727
|
+
}
|
|
16911
17728
|
return toolRules;
|
|
16912
17729
|
}
|
|
16913
17730
|
buildSkillList(skillClass) {
|
|
@@ -16917,7 +17734,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16917
17734
|
}).relativeDirPath;
|
|
16918
17735
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
16919
17736
|
const frontmatter = skill.getFrontmatter();
|
|
16920
|
-
const relativePath =
|
|
17737
|
+
const relativePath = join126(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
16921
17738
|
return {
|
|
16922
17739
|
name: frontmatter.name,
|
|
16923
17740
|
description: frontmatter.description,
|
|
@@ -16929,6 +17746,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16929
17746
|
* Handle localRoot rule generation based on tool target.
|
|
16930
17747
|
* - Claude Code: generates `./CLAUDE.local.md`
|
|
16931
17748
|
* - Claude Code Legacy: generates `./CLAUDE.local.md`
|
|
17749
|
+
* - Rovodev: generates `./AGENTS.local.md` (Rovo Dev CLI project memory)
|
|
16932
17750
|
* - Other tools: appends content to the root file with one blank line separator
|
|
16933
17751
|
*/
|
|
16934
17752
|
handleLocalRootRule(toolRules, localRootRule, _factory) {
|
|
@@ -16962,6 +17780,17 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16962
17780
|
// Treat as root so it doesn't have frontmatter
|
|
16963
17781
|
})
|
|
16964
17782
|
);
|
|
17783
|
+
} else if (this.toolTarget === "rovodev") {
|
|
17784
|
+
toolRules.push(
|
|
17785
|
+
new RovodevRule({
|
|
17786
|
+
baseDir: this.baseDir,
|
|
17787
|
+
relativeDirPath: ".",
|
|
17788
|
+
relativeFilePath: "AGENTS.local.md",
|
|
17789
|
+
fileContent: localRootBody,
|
|
17790
|
+
validate: true,
|
|
17791
|
+
root: true
|
|
17792
|
+
})
|
|
17793
|
+
);
|
|
16965
17794
|
} else {
|
|
16966
17795
|
const rootRule = toolRules.find((rule) => rule.isRoot());
|
|
16967
17796
|
if (rootRule) {
|
|
@@ -17030,8 +17859,8 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
17030
17859
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
17031
17860
|
*/
|
|
17032
17861
|
async loadRulesyncFiles() {
|
|
17033
|
-
const rulesyncBaseDir =
|
|
17034
|
-
const files = await findFilesByGlobs(
|
|
17862
|
+
const rulesyncBaseDir = join126(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
17863
|
+
const files = await findFilesByGlobs(join126(rulesyncBaseDir, "**", "*.md"));
|
|
17035
17864
|
this.logger.debug(`Found ${files.length} rulesync files`);
|
|
17036
17865
|
const rulesyncRules = await Promise.all(
|
|
17037
17866
|
files.map((file) => {
|
|
@@ -17128,13 +17957,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
17128
17957
|
return [];
|
|
17129
17958
|
}
|
|
17130
17959
|
const uniqueRootFilePaths = await findFilesWithFallback(
|
|
17131
|
-
|
|
17960
|
+
join126(
|
|
17132
17961
|
this.baseDir,
|
|
17133
17962
|
settablePaths.root.relativeDirPath ?? ".",
|
|
17134
17963
|
settablePaths.root.relativeFilePath
|
|
17135
17964
|
),
|
|
17136
17965
|
settablePaths.alternativeRoots,
|
|
17137
|
-
(alt) =>
|
|
17966
|
+
(alt) => join126(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
|
|
17138
17967
|
);
|
|
17139
17968
|
if (forDeletion) {
|
|
17140
17969
|
return uniqueRootFilePaths.map((filePath) => {
|
|
@@ -17172,6 +18001,27 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
17172
18001
|
if (!forDeletion) {
|
|
17173
18002
|
return [];
|
|
17174
18003
|
}
|
|
18004
|
+
if (this.toolTarget === "rovodev") {
|
|
18005
|
+
if (this.global) {
|
|
18006
|
+
return [];
|
|
18007
|
+
}
|
|
18008
|
+
const uniqueLocalRootFilePaths2 = await findFilesByGlobs(
|
|
18009
|
+
join126(this.baseDir, "AGENTS.local.md")
|
|
18010
|
+
);
|
|
18011
|
+
return uniqueLocalRootFilePaths2.map((filePath) => {
|
|
18012
|
+
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
18013
|
+
checkPathTraversal({
|
|
18014
|
+
relativePath: relativeDirPath,
|
|
18015
|
+
intendedRootDir: this.baseDir
|
|
18016
|
+
});
|
|
18017
|
+
return factory.class.forDeletion({
|
|
18018
|
+
baseDir: this.baseDir,
|
|
18019
|
+
relativeDirPath,
|
|
18020
|
+
relativeFilePath: basename10(filePath),
|
|
18021
|
+
global: this.global
|
|
18022
|
+
});
|
|
18023
|
+
}).filter((rule) => rule.isDeletable());
|
|
18024
|
+
}
|
|
17175
18025
|
if (this.toolTarget !== "claudecode" && this.toolTarget !== "claudecode-legacy") {
|
|
17176
18026
|
return [];
|
|
17177
18027
|
}
|
|
@@ -17179,9 +18029,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
17179
18029
|
return [];
|
|
17180
18030
|
}
|
|
17181
18031
|
const uniqueLocalRootFilePaths = await findFilesWithFallback(
|
|
17182
|
-
|
|
18032
|
+
join126(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
|
|
17183
18033
|
settablePaths.alternativeRoots,
|
|
17184
|
-
(alt) =>
|
|
18034
|
+
(alt) => join126(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
|
|
17185
18035
|
);
|
|
17186
18036
|
return uniqueLocalRootFilePaths.map((filePath) => {
|
|
17187
18037
|
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
@@ -17200,14 +18050,48 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
17200
18050
|
this.logger.debug(
|
|
17201
18051
|
`Found ${localRootToolRules.length} local root tool rule files for deletion`
|
|
17202
18052
|
);
|
|
18053
|
+
const rovodevMirrorDeletionRules = await (async () => {
|
|
18054
|
+
if (!forDeletion || this.toolTarget !== "rovodev" || this.global) {
|
|
18055
|
+
return [];
|
|
18056
|
+
}
|
|
18057
|
+
const primaryPaths = await findFilesByGlobs(join126(this.baseDir, ".rovodev", "AGENTS.md"));
|
|
18058
|
+
if (primaryPaths.length === 0) {
|
|
18059
|
+
return [];
|
|
18060
|
+
}
|
|
18061
|
+
const mirrorPaths = await findFilesByGlobs(join126(this.baseDir, "AGENTS.md"));
|
|
18062
|
+
return mirrorPaths.map((filePath) => {
|
|
18063
|
+
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
18064
|
+
checkPathTraversal({
|
|
18065
|
+
relativePath: relativeDirPath,
|
|
18066
|
+
intendedRootDir: this.baseDir
|
|
18067
|
+
});
|
|
18068
|
+
return factory.class.forDeletion({
|
|
18069
|
+
baseDir: this.baseDir,
|
|
18070
|
+
relativeDirPath,
|
|
18071
|
+
relativeFilePath: basename10(filePath),
|
|
18072
|
+
global: this.global
|
|
18073
|
+
});
|
|
18074
|
+
}).filter((rule) => rule.isDeletable());
|
|
18075
|
+
})();
|
|
17203
18076
|
const nonRootToolRules = await (async () => {
|
|
17204
18077
|
if (!settablePaths.nonRoot) {
|
|
17205
18078
|
return [];
|
|
17206
18079
|
}
|
|
17207
|
-
const nonRootBaseDir =
|
|
18080
|
+
const nonRootBaseDir = join126(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
17208
18081
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
17209
|
-
|
|
18082
|
+
join126(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
17210
18083
|
);
|
|
18084
|
+
const modularRootRelative = settablePaths.nonRoot.relativeDirPath;
|
|
18085
|
+
const nonRootPathsForImport = !forDeletion && this.toolTarget === "rovodev" ? nonRootFilePaths.filter((filePath) => {
|
|
18086
|
+
const relativeFilePath = relative5(nonRootBaseDir, filePath);
|
|
18087
|
+
const ok = RovodevRule.isAllowedModularRulesRelativePath(relativeFilePath);
|
|
18088
|
+
if (!ok) {
|
|
18089
|
+
this.logger.warn(
|
|
18090
|
+
`Skipping reserved Rovodev path under modular-rules (import): ${join126(modularRootRelative, relativeFilePath)}`
|
|
18091
|
+
);
|
|
18092
|
+
}
|
|
18093
|
+
return ok;
|
|
18094
|
+
}) : nonRootFilePaths;
|
|
17211
18095
|
if (forDeletion) {
|
|
17212
18096
|
return nonRootFilePaths.map((filePath) => {
|
|
17213
18097
|
const relativeFilePath = relative5(nonRootBaseDir, filePath);
|
|
@@ -17224,7 +18108,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
17224
18108
|
}).filter((rule) => rule.isDeletable());
|
|
17225
18109
|
}
|
|
17226
18110
|
return await Promise.all(
|
|
17227
|
-
|
|
18111
|
+
nonRootPathsForImport.map((filePath) => {
|
|
17228
18112
|
const relativeFilePath = relative5(nonRootBaseDir, filePath);
|
|
17229
18113
|
checkPathTraversal({
|
|
17230
18114
|
relativePath: relativeFilePath,
|
|
@@ -17232,6 +18116,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
17232
18116
|
});
|
|
17233
18117
|
return factory.class.fromFile({
|
|
17234
18118
|
baseDir: this.baseDir,
|
|
18119
|
+
relativeDirPath: modularRootRelative,
|
|
17235
18120
|
relativeFilePath,
|
|
17236
18121
|
global: this.global
|
|
17237
18122
|
});
|
|
@@ -17239,7 +18124,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
17239
18124
|
);
|
|
17240
18125
|
})();
|
|
17241
18126
|
this.logger.debug(`Found ${nonRootToolRules.length} non-root tool rule files`);
|
|
17242
|
-
return [
|
|
18127
|
+
return [
|
|
18128
|
+
...rootToolRules,
|
|
18129
|
+
...localRootToolRules,
|
|
18130
|
+
...rovodevMirrorDeletionRules,
|
|
18131
|
+
...nonRootToolRules
|
|
18132
|
+
];
|
|
17243
18133
|
} catch (error) {
|
|
17244
18134
|
this.logger.error(`Failed to load tool files for ${this.toolTarget}: ${formatError(error)}`);
|
|
17245
18135
|
return [];
|
|
@@ -17338,14 +18228,14 @@ s/<command> [arguments]
|
|
|
17338
18228
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
17339
18229
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
17340
18230
|
|
|
17341
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
18231
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join126(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
17342
18232
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
17343
18233
|
|
|
17344
18234
|
Simulated subagents are specialized AI assistants that can be invoked to handle specific types of tasks. In this case, it can be appear something like custom slash commands simply. Simulated subagents can be called by custom slash commands.
|
|
17345
18235
|
|
|
17346
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
18236
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join126(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
17347
18237
|
|
|
17348
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
18238
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join126(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
17349
18239
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
17350
18240
|
const result = [
|
|
17351
18241
|
overview,
|
|
@@ -17437,7 +18327,7 @@ function warnUnsupportedTargets(params) {
|
|
|
17437
18327
|
}
|
|
17438
18328
|
}
|
|
17439
18329
|
async function checkRulesyncDirExists(params) {
|
|
17440
|
-
return fileExists(
|
|
18330
|
+
return fileExists(join127(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
17441
18331
|
}
|
|
17442
18332
|
async function generate(params) {
|
|
17443
18333
|
const { config, logger } = params;
|