rulesync 4.1.0 → 4.2.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 +19 -5
- package/dist/index.cjs +639 -346
- package/dist/index.js +638 -345
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4727,9 +4727,9 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
4727
4727
|
};
|
|
4728
4728
|
|
|
4729
4729
|
// src/features/rules/rules-processor.ts
|
|
4730
|
-
var
|
|
4730
|
+
var import_node_path86 = require("path");
|
|
4731
4731
|
var import_toon = require("@toon-format/toon");
|
|
4732
|
-
var
|
|
4732
|
+
var import_mini38 = require("zod/mini");
|
|
4733
4733
|
|
|
4734
4734
|
// src/constants/general.ts
|
|
4735
4735
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
@@ -6478,39 +6478,12 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
6478
6478
|
}
|
|
6479
6479
|
};
|
|
6480
6480
|
|
|
6481
|
-
// src/features/subagents/copilot-subagent.ts
|
|
6482
|
-
var import_node_path57 = require("path");
|
|
6483
|
-
var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
|
|
6484
|
-
static getSettablePaths() {
|
|
6485
|
-
return {
|
|
6486
|
-
relativeDirPath: (0, import_node_path57.join)(".github", "subagents")
|
|
6487
|
-
};
|
|
6488
|
-
}
|
|
6489
|
-
static async fromFile(params) {
|
|
6490
|
-
const baseParams = await this.fromFileDefault(params);
|
|
6491
|
-
return new _CopilotSubagent(baseParams);
|
|
6492
|
-
}
|
|
6493
|
-
static fromRulesyncSubagent(params) {
|
|
6494
|
-
const baseParams = this.fromRulesyncSubagentDefault(params);
|
|
6495
|
-
return new _CopilotSubagent(baseParams);
|
|
6496
|
-
}
|
|
6497
|
-
static isTargetedByRulesyncSubagent(rulesyncSubagent) {
|
|
6498
|
-
return this.isTargetedByRulesyncSubagentDefault({
|
|
6499
|
-
rulesyncSubagent,
|
|
6500
|
-
toolTarget: "copilot"
|
|
6501
|
-
});
|
|
6502
|
-
}
|
|
6503
|
-
static forDeletion(params) {
|
|
6504
|
-
return new _CopilotSubagent(this.forDeletionDefault(params));
|
|
6505
|
-
}
|
|
6506
|
-
};
|
|
6507
|
-
|
|
6508
6481
|
// src/features/subagents/cursor-subagent.ts
|
|
6509
|
-
var
|
|
6482
|
+
var import_node_path57 = require("path");
|
|
6510
6483
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
6511
6484
|
static getSettablePaths() {
|
|
6512
6485
|
return {
|
|
6513
|
-
relativeDirPath: (0,
|
|
6486
|
+
relativeDirPath: (0, import_node_path57.join)(".cursor", "subagents")
|
|
6514
6487
|
};
|
|
6515
6488
|
}
|
|
6516
6489
|
static async fromFile(params) {
|
|
@@ -6533,11 +6506,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
6533
6506
|
};
|
|
6534
6507
|
|
|
6535
6508
|
// src/features/subagents/geminicli-subagent.ts
|
|
6536
|
-
var
|
|
6509
|
+
var import_node_path58 = require("path");
|
|
6537
6510
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
6538
6511
|
static getSettablePaths() {
|
|
6539
6512
|
return {
|
|
6540
|
-
relativeDirPath: (0,
|
|
6513
|
+
relativeDirPath: (0, import_node_path58.join)(".gemini", "subagents")
|
|
6541
6514
|
};
|
|
6542
6515
|
}
|
|
6543
6516
|
static async fromFile(params) {
|
|
@@ -6560,11 +6533,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
6560
6533
|
};
|
|
6561
6534
|
|
|
6562
6535
|
// src/features/subagents/roo-subagent.ts
|
|
6563
|
-
var
|
|
6536
|
+
var import_node_path59 = require("path");
|
|
6564
6537
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
6565
6538
|
static getSettablePaths() {
|
|
6566
6539
|
return {
|
|
6567
|
-
relativeDirPath: (0,
|
|
6540
|
+
relativeDirPath: (0, import_node_path59.join)(".roo", "subagents")
|
|
6568
6541
|
};
|
|
6569
6542
|
}
|
|
6570
6543
|
static async fromFile(params) {
|
|
@@ -6587,15 +6560,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
6587
6560
|
};
|
|
6588
6561
|
|
|
6589
6562
|
// src/features/subagents/subagents-processor.ts
|
|
6590
|
-
var
|
|
6591
|
-
var
|
|
6563
|
+
var import_node_path64 = require("path");
|
|
6564
|
+
var import_mini31 = require("zod/mini");
|
|
6592
6565
|
|
|
6593
6566
|
// src/features/subagents/claudecode-subagent.ts
|
|
6594
|
-
var
|
|
6567
|
+
var import_node_path61 = require("path");
|
|
6595
6568
|
var import_mini28 = require("zod/mini");
|
|
6596
6569
|
|
|
6597
6570
|
// src/features/subagents/rulesync-subagent.ts
|
|
6598
|
-
var
|
|
6571
|
+
var import_node_path60 = require("path");
|
|
6599
6572
|
var import_mini27 = require("zod/mini");
|
|
6600
6573
|
var RulesyncSubagentFrontmatterSchema = import_mini27.z.looseObject({
|
|
6601
6574
|
targets: RulesyncTargetsSchema,
|
|
@@ -6610,7 +6583,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
6610
6583
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
6611
6584
|
if (!result.success) {
|
|
6612
6585
|
throw new Error(
|
|
6613
|
-
`Invalid frontmatter in ${(0,
|
|
6586
|
+
`Invalid frontmatter in ${(0, import_node_path60.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
6614
6587
|
);
|
|
6615
6588
|
}
|
|
6616
6589
|
}
|
|
@@ -6643,7 +6616,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
6643
6616
|
return {
|
|
6644
6617
|
success: false,
|
|
6645
6618
|
error: new Error(
|
|
6646
|
-
`Invalid frontmatter in ${(0,
|
|
6619
|
+
`Invalid frontmatter in ${(0, import_node_path60.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
6647
6620
|
)
|
|
6648
6621
|
};
|
|
6649
6622
|
}
|
|
@@ -6652,14 +6625,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
6652
6625
|
relativeFilePath
|
|
6653
6626
|
}) {
|
|
6654
6627
|
const fileContent = await readFileContent(
|
|
6655
|
-
(0,
|
|
6628
|
+
(0, import_node_path60.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
6656
6629
|
);
|
|
6657
6630
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
6658
6631
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
6659
6632
|
if (!result.success) {
|
|
6660
6633
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
6661
6634
|
}
|
|
6662
|
-
const filename = (0,
|
|
6635
|
+
const filename = (0, import_node_path60.basename)(relativeFilePath);
|
|
6663
6636
|
return new _RulesyncSubagent({
|
|
6664
6637
|
baseDir: process.cwd(),
|
|
6665
6638
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -6687,7 +6660,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
6687
6660
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
6688
6661
|
if (!result.success) {
|
|
6689
6662
|
throw new Error(
|
|
6690
|
-
`Invalid frontmatter in ${(0,
|
|
6663
|
+
`Invalid frontmatter in ${(0, import_node_path61.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
6691
6664
|
);
|
|
6692
6665
|
}
|
|
6693
6666
|
}
|
|
@@ -6699,7 +6672,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
6699
6672
|
}
|
|
6700
6673
|
static getSettablePaths(_options = {}) {
|
|
6701
6674
|
return {
|
|
6702
|
-
relativeDirPath: (0,
|
|
6675
|
+
relativeDirPath: (0, import_node_path61.join)(".claude", "agents")
|
|
6703
6676
|
};
|
|
6704
6677
|
}
|
|
6705
6678
|
getFrontmatter() {
|
|
@@ -6773,7 +6746,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
6773
6746
|
return {
|
|
6774
6747
|
success: false,
|
|
6775
6748
|
error: new Error(
|
|
6776
|
-
`Invalid frontmatter in ${(0,
|
|
6749
|
+
`Invalid frontmatter in ${(0, import_node_path61.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
6777
6750
|
)
|
|
6778
6751
|
};
|
|
6779
6752
|
}
|
|
@@ -6791,7 +6764,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
6791
6764
|
global = false
|
|
6792
6765
|
}) {
|
|
6793
6766
|
const paths = this.getSettablePaths({ global });
|
|
6794
|
-
const filePath = (0,
|
|
6767
|
+
const filePath = (0, import_node_path61.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
6795
6768
|
const fileContent = await readFileContent(filePath);
|
|
6796
6769
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
6797
6770
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -6825,6 +6798,320 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
6825
6798
|
}
|
|
6826
6799
|
};
|
|
6827
6800
|
|
|
6801
|
+
// src/features/subagents/copilot-subagent.ts
|
|
6802
|
+
var import_node_path62 = require("path");
|
|
6803
|
+
var import_mini29 = require("zod/mini");
|
|
6804
|
+
var REQUIRED_TOOL = "agent/runSubagent";
|
|
6805
|
+
var CopilotSubagentFrontmatterSchema = import_mini29.z.looseObject({
|
|
6806
|
+
name: import_mini29.z.string(),
|
|
6807
|
+
description: import_mini29.z.string(),
|
|
6808
|
+
tools: import_mini29.z.optional(import_mini29.z.union([import_mini29.z.string(), import_mini29.z.array(import_mini29.z.string())]))
|
|
6809
|
+
});
|
|
6810
|
+
var normalizeTools = (tools) => {
|
|
6811
|
+
if (!tools) {
|
|
6812
|
+
return [];
|
|
6813
|
+
}
|
|
6814
|
+
return Array.isArray(tools) ? tools : [tools];
|
|
6815
|
+
};
|
|
6816
|
+
var ensureRequiredTool = (tools) => {
|
|
6817
|
+
const mergedTools = /* @__PURE__ */ new Set([REQUIRED_TOOL, ...tools]);
|
|
6818
|
+
return Array.from(mergedTools);
|
|
6819
|
+
};
|
|
6820
|
+
var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
6821
|
+
frontmatter;
|
|
6822
|
+
body;
|
|
6823
|
+
constructor({ frontmatter, body, ...rest }) {
|
|
6824
|
+
if (rest.validate !== false) {
|
|
6825
|
+
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
6826
|
+
if (!result.success) {
|
|
6827
|
+
throw new Error(
|
|
6828
|
+
`Invalid frontmatter in ${(0, import_node_path62.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
6829
|
+
);
|
|
6830
|
+
}
|
|
6831
|
+
}
|
|
6832
|
+
super({
|
|
6833
|
+
...rest
|
|
6834
|
+
});
|
|
6835
|
+
this.frontmatter = frontmatter;
|
|
6836
|
+
this.body = body;
|
|
6837
|
+
}
|
|
6838
|
+
static getSettablePaths(_options = {}) {
|
|
6839
|
+
return {
|
|
6840
|
+
relativeDirPath: (0, import_node_path62.join)(".github", "agents")
|
|
6841
|
+
};
|
|
6842
|
+
}
|
|
6843
|
+
getFrontmatter() {
|
|
6844
|
+
return this.frontmatter;
|
|
6845
|
+
}
|
|
6846
|
+
getBody() {
|
|
6847
|
+
return this.body;
|
|
6848
|
+
}
|
|
6849
|
+
toRulesyncSubagent() {
|
|
6850
|
+
const { name, description, tools, ...rest } = this.frontmatter;
|
|
6851
|
+
const rulesyncFrontmatter = {
|
|
6852
|
+
targets: ["copilot"],
|
|
6853
|
+
name,
|
|
6854
|
+
description,
|
|
6855
|
+
copilot: {
|
|
6856
|
+
...tools && { tools },
|
|
6857
|
+
...rest
|
|
6858
|
+
}
|
|
6859
|
+
};
|
|
6860
|
+
return new RulesyncSubagent({
|
|
6861
|
+
baseDir: ".",
|
|
6862
|
+
// RulesyncCommand baseDir is always the project root directory
|
|
6863
|
+
frontmatter: rulesyncFrontmatter,
|
|
6864
|
+
body: this.body,
|
|
6865
|
+
relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
|
|
6866
|
+
relativeFilePath: this.getRelativeFilePath(),
|
|
6867
|
+
validate: true
|
|
6868
|
+
});
|
|
6869
|
+
}
|
|
6870
|
+
static fromRulesyncSubagent({
|
|
6871
|
+
baseDir = process.cwd(),
|
|
6872
|
+
rulesyncSubagent,
|
|
6873
|
+
validate = true,
|
|
6874
|
+
global = false
|
|
6875
|
+
}) {
|
|
6876
|
+
const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
|
|
6877
|
+
const copilotSection = rulesyncFrontmatter.copilot ?? {};
|
|
6878
|
+
const toolsField = copilotSection.tools;
|
|
6879
|
+
const userTools = normalizeTools(
|
|
6880
|
+
Array.isArray(toolsField) || typeof toolsField === "string" ? toolsField : void 0
|
|
6881
|
+
);
|
|
6882
|
+
const mergedTools = ensureRequiredTool(userTools);
|
|
6883
|
+
const copilotFrontmatter = {
|
|
6884
|
+
name: rulesyncFrontmatter.name,
|
|
6885
|
+
description: rulesyncFrontmatter.description,
|
|
6886
|
+
...copilotSection,
|
|
6887
|
+
...mergedTools.length > 0 && { tools: mergedTools }
|
|
6888
|
+
};
|
|
6889
|
+
const body = rulesyncSubagent.getBody();
|
|
6890
|
+
const fileContent = stringifyFrontmatter(body, copilotFrontmatter);
|
|
6891
|
+
const paths = this.getSettablePaths({ global });
|
|
6892
|
+
return new _CopilotSubagent({
|
|
6893
|
+
baseDir,
|
|
6894
|
+
frontmatter: copilotFrontmatter,
|
|
6895
|
+
body,
|
|
6896
|
+
relativeDirPath: paths.relativeDirPath,
|
|
6897
|
+
relativeFilePath: rulesyncSubagent.getRelativeFilePath(),
|
|
6898
|
+
fileContent,
|
|
6899
|
+
validate,
|
|
6900
|
+
global
|
|
6901
|
+
});
|
|
6902
|
+
}
|
|
6903
|
+
validate() {
|
|
6904
|
+
if (!this.frontmatter) {
|
|
6905
|
+
return { success: true, error: null };
|
|
6906
|
+
}
|
|
6907
|
+
const result = CopilotSubagentFrontmatterSchema.safeParse(this.frontmatter);
|
|
6908
|
+
if (result.success) {
|
|
6909
|
+
return { success: true, error: null };
|
|
6910
|
+
} else {
|
|
6911
|
+
return {
|
|
6912
|
+
success: false,
|
|
6913
|
+
error: new Error(
|
|
6914
|
+
`Invalid frontmatter in ${(0, import_node_path62.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
6915
|
+
)
|
|
6916
|
+
};
|
|
6917
|
+
}
|
|
6918
|
+
}
|
|
6919
|
+
static isTargetedByRulesyncSubagent(rulesyncSubagent) {
|
|
6920
|
+
return this.isTargetedByRulesyncSubagentDefault({
|
|
6921
|
+
rulesyncSubagent,
|
|
6922
|
+
toolTarget: "copilot"
|
|
6923
|
+
});
|
|
6924
|
+
}
|
|
6925
|
+
static async fromFile({
|
|
6926
|
+
baseDir = process.cwd(),
|
|
6927
|
+
relativeFilePath,
|
|
6928
|
+
validate = true,
|
|
6929
|
+
global = false
|
|
6930
|
+
}) {
|
|
6931
|
+
const paths = this.getSettablePaths({ global });
|
|
6932
|
+
const filePath = (0, import_node_path62.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
6933
|
+
const fileContent = await readFileContent(filePath);
|
|
6934
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
6935
|
+
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
6936
|
+
if (!result.success) {
|
|
6937
|
+
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
6938
|
+
}
|
|
6939
|
+
return new _CopilotSubagent({
|
|
6940
|
+
baseDir,
|
|
6941
|
+
relativeDirPath: paths.relativeDirPath,
|
|
6942
|
+
relativeFilePath,
|
|
6943
|
+
frontmatter: result.data,
|
|
6944
|
+
body: content.trim(),
|
|
6945
|
+
fileContent,
|
|
6946
|
+
validate,
|
|
6947
|
+
global
|
|
6948
|
+
});
|
|
6949
|
+
}
|
|
6950
|
+
static forDeletion({
|
|
6951
|
+
baseDir = process.cwd(),
|
|
6952
|
+
relativeDirPath,
|
|
6953
|
+
relativeFilePath
|
|
6954
|
+
}) {
|
|
6955
|
+
return new _CopilotSubagent({
|
|
6956
|
+
baseDir,
|
|
6957
|
+
relativeDirPath,
|
|
6958
|
+
relativeFilePath,
|
|
6959
|
+
frontmatter: { name: "", description: "" },
|
|
6960
|
+
body: "",
|
|
6961
|
+
fileContent: "",
|
|
6962
|
+
validate: false
|
|
6963
|
+
});
|
|
6964
|
+
}
|
|
6965
|
+
};
|
|
6966
|
+
|
|
6967
|
+
// src/features/subagents/opencode-subagent.ts
|
|
6968
|
+
var import_node_path63 = require("path");
|
|
6969
|
+
var import_mini30 = require("zod/mini");
|
|
6970
|
+
var OpenCodeSubagentFrontmatterSchema = import_mini30.z.looseObject({
|
|
6971
|
+
description: import_mini30.z.string(),
|
|
6972
|
+
mode: import_mini30.z.literal("subagent"),
|
|
6973
|
+
name: import_mini30.z.optional(import_mini30.z.string())
|
|
6974
|
+
});
|
|
6975
|
+
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
6976
|
+
frontmatter;
|
|
6977
|
+
body;
|
|
6978
|
+
constructor({ frontmatter, body, ...rest }) {
|
|
6979
|
+
if (rest.validate !== false) {
|
|
6980
|
+
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
6981
|
+
if (!result.success) {
|
|
6982
|
+
throw new Error(
|
|
6983
|
+
`Invalid frontmatter in ${(0, import_node_path63.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
6984
|
+
);
|
|
6985
|
+
}
|
|
6986
|
+
}
|
|
6987
|
+
super({
|
|
6988
|
+
...rest
|
|
6989
|
+
});
|
|
6990
|
+
this.frontmatter = frontmatter;
|
|
6991
|
+
this.body = body;
|
|
6992
|
+
}
|
|
6993
|
+
static getSettablePaths({
|
|
6994
|
+
global = false
|
|
6995
|
+
} = {}) {
|
|
6996
|
+
return {
|
|
6997
|
+
relativeDirPath: global ? (0, import_node_path63.join)(".config", "opencode", "agent") : (0, import_node_path63.join)(".opencode", "agent")
|
|
6998
|
+
};
|
|
6999
|
+
}
|
|
7000
|
+
getFrontmatter() {
|
|
7001
|
+
return this.frontmatter;
|
|
7002
|
+
}
|
|
7003
|
+
getBody() {
|
|
7004
|
+
return this.body;
|
|
7005
|
+
}
|
|
7006
|
+
toRulesyncSubagent() {
|
|
7007
|
+
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
7008
|
+
const rulesyncFrontmatter = {
|
|
7009
|
+
targets: ["opencode"],
|
|
7010
|
+
name: name ?? (0, import_node_path63.basename)(this.getRelativeFilePath(), ".md"),
|
|
7011
|
+
description,
|
|
7012
|
+
opencode: { mode, ...opencodeSection }
|
|
7013
|
+
};
|
|
7014
|
+
return new RulesyncSubagent({
|
|
7015
|
+
baseDir: ".",
|
|
7016
|
+
// RulesyncSubagent baseDir is always the project root directory
|
|
7017
|
+
frontmatter: rulesyncFrontmatter,
|
|
7018
|
+
body: this.body,
|
|
7019
|
+
relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
|
|
7020
|
+
relativeFilePath: this.getRelativeFilePath(),
|
|
7021
|
+
validate: true
|
|
7022
|
+
});
|
|
7023
|
+
}
|
|
7024
|
+
static fromRulesyncSubagent({
|
|
7025
|
+
baseDir = process.cwd(),
|
|
7026
|
+
rulesyncSubagent,
|
|
7027
|
+
validate = true,
|
|
7028
|
+
global = false
|
|
7029
|
+
}) {
|
|
7030
|
+
const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
|
|
7031
|
+
const opencodeSection = rulesyncFrontmatter.opencode ?? {};
|
|
7032
|
+
const opencodeFrontmatter = {
|
|
7033
|
+
...opencodeSection,
|
|
7034
|
+
description: rulesyncFrontmatter.description,
|
|
7035
|
+
mode: "subagent",
|
|
7036
|
+
...rulesyncFrontmatter.name && { name: rulesyncFrontmatter.name }
|
|
7037
|
+
};
|
|
7038
|
+
const body = rulesyncSubagent.getBody();
|
|
7039
|
+
const fileContent = stringifyFrontmatter(body, opencodeFrontmatter);
|
|
7040
|
+
const paths = this.getSettablePaths({ global });
|
|
7041
|
+
return new _OpenCodeSubagent({
|
|
7042
|
+
baseDir,
|
|
7043
|
+
frontmatter: opencodeFrontmatter,
|
|
7044
|
+
body,
|
|
7045
|
+
relativeDirPath: paths.relativeDirPath,
|
|
7046
|
+
relativeFilePath: rulesyncSubagent.getRelativeFilePath(),
|
|
7047
|
+
fileContent,
|
|
7048
|
+
validate,
|
|
7049
|
+
global
|
|
7050
|
+
});
|
|
7051
|
+
}
|
|
7052
|
+
validate() {
|
|
7053
|
+
if (!this.frontmatter) {
|
|
7054
|
+
return { success: true, error: null };
|
|
7055
|
+
}
|
|
7056
|
+
const result = OpenCodeSubagentFrontmatterSchema.safeParse(this.frontmatter);
|
|
7057
|
+
if (result.success) {
|
|
7058
|
+
return { success: true, error: null };
|
|
7059
|
+
}
|
|
7060
|
+
return {
|
|
7061
|
+
success: false,
|
|
7062
|
+
error: new Error(
|
|
7063
|
+
`Invalid frontmatter in ${(0, import_node_path63.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7064
|
+
)
|
|
7065
|
+
};
|
|
7066
|
+
}
|
|
7067
|
+
static isTargetedByRulesyncSubagent(rulesyncSubagent) {
|
|
7068
|
+
return this.isTargetedByRulesyncSubagentDefault({
|
|
7069
|
+
rulesyncSubagent,
|
|
7070
|
+
toolTarget: "opencode"
|
|
7071
|
+
});
|
|
7072
|
+
}
|
|
7073
|
+
static async fromFile({
|
|
7074
|
+
baseDir = process.cwd(),
|
|
7075
|
+
relativeFilePath,
|
|
7076
|
+
validate = true,
|
|
7077
|
+
global = false
|
|
7078
|
+
}) {
|
|
7079
|
+
const paths = this.getSettablePaths({ global });
|
|
7080
|
+
const filePath = (0, import_node_path63.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7081
|
+
const fileContent = await readFileContent(filePath);
|
|
7082
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7083
|
+
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7084
|
+
if (!result.success) {
|
|
7085
|
+
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
7086
|
+
}
|
|
7087
|
+
return new _OpenCodeSubagent({
|
|
7088
|
+
baseDir,
|
|
7089
|
+
relativeDirPath: paths.relativeDirPath,
|
|
7090
|
+
relativeFilePath,
|
|
7091
|
+
frontmatter: result.data,
|
|
7092
|
+
body: content.trim(),
|
|
7093
|
+
fileContent,
|
|
7094
|
+
validate,
|
|
7095
|
+
global
|
|
7096
|
+
});
|
|
7097
|
+
}
|
|
7098
|
+
static forDeletion({
|
|
7099
|
+
baseDir = process.cwd(),
|
|
7100
|
+
relativeDirPath,
|
|
7101
|
+
relativeFilePath
|
|
7102
|
+
}) {
|
|
7103
|
+
return new _OpenCodeSubagent({
|
|
7104
|
+
baseDir,
|
|
7105
|
+
relativeDirPath,
|
|
7106
|
+
relativeFilePath,
|
|
7107
|
+
frontmatter: { description: "", mode: "subagent" },
|
|
7108
|
+
body: "",
|
|
7109
|
+
fileContent: "",
|
|
7110
|
+
validate: false
|
|
7111
|
+
});
|
|
7112
|
+
}
|
|
7113
|
+
};
|
|
7114
|
+
|
|
6828
7115
|
// src/features/subagents/subagents-processor.ts
|
|
6829
7116
|
var subagentsProcessorToolTargetTuple = [
|
|
6830
7117
|
"agentsmd",
|
|
@@ -6833,9 +7120,10 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
6833
7120
|
"copilot",
|
|
6834
7121
|
"cursor",
|
|
6835
7122
|
"geminicli",
|
|
7123
|
+
"opencode",
|
|
6836
7124
|
"roo"
|
|
6837
7125
|
];
|
|
6838
|
-
var SubagentsProcessorToolTargetSchema =
|
|
7126
|
+
var SubagentsProcessorToolTargetSchema = import_mini31.z.enum(subagentsProcessorToolTargetTuple);
|
|
6839
7127
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
6840
7128
|
[
|
|
6841
7129
|
"agentsmd",
|
|
@@ -6849,12 +7137,19 @@ var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
|
6849
7137
|
"codexcli",
|
|
6850
7138
|
{ class: CodexCliSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }
|
|
6851
7139
|
],
|
|
6852
|
-
[
|
|
7140
|
+
[
|
|
7141
|
+
"copilot",
|
|
7142
|
+
{ class: CopilotSubagent, meta: { supportsSimulated: false, supportsGlobal: false } }
|
|
7143
|
+
],
|
|
6853
7144
|
["cursor", { class: CursorSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }],
|
|
6854
7145
|
[
|
|
6855
7146
|
"geminicli",
|
|
6856
7147
|
{ class: GeminiCliSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }
|
|
6857
7148
|
],
|
|
7149
|
+
[
|
|
7150
|
+
"opencode",
|
|
7151
|
+
{ class: OpenCodeSubagent, meta: { supportsSimulated: false, supportsGlobal: true } }
|
|
7152
|
+
],
|
|
6858
7153
|
["roo", { class: RooSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }]
|
|
6859
7154
|
]);
|
|
6860
7155
|
var defaultGetFactory5 = (target) => {
|
|
@@ -6938,7 +7233,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
6938
7233
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
6939
7234
|
*/
|
|
6940
7235
|
async loadRulesyncFiles() {
|
|
6941
|
-
const subagentsDir = (0,
|
|
7236
|
+
const subagentsDir = (0, import_node_path64.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
6942
7237
|
const dirExists = await directoryExists(subagentsDir);
|
|
6943
7238
|
if (!dirExists) {
|
|
6944
7239
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -6953,7 +7248,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
6953
7248
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
6954
7249
|
const rulesyncSubagents = [];
|
|
6955
7250
|
for (const mdFile of mdFiles) {
|
|
6956
|
-
const filepath = (0,
|
|
7251
|
+
const filepath = (0, import_node_path64.join)(subagentsDir, mdFile);
|
|
6957
7252
|
try {
|
|
6958
7253
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
6959
7254
|
relativeFilePath: mdFile,
|
|
@@ -6983,14 +7278,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
6983
7278
|
const factory = this.getFactory(this.toolTarget);
|
|
6984
7279
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
6985
7280
|
const subagentFilePaths = await findFilesByGlobs(
|
|
6986
|
-
(0,
|
|
7281
|
+
(0, import_node_path64.join)(this.baseDir, paths.relativeDirPath, "*.md")
|
|
6987
7282
|
);
|
|
6988
7283
|
if (forDeletion) {
|
|
6989
7284
|
const toolSubagents2 = subagentFilePaths.map(
|
|
6990
7285
|
(path3) => factory.class.forDeletion({
|
|
6991
7286
|
baseDir: this.baseDir,
|
|
6992
7287
|
relativeDirPath: paths.relativeDirPath,
|
|
6993
|
-
relativeFilePath: (0,
|
|
7288
|
+
relativeFilePath: (0, import_node_path64.basename)(path3),
|
|
6994
7289
|
global: this.global
|
|
6995
7290
|
})
|
|
6996
7291
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -7001,7 +7296,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
7001
7296
|
subagentFilePaths.map(
|
|
7002
7297
|
(path3) => factory.class.fromFile({
|
|
7003
7298
|
baseDir: this.baseDir,
|
|
7004
|
-
relativeFilePath: (0,
|
|
7299
|
+
relativeFilePath: (0, import_node_path64.basename)(path3),
|
|
7005
7300
|
global: this.global
|
|
7006
7301
|
})
|
|
7007
7302
|
)
|
|
@@ -7033,48 +7328,48 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
7033
7328
|
};
|
|
7034
7329
|
|
|
7035
7330
|
// src/features/rules/agentsmd-rule.ts
|
|
7036
|
-
var
|
|
7331
|
+
var import_node_path67 = require("path");
|
|
7037
7332
|
|
|
7038
7333
|
// src/features/rules/tool-rule.ts
|
|
7039
|
-
var
|
|
7334
|
+
var import_node_path66 = require("path");
|
|
7040
7335
|
|
|
7041
7336
|
// src/features/rules/rulesync-rule.ts
|
|
7042
|
-
var
|
|
7043
|
-
var
|
|
7044
|
-
var RulesyncRuleFrontmatterSchema =
|
|
7045
|
-
root:
|
|
7046
|
-
targets:
|
|
7047
|
-
description:
|
|
7048
|
-
globs:
|
|
7049
|
-
agentsmd:
|
|
7050
|
-
|
|
7337
|
+
var import_node_path65 = require("path");
|
|
7338
|
+
var import_mini32 = require("zod/mini");
|
|
7339
|
+
var RulesyncRuleFrontmatterSchema = import_mini32.z.object({
|
|
7340
|
+
root: import_mini32.z.optional(import_mini32.z.optional(import_mini32.z.boolean())),
|
|
7341
|
+
targets: import_mini32.z.optional(RulesyncTargetsSchema),
|
|
7342
|
+
description: import_mini32.z.optional(import_mini32.z.string()),
|
|
7343
|
+
globs: import_mini32.z.optional(import_mini32.z.array(import_mini32.z.string())),
|
|
7344
|
+
agentsmd: import_mini32.z.optional(
|
|
7345
|
+
import_mini32.z.object({
|
|
7051
7346
|
// @example "path/to/subproject"
|
|
7052
|
-
subprojectPath:
|
|
7347
|
+
subprojectPath: import_mini32.z.optional(import_mini32.z.string())
|
|
7053
7348
|
})
|
|
7054
7349
|
),
|
|
7055
|
-
claudecode:
|
|
7056
|
-
|
|
7350
|
+
claudecode: import_mini32.z.optional(
|
|
7351
|
+
import_mini32.z.object({
|
|
7057
7352
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
7058
7353
|
// @example "src/**/*.ts, tests/**/*.test.ts"
|
|
7059
|
-
paths:
|
|
7354
|
+
paths: import_mini32.z.optional(import_mini32.z.string())
|
|
7060
7355
|
})
|
|
7061
7356
|
),
|
|
7062
|
-
cursor:
|
|
7063
|
-
|
|
7064
|
-
alwaysApply:
|
|
7065
|
-
description:
|
|
7066
|
-
globs:
|
|
7357
|
+
cursor: import_mini32.z.optional(
|
|
7358
|
+
import_mini32.z.object({
|
|
7359
|
+
alwaysApply: import_mini32.z.optional(import_mini32.z.boolean()),
|
|
7360
|
+
description: import_mini32.z.optional(import_mini32.z.string()),
|
|
7361
|
+
globs: import_mini32.z.optional(import_mini32.z.array(import_mini32.z.string()))
|
|
7067
7362
|
})
|
|
7068
7363
|
),
|
|
7069
|
-
copilot:
|
|
7070
|
-
|
|
7071
|
-
excludeAgent:
|
|
7364
|
+
copilot: import_mini32.z.optional(
|
|
7365
|
+
import_mini32.z.object({
|
|
7366
|
+
excludeAgent: import_mini32.z.optional(import_mini32.z.union([import_mini32.z.literal("code-review"), import_mini32.z.literal("coding-agent")]))
|
|
7072
7367
|
})
|
|
7073
7368
|
),
|
|
7074
|
-
antigravity:
|
|
7075
|
-
|
|
7076
|
-
trigger:
|
|
7077
|
-
globs:
|
|
7369
|
+
antigravity: import_mini32.z.optional(
|
|
7370
|
+
import_mini32.z.looseObject({
|
|
7371
|
+
trigger: import_mini32.z.optional(import_mini32.z.string()),
|
|
7372
|
+
globs: import_mini32.z.optional(import_mini32.z.array(import_mini32.z.string()))
|
|
7078
7373
|
})
|
|
7079
7374
|
)
|
|
7080
7375
|
});
|
|
@@ -7086,7 +7381,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
7086
7381
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7087
7382
|
if (!result.success) {
|
|
7088
7383
|
throw new Error(
|
|
7089
|
-
`Invalid frontmatter in ${(0,
|
|
7384
|
+
`Invalid frontmatter in ${(0, import_node_path65.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7090
7385
|
);
|
|
7091
7386
|
}
|
|
7092
7387
|
}
|
|
@@ -7121,7 +7416,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
7121
7416
|
return {
|
|
7122
7417
|
success: false,
|
|
7123
7418
|
error: new Error(
|
|
7124
|
-
`Invalid frontmatter in ${(0,
|
|
7419
|
+
`Invalid frontmatter in ${(0, import_node_path65.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7125
7420
|
)
|
|
7126
7421
|
};
|
|
7127
7422
|
}
|
|
@@ -7130,12 +7425,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
7130
7425
|
relativeFilePath,
|
|
7131
7426
|
validate = true
|
|
7132
7427
|
}) {
|
|
7133
|
-
const legacyPath = (0,
|
|
7428
|
+
const legacyPath = (0, import_node_path65.join)(
|
|
7134
7429
|
process.cwd(),
|
|
7135
7430
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
7136
7431
|
relativeFilePath
|
|
7137
7432
|
);
|
|
7138
|
-
const recommendedPath = (0,
|
|
7433
|
+
const recommendedPath = (0, import_node_path65.join)(
|
|
7139
7434
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
7140
7435
|
relativeFilePath
|
|
7141
7436
|
);
|
|
@@ -7154,7 +7449,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
7154
7449
|
agentsmd: result.data.agentsmd,
|
|
7155
7450
|
cursor: result.data.cursor
|
|
7156
7451
|
};
|
|
7157
|
-
const filename = (0,
|
|
7452
|
+
const filename = (0, import_node_path65.basename)(legacyPath);
|
|
7158
7453
|
return new _RulesyncRule({
|
|
7159
7454
|
baseDir: process.cwd(),
|
|
7160
7455
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -7168,7 +7463,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
7168
7463
|
relativeFilePath,
|
|
7169
7464
|
validate = true
|
|
7170
7465
|
}) {
|
|
7171
|
-
const filePath = (0,
|
|
7466
|
+
const filePath = (0, import_node_path65.join)(
|
|
7172
7467
|
process.cwd(),
|
|
7173
7468
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
7174
7469
|
relativeFilePath
|
|
@@ -7187,7 +7482,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
7187
7482
|
agentsmd: result.data.agentsmd,
|
|
7188
7483
|
cursor: result.data.cursor
|
|
7189
7484
|
};
|
|
7190
|
-
const filename = (0,
|
|
7485
|
+
const filename = (0, import_node_path65.basename)(filePath);
|
|
7191
7486
|
return new _RulesyncRule({
|
|
7192
7487
|
baseDir: process.cwd(),
|
|
7193
7488
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -7270,7 +7565,7 @@ var ToolRule = class extends ToolFile {
|
|
|
7270
7565
|
rulesyncRule,
|
|
7271
7566
|
validate = true,
|
|
7272
7567
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
7273
|
-
nonRootPath = { relativeDirPath: (0,
|
|
7568
|
+
nonRootPath = { relativeDirPath: (0, import_node_path66.join)(".agents", "memories") }
|
|
7274
7569
|
}) {
|
|
7275
7570
|
const params = this.buildToolRuleParamsDefault({
|
|
7276
7571
|
baseDir,
|
|
@@ -7281,7 +7576,7 @@ var ToolRule = class extends ToolFile {
|
|
|
7281
7576
|
});
|
|
7282
7577
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
7283
7578
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
7284
|
-
params.relativeDirPath = (0,
|
|
7579
|
+
params.relativeDirPath = (0, import_node_path66.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
7285
7580
|
params.relativeFilePath = "AGENTS.md";
|
|
7286
7581
|
}
|
|
7287
7582
|
return params;
|
|
@@ -7346,7 +7641,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
7346
7641
|
relativeFilePath: "AGENTS.md"
|
|
7347
7642
|
},
|
|
7348
7643
|
nonRoot: {
|
|
7349
|
-
relativeDirPath: (0,
|
|
7644
|
+
relativeDirPath: (0, import_node_path67.join)(".agents", "memories")
|
|
7350
7645
|
}
|
|
7351
7646
|
};
|
|
7352
7647
|
}
|
|
@@ -7356,8 +7651,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
7356
7651
|
validate = true
|
|
7357
7652
|
}) {
|
|
7358
7653
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
7359
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
7360
|
-
const fileContent = await readFileContent((0,
|
|
7654
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path67.join)(".agents", "memories", relativeFilePath);
|
|
7655
|
+
const fileContent = await readFileContent((0, import_node_path67.join)(baseDir, relativePath));
|
|
7361
7656
|
return new _AgentsMdRule({
|
|
7362
7657
|
baseDir,
|
|
7363
7658
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -7412,12 +7707,12 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
7412
7707
|
};
|
|
7413
7708
|
|
|
7414
7709
|
// src/features/rules/amazonqcli-rule.ts
|
|
7415
|
-
var
|
|
7710
|
+
var import_node_path68 = require("path");
|
|
7416
7711
|
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
7417
7712
|
static getSettablePaths() {
|
|
7418
7713
|
return {
|
|
7419
7714
|
nonRoot: {
|
|
7420
|
-
relativeDirPath: (0,
|
|
7715
|
+
relativeDirPath: (0, import_node_path68.join)(".amazonq", "rules")
|
|
7421
7716
|
}
|
|
7422
7717
|
};
|
|
7423
7718
|
}
|
|
@@ -7427,7 +7722,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
7427
7722
|
validate = true
|
|
7428
7723
|
}) {
|
|
7429
7724
|
const fileContent = await readFileContent(
|
|
7430
|
-
(0,
|
|
7725
|
+
(0, import_node_path68.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7431
7726
|
);
|
|
7432
7727
|
return new _AmazonQCliRule({
|
|
7433
7728
|
baseDir,
|
|
@@ -7481,21 +7776,21 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
7481
7776
|
};
|
|
7482
7777
|
|
|
7483
7778
|
// src/features/rules/antigravity-rule.ts
|
|
7484
|
-
var
|
|
7485
|
-
var
|
|
7486
|
-
var AntigravityRuleFrontmatterSchema =
|
|
7487
|
-
trigger:
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
7779
|
+
var import_node_path69 = require("path");
|
|
7780
|
+
var import_mini33 = require("zod/mini");
|
|
7781
|
+
var AntigravityRuleFrontmatterSchema = import_mini33.z.looseObject({
|
|
7782
|
+
trigger: import_mini33.z.optional(
|
|
7783
|
+
import_mini33.z.union([
|
|
7784
|
+
import_mini33.z.literal("always_on"),
|
|
7785
|
+
import_mini33.z.literal("glob"),
|
|
7786
|
+
import_mini33.z.literal("manual"),
|
|
7787
|
+
import_mini33.z.literal("model_decision"),
|
|
7788
|
+
import_mini33.z.string()
|
|
7494
7789
|
// accepts any string for forward compatibility
|
|
7495
7790
|
])
|
|
7496
7791
|
),
|
|
7497
|
-
globs:
|
|
7498
|
-
description:
|
|
7792
|
+
globs: import_mini33.z.optional(import_mini33.z.string()),
|
|
7793
|
+
description: import_mini33.z.optional(import_mini33.z.string())
|
|
7499
7794
|
});
|
|
7500
7795
|
function parseGlobsString(globs) {
|
|
7501
7796
|
if (!globs) {
|
|
@@ -7640,7 +7935,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
7640
7935
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7641
7936
|
if (!result.success) {
|
|
7642
7937
|
throw new Error(
|
|
7643
|
-
`Invalid frontmatter in ${(0,
|
|
7938
|
+
`Invalid frontmatter in ${(0, import_node_path69.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7644
7939
|
);
|
|
7645
7940
|
}
|
|
7646
7941
|
}
|
|
@@ -7655,7 +7950,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
7655
7950
|
static getSettablePaths() {
|
|
7656
7951
|
return {
|
|
7657
7952
|
nonRoot: {
|
|
7658
|
-
relativeDirPath: (0,
|
|
7953
|
+
relativeDirPath: (0, import_node_path69.join)(".agent", "rules")
|
|
7659
7954
|
}
|
|
7660
7955
|
};
|
|
7661
7956
|
}
|
|
@@ -7664,7 +7959,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
7664
7959
|
relativeFilePath,
|
|
7665
7960
|
validate = true
|
|
7666
7961
|
}) {
|
|
7667
|
-
const filePath = (0,
|
|
7962
|
+
const filePath = (0, import_node_path69.join)(
|
|
7668
7963
|
baseDir,
|
|
7669
7964
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
7670
7965
|
relativeFilePath
|
|
@@ -7805,7 +8100,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
7805
8100
|
};
|
|
7806
8101
|
|
|
7807
8102
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
7808
|
-
var
|
|
8103
|
+
var import_node_path70 = require("path");
|
|
7809
8104
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
7810
8105
|
toRulesyncRule() {
|
|
7811
8106
|
const rulesyncFrontmatter = {
|
|
@@ -7831,7 +8126,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
7831
8126
|
relativeFilePath: ".augment-guidelines"
|
|
7832
8127
|
},
|
|
7833
8128
|
nonRoot: {
|
|
7834
|
-
relativeDirPath: (0,
|
|
8129
|
+
relativeDirPath: (0, import_node_path70.join)(".augment", "rules")
|
|
7835
8130
|
}
|
|
7836
8131
|
};
|
|
7837
8132
|
}
|
|
@@ -7866,8 +8161,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
7866
8161
|
}) {
|
|
7867
8162
|
const settablePaths = this.getSettablePaths();
|
|
7868
8163
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
7869
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
7870
|
-
const fileContent = await readFileContent((0,
|
|
8164
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path70.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8165
|
+
const fileContent = await readFileContent((0, import_node_path70.join)(baseDir, relativePath));
|
|
7871
8166
|
return new _AugmentcodeLegacyRule({
|
|
7872
8167
|
baseDir,
|
|
7873
8168
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -7896,7 +8191,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
7896
8191
|
};
|
|
7897
8192
|
|
|
7898
8193
|
// src/features/rules/augmentcode-rule.ts
|
|
7899
|
-
var
|
|
8194
|
+
var import_node_path71 = require("path");
|
|
7900
8195
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
7901
8196
|
toRulesyncRule() {
|
|
7902
8197
|
return this.toRulesyncRuleDefault();
|
|
@@ -7904,7 +8199,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
7904
8199
|
static getSettablePaths() {
|
|
7905
8200
|
return {
|
|
7906
8201
|
nonRoot: {
|
|
7907
|
-
relativeDirPath: (0,
|
|
8202
|
+
relativeDirPath: (0, import_node_path71.join)(".augment", "rules")
|
|
7908
8203
|
}
|
|
7909
8204
|
};
|
|
7910
8205
|
}
|
|
@@ -7928,7 +8223,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
7928
8223
|
validate = true
|
|
7929
8224
|
}) {
|
|
7930
8225
|
const fileContent = await readFileContent(
|
|
7931
|
-
(0,
|
|
8226
|
+
(0, import_node_path71.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7932
8227
|
);
|
|
7933
8228
|
const { body: content } = parseFrontmatter(fileContent);
|
|
7934
8229
|
return new _AugmentcodeRule({
|
|
@@ -7964,7 +8259,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
7964
8259
|
};
|
|
7965
8260
|
|
|
7966
8261
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
7967
|
-
var
|
|
8262
|
+
var import_node_path72 = require("path");
|
|
7968
8263
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
7969
8264
|
static getSettablePaths({
|
|
7970
8265
|
global
|
|
@@ -7983,7 +8278,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
7983
8278
|
relativeFilePath: "CLAUDE.md"
|
|
7984
8279
|
},
|
|
7985
8280
|
nonRoot: {
|
|
7986
|
-
relativeDirPath: (0,
|
|
8281
|
+
relativeDirPath: (0, import_node_path72.join)(".claude", "memories")
|
|
7987
8282
|
}
|
|
7988
8283
|
};
|
|
7989
8284
|
}
|
|
@@ -7998,7 +8293,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
7998
8293
|
if (isRoot) {
|
|
7999
8294
|
const relativePath2 = paths.root.relativeFilePath;
|
|
8000
8295
|
const fileContent2 = await readFileContent(
|
|
8001
|
-
(0,
|
|
8296
|
+
(0, import_node_path72.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
8002
8297
|
);
|
|
8003
8298
|
return new _ClaudecodeLegacyRule({
|
|
8004
8299
|
baseDir,
|
|
@@ -8012,8 +8307,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8012
8307
|
if (!paths.nonRoot) {
|
|
8013
8308
|
throw new Error("nonRoot path is not set");
|
|
8014
8309
|
}
|
|
8015
|
-
const relativePath = (0,
|
|
8016
|
-
const fileContent = await readFileContent((0,
|
|
8310
|
+
const relativePath = (0, import_node_path72.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8311
|
+
const fileContent = await readFileContent((0, import_node_path72.join)(baseDir, relativePath));
|
|
8017
8312
|
return new _ClaudecodeLegacyRule({
|
|
8018
8313
|
baseDir,
|
|
8019
8314
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -8072,10 +8367,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8072
8367
|
};
|
|
8073
8368
|
|
|
8074
8369
|
// src/features/rules/claudecode-rule.ts
|
|
8075
|
-
var
|
|
8076
|
-
var
|
|
8077
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
8078
|
-
paths:
|
|
8370
|
+
var import_node_path73 = require("path");
|
|
8371
|
+
var import_mini34 = require("zod/mini");
|
|
8372
|
+
var ClaudecodeRuleFrontmatterSchema = import_mini34.z.object({
|
|
8373
|
+
paths: import_mini34.z.optional(import_mini34.z.string())
|
|
8079
8374
|
});
|
|
8080
8375
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
8081
8376
|
frontmatter;
|
|
@@ -8097,7 +8392,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8097
8392
|
relativeFilePath: "CLAUDE.md"
|
|
8098
8393
|
},
|
|
8099
8394
|
nonRoot: {
|
|
8100
|
-
relativeDirPath: (0,
|
|
8395
|
+
relativeDirPath: (0, import_node_path73.join)(".claude", "rules")
|
|
8101
8396
|
}
|
|
8102
8397
|
};
|
|
8103
8398
|
}
|
|
@@ -8106,7 +8401,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8106
8401
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8107
8402
|
if (!result.success) {
|
|
8108
8403
|
throw new Error(
|
|
8109
|
-
`Invalid frontmatter in ${(0,
|
|
8404
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8110
8405
|
);
|
|
8111
8406
|
}
|
|
8112
8407
|
}
|
|
@@ -8134,7 +8429,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8134
8429
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
8135
8430
|
if (isRoot) {
|
|
8136
8431
|
const fileContent2 = await readFileContent(
|
|
8137
|
-
(0,
|
|
8432
|
+
(0, import_node_path73.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
8138
8433
|
);
|
|
8139
8434
|
return new _ClaudecodeRule({
|
|
8140
8435
|
baseDir,
|
|
@@ -8149,13 +8444,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8149
8444
|
if (!paths.nonRoot) {
|
|
8150
8445
|
throw new Error("nonRoot path is not set");
|
|
8151
8446
|
}
|
|
8152
|
-
const relativePath = (0,
|
|
8153
|
-
const fileContent = await readFileContent((0,
|
|
8447
|
+
const relativePath = (0, import_node_path73.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8448
|
+
const fileContent = await readFileContent((0, import_node_path73.join)(baseDir, relativePath));
|
|
8154
8449
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8155
8450
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8156
8451
|
if (!result.success) {
|
|
8157
8452
|
throw new Error(
|
|
8158
|
-
`Invalid frontmatter in ${(0,
|
|
8453
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
8159
8454
|
);
|
|
8160
8455
|
}
|
|
8161
8456
|
return new _ClaudecodeRule({
|
|
@@ -8262,7 +8557,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8262
8557
|
return {
|
|
8263
8558
|
success: false,
|
|
8264
8559
|
error: new Error(
|
|
8265
|
-
`Invalid frontmatter in ${(0,
|
|
8560
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8266
8561
|
)
|
|
8267
8562
|
};
|
|
8268
8563
|
}
|
|
@@ -8282,10 +8577,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8282
8577
|
};
|
|
8283
8578
|
|
|
8284
8579
|
// src/features/rules/cline-rule.ts
|
|
8285
|
-
var
|
|
8286
|
-
var
|
|
8287
|
-
var ClineRuleFrontmatterSchema =
|
|
8288
|
-
description:
|
|
8580
|
+
var import_node_path74 = require("path");
|
|
8581
|
+
var import_mini35 = require("zod/mini");
|
|
8582
|
+
var ClineRuleFrontmatterSchema = import_mini35.z.object({
|
|
8583
|
+
description: import_mini35.z.string()
|
|
8289
8584
|
});
|
|
8290
8585
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
8291
8586
|
static getSettablePaths() {
|
|
@@ -8327,7 +8622,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
8327
8622
|
validate = true
|
|
8328
8623
|
}) {
|
|
8329
8624
|
const fileContent = await readFileContent(
|
|
8330
|
-
(0,
|
|
8625
|
+
(0, import_node_path74.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
8331
8626
|
);
|
|
8332
8627
|
return new _ClineRule({
|
|
8333
8628
|
baseDir,
|
|
@@ -8353,7 +8648,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
8353
8648
|
};
|
|
8354
8649
|
|
|
8355
8650
|
// src/features/rules/codexcli-rule.ts
|
|
8356
|
-
var
|
|
8651
|
+
var import_node_path75 = require("path");
|
|
8357
8652
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
8358
8653
|
static getSettablePaths({
|
|
8359
8654
|
global
|
|
@@ -8372,7 +8667,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
8372
8667
|
relativeFilePath: "AGENTS.md"
|
|
8373
8668
|
},
|
|
8374
8669
|
nonRoot: {
|
|
8375
|
-
relativeDirPath: (0,
|
|
8670
|
+
relativeDirPath: (0, import_node_path75.join)(".codex", "memories")
|
|
8376
8671
|
}
|
|
8377
8672
|
};
|
|
8378
8673
|
}
|
|
@@ -8387,7 +8682,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
8387
8682
|
if (isRoot) {
|
|
8388
8683
|
const relativePath2 = paths.root.relativeFilePath;
|
|
8389
8684
|
const fileContent2 = await readFileContent(
|
|
8390
|
-
(0,
|
|
8685
|
+
(0, import_node_path75.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
8391
8686
|
);
|
|
8392
8687
|
return new _CodexcliRule({
|
|
8393
8688
|
baseDir,
|
|
@@ -8401,8 +8696,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
8401
8696
|
if (!paths.nonRoot) {
|
|
8402
8697
|
throw new Error("nonRoot path is not set");
|
|
8403
8698
|
}
|
|
8404
|
-
const relativePath = (0,
|
|
8405
|
-
const fileContent = await readFileContent((0,
|
|
8699
|
+
const relativePath = (0, import_node_path75.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8700
|
+
const fileContent = await readFileContent((0, import_node_path75.join)(baseDir, relativePath));
|
|
8406
8701
|
return new _CodexcliRule({
|
|
8407
8702
|
baseDir,
|
|
8408
8703
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -8461,12 +8756,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
8461
8756
|
};
|
|
8462
8757
|
|
|
8463
8758
|
// src/features/rules/copilot-rule.ts
|
|
8464
|
-
var
|
|
8465
|
-
var
|
|
8466
|
-
var CopilotRuleFrontmatterSchema =
|
|
8467
|
-
description:
|
|
8468
|
-
applyTo:
|
|
8469
|
-
excludeAgent:
|
|
8759
|
+
var import_node_path76 = require("path");
|
|
8760
|
+
var import_mini36 = require("zod/mini");
|
|
8761
|
+
var CopilotRuleFrontmatterSchema = import_mini36.z.object({
|
|
8762
|
+
description: import_mini36.z.optional(import_mini36.z.string()),
|
|
8763
|
+
applyTo: import_mini36.z.optional(import_mini36.z.string()),
|
|
8764
|
+
excludeAgent: import_mini36.z.optional(import_mini36.z.union([import_mini36.z.literal("code-review"), import_mini36.z.literal("coding-agent")]))
|
|
8470
8765
|
});
|
|
8471
8766
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
8472
8767
|
frontmatter;
|
|
@@ -8478,7 +8773,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
8478
8773
|
relativeFilePath: "copilot-instructions.md"
|
|
8479
8774
|
},
|
|
8480
8775
|
nonRoot: {
|
|
8481
|
-
relativeDirPath: (0,
|
|
8776
|
+
relativeDirPath: (0, import_node_path76.join)(".github", "instructions")
|
|
8482
8777
|
}
|
|
8483
8778
|
};
|
|
8484
8779
|
}
|
|
@@ -8487,7 +8782,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
8487
8782
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8488
8783
|
if (!result.success) {
|
|
8489
8784
|
throw new Error(
|
|
8490
|
-
`Invalid frontmatter in ${(0,
|
|
8785
|
+
`Invalid frontmatter in ${(0, import_node_path76.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8491
8786
|
);
|
|
8492
8787
|
}
|
|
8493
8788
|
}
|
|
@@ -8569,11 +8864,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
8569
8864
|
validate = true
|
|
8570
8865
|
}) {
|
|
8571
8866
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
8572
|
-
const relativePath = isRoot ? (0,
|
|
8867
|
+
const relativePath = isRoot ? (0, import_node_path76.join)(
|
|
8573
8868
|
this.getSettablePaths().root.relativeDirPath,
|
|
8574
8869
|
this.getSettablePaths().root.relativeFilePath
|
|
8575
|
-
) : (0,
|
|
8576
|
-
const fileContent = await readFileContent((0,
|
|
8870
|
+
) : (0, import_node_path76.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
8871
|
+
const fileContent = await readFileContent((0, import_node_path76.join)(baseDir, relativePath));
|
|
8577
8872
|
if (isRoot) {
|
|
8578
8873
|
return new _CopilotRule({
|
|
8579
8874
|
baseDir,
|
|
@@ -8589,7 +8884,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
8589
8884
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8590
8885
|
if (!result.success) {
|
|
8591
8886
|
throw new Error(
|
|
8592
|
-
`Invalid frontmatter in ${(0,
|
|
8887
|
+
`Invalid frontmatter in ${(0, import_node_path76.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
8593
8888
|
);
|
|
8594
8889
|
}
|
|
8595
8890
|
return new _CopilotRule({
|
|
@@ -8629,7 +8924,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
8629
8924
|
return {
|
|
8630
8925
|
success: false,
|
|
8631
8926
|
error: new Error(
|
|
8632
|
-
`Invalid frontmatter in ${(0,
|
|
8927
|
+
`Invalid frontmatter in ${(0, import_node_path76.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8633
8928
|
)
|
|
8634
8929
|
};
|
|
8635
8930
|
}
|
|
@@ -8649,12 +8944,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
8649
8944
|
};
|
|
8650
8945
|
|
|
8651
8946
|
// src/features/rules/cursor-rule.ts
|
|
8652
|
-
var
|
|
8653
|
-
var
|
|
8654
|
-
var CursorRuleFrontmatterSchema =
|
|
8655
|
-
description:
|
|
8656
|
-
globs:
|
|
8657
|
-
alwaysApply:
|
|
8947
|
+
var import_node_path77 = require("path");
|
|
8948
|
+
var import_mini37 = require("zod/mini");
|
|
8949
|
+
var CursorRuleFrontmatterSchema = import_mini37.z.object({
|
|
8950
|
+
description: import_mini37.z.optional(import_mini37.z.string()),
|
|
8951
|
+
globs: import_mini37.z.optional(import_mini37.z.string()),
|
|
8952
|
+
alwaysApply: import_mini37.z.optional(import_mini37.z.boolean())
|
|
8658
8953
|
});
|
|
8659
8954
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
8660
8955
|
frontmatter;
|
|
@@ -8662,7 +8957,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
8662
8957
|
static getSettablePaths() {
|
|
8663
8958
|
return {
|
|
8664
8959
|
nonRoot: {
|
|
8665
|
-
relativeDirPath: (0,
|
|
8960
|
+
relativeDirPath: (0, import_node_path77.join)(".cursor", "rules")
|
|
8666
8961
|
}
|
|
8667
8962
|
};
|
|
8668
8963
|
}
|
|
@@ -8671,7 +8966,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
8671
8966
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8672
8967
|
if (!result.success) {
|
|
8673
8968
|
throw new Error(
|
|
8674
|
-
`Invalid frontmatter in ${(0,
|
|
8969
|
+
`Invalid frontmatter in ${(0, import_node_path77.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8675
8970
|
);
|
|
8676
8971
|
}
|
|
8677
8972
|
}
|
|
@@ -8788,19 +9083,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
8788
9083
|
validate = true
|
|
8789
9084
|
}) {
|
|
8790
9085
|
const fileContent = await readFileContent(
|
|
8791
|
-
(0,
|
|
9086
|
+
(0, import_node_path77.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
8792
9087
|
);
|
|
8793
9088
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
8794
9089
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8795
9090
|
if (!result.success) {
|
|
8796
9091
|
throw new Error(
|
|
8797
|
-
`Invalid frontmatter in ${(0,
|
|
9092
|
+
`Invalid frontmatter in ${(0, import_node_path77.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
8798
9093
|
);
|
|
8799
9094
|
}
|
|
8800
9095
|
return new _CursorRule({
|
|
8801
9096
|
baseDir,
|
|
8802
9097
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
8803
|
-
relativeFilePath: (0,
|
|
9098
|
+
relativeFilePath: (0, import_node_path77.basename)(relativeFilePath),
|
|
8804
9099
|
frontmatter: result.data,
|
|
8805
9100
|
body: content.trim(),
|
|
8806
9101
|
validate
|
|
@@ -8831,7 +9126,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
8831
9126
|
return {
|
|
8832
9127
|
success: false,
|
|
8833
9128
|
error: new Error(
|
|
8834
|
-
`Invalid frontmatter in ${(0,
|
|
9129
|
+
`Invalid frontmatter in ${(0, import_node_path77.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8835
9130
|
)
|
|
8836
9131
|
};
|
|
8837
9132
|
}
|
|
@@ -8851,7 +9146,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
8851
9146
|
};
|
|
8852
9147
|
|
|
8853
9148
|
// src/features/rules/geminicli-rule.ts
|
|
8854
|
-
var
|
|
9149
|
+
var import_node_path78 = require("path");
|
|
8855
9150
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
8856
9151
|
static getSettablePaths({
|
|
8857
9152
|
global
|
|
@@ -8870,7 +9165,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
8870
9165
|
relativeFilePath: "GEMINI.md"
|
|
8871
9166
|
},
|
|
8872
9167
|
nonRoot: {
|
|
8873
|
-
relativeDirPath: (0,
|
|
9168
|
+
relativeDirPath: (0, import_node_path78.join)(".gemini", "memories")
|
|
8874
9169
|
}
|
|
8875
9170
|
};
|
|
8876
9171
|
}
|
|
@@ -8885,7 +9180,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
8885
9180
|
if (isRoot) {
|
|
8886
9181
|
const relativePath2 = paths.root.relativeFilePath;
|
|
8887
9182
|
const fileContent2 = await readFileContent(
|
|
8888
|
-
(0,
|
|
9183
|
+
(0, import_node_path78.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
8889
9184
|
);
|
|
8890
9185
|
return new _GeminiCliRule({
|
|
8891
9186
|
baseDir,
|
|
@@ -8899,8 +9194,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
8899
9194
|
if (!paths.nonRoot) {
|
|
8900
9195
|
throw new Error("nonRoot path is not set");
|
|
8901
9196
|
}
|
|
8902
|
-
const relativePath = (0,
|
|
8903
|
-
const fileContent = await readFileContent((0,
|
|
9197
|
+
const relativePath = (0, import_node_path78.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9198
|
+
const fileContent = await readFileContent((0, import_node_path78.join)(baseDir, relativePath));
|
|
8904
9199
|
return new _GeminiCliRule({
|
|
8905
9200
|
baseDir,
|
|
8906
9201
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -8959,7 +9254,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
8959
9254
|
};
|
|
8960
9255
|
|
|
8961
9256
|
// src/features/rules/junie-rule.ts
|
|
8962
|
-
var
|
|
9257
|
+
var import_node_path79 = require("path");
|
|
8963
9258
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
8964
9259
|
static getSettablePaths() {
|
|
8965
9260
|
return {
|
|
@@ -8968,7 +9263,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
8968
9263
|
relativeFilePath: "guidelines.md"
|
|
8969
9264
|
},
|
|
8970
9265
|
nonRoot: {
|
|
8971
|
-
relativeDirPath: (0,
|
|
9266
|
+
relativeDirPath: (0, import_node_path79.join)(".junie", "memories")
|
|
8972
9267
|
}
|
|
8973
9268
|
};
|
|
8974
9269
|
}
|
|
@@ -8978,8 +9273,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
8978
9273
|
validate = true
|
|
8979
9274
|
}) {
|
|
8980
9275
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
8981
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
8982
|
-
const fileContent = await readFileContent((0,
|
|
9276
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path79.join)(".junie", "memories", relativeFilePath);
|
|
9277
|
+
const fileContent = await readFileContent((0, import_node_path79.join)(baseDir, relativePath));
|
|
8983
9278
|
return new _JunieRule({
|
|
8984
9279
|
baseDir,
|
|
8985
9280
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9034,12 +9329,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9034
9329
|
};
|
|
9035
9330
|
|
|
9036
9331
|
// src/features/rules/kiro-rule.ts
|
|
9037
|
-
var
|
|
9332
|
+
var import_node_path80 = require("path");
|
|
9038
9333
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
9039
9334
|
static getSettablePaths() {
|
|
9040
9335
|
return {
|
|
9041
9336
|
nonRoot: {
|
|
9042
|
-
relativeDirPath: (0,
|
|
9337
|
+
relativeDirPath: (0, import_node_path80.join)(".kiro", "steering")
|
|
9043
9338
|
}
|
|
9044
9339
|
};
|
|
9045
9340
|
}
|
|
@@ -9049,7 +9344,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
9049
9344
|
validate = true
|
|
9050
9345
|
}) {
|
|
9051
9346
|
const fileContent = await readFileContent(
|
|
9052
|
-
(0,
|
|
9347
|
+
(0, import_node_path80.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9053
9348
|
);
|
|
9054
9349
|
return new _KiroRule({
|
|
9055
9350
|
baseDir,
|
|
@@ -9103,7 +9398,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
9103
9398
|
};
|
|
9104
9399
|
|
|
9105
9400
|
// src/features/rules/opencode-rule.ts
|
|
9106
|
-
var
|
|
9401
|
+
var import_node_path81 = require("path");
|
|
9107
9402
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
9108
9403
|
static getSettablePaths() {
|
|
9109
9404
|
return {
|
|
@@ -9112,7 +9407,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
9112
9407
|
relativeFilePath: "AGENTS.md"
|
|
9113
9408
|
},
|
|
9114
9409
|
nonRoot: {
|
|
9115
|
-
relativeDirPath: (0,
|
|
9410
|
+
relativeDirPath: (0, import_node_path81.join)(".opencode", "memories")
|
|
9116
9411
|
}
|
|
9117
9412
|
};
|
|
9118
9413
|
}
|
|
@@ -9122,8 +9417,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
9122
9417
|
validate = true
|
|
9123
9418
|
}) {
|
|
9124
9419
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
9125
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
9126
|
-
const fileContent = await readFileContent((0,
|
|
9420
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path81.join)(".opencode", "memories", relativeFilePath);
|
|
9421
|
+
const fileContent = await readFileContent((0, import_node_path81.join)(baseDir, relativePath));
|
|
9127
9422
|
return new _OpenCodeRule({
|
|
9128
9423
|
baseDir,
|
|
9129
9424
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9178,7 +9473,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
9178
9473
|
};
|
|
9179
9474
|
|
|
9180
9475
|
// src/features/rules/qwencode-rule.ts
|
|
9181
|
-
var
|
|
9476
|
+
var import_node_path82 = require("path");
|
|
9182
9477
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
9183
9478
|
static getSettablePaths() {
|
|
9184
9479
|
return {
|
|
@@ -9187,7 +9482,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
9187
9482
|
relativeFilePath: "QWEN.md"
|
|
9188
9483
|
},
|
|
9189
9484
|
nonRoot: {
|
|
9190
|
-
relativeDirPath: (0,
|
|
9485
|
+
relativeDirPath: (0, import_node_path82.join)(".qwen", "memories")
|
|
9191
9486
|
}
|
|
9192
9487
|
};
|
|
9193
9488
|
}
|
|
@@ -9197,8 +9492,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
9197
9492
|
validate = true
|
|
9198
9493
|
}) {
|
|
9199
9494
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
9200
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
9201
|
-
const fileContent = await readFileContent((0,
|
|
9495
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path82.join)(".qwen", "memories", relativeFilePath);
|
|
9496
|
+
const fileContent = await readFileContent((0, import_node_path82.join)(baseDir, relativePath));
|
|
9202
9497
|
return new _QwencodeRule({
|
|
9203
9498
|
baseDir,
|
|
9204
9499
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9250,12 +9545,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
9250
9545
|
};
|
|
9251
9546
|
|
|
9252
9547
|
// src/features/rules/roo-rule.ts
|
|
9253
|
-
var
|
|
9548
|
+
var import_node_path83 = require("path");
|
|
9254
9549
|
var RooRule = class _RooRule extends ToolRule {
|
|
9255
9550
|
static getSettablePaths() {
|
|
9256
9551
|
return {
|
|
9257
9552
|
nonRoot: {
|
|
9258
|
-
relativeDirPath: (0,
|
|
9553
|
+
relativeDirPath: (0, import_node_path83.join)(".roo", "rules")
|
|
9259
9554
|
}
|
|
9260
9555
|
};
|
|
9261
9556
|
}
|
|
@@ -9265,7 +9560,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
9265
9560
|
validate = true
|
|
9266
9561
|
}) {
|
|
9267
9562
|
const fileContent = await readFileContent(
|
|
9268
|
-
(0,
|
|
9563
|
+
(0, import_node_path83.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9269
9564
|
);
|
|
9270
9565
|
return new _RooRule({
|
|
9271
9566
|
baseDir,
|
|
@@ -9334,7 +9629,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
9334
9629
|
};
|
|
9335
9630
|
|
|
9336
9631
|
// src/features/rules/warp-rule.ts
|
|
9337
|
-
var
|
|
9632
|
+
var import_node_path84 = require("path");
|
|
9338
9633
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
9339
9634
|
constructor({ fileContent, root, ...rest }) {
|
|
9340
9635
|
super({
|
|
@@ -9350,7 +9645,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
9350
9645
|
relativeFilePath: "WARP.md"
|
|
9351
9646
|
},
|
|
9352
9647
|
nonRoot: {
|
|
9353
|
-
relativeDirPath: (0,
|
|
9648
|
+
relativeDirPath: (0, import_node_path84.join)(".warp", "memories")
|
|
9354
9649
|
}
|
|
9355
9650
|
};
|
|
9356
9651
|
}
|
|
@@ -9360,8 +9655,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
9360
9655
|
validate = true
|
|
9361
9656
|
}) {
|
|
9362
9657
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
9363
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
9364
|
-
const fileContent = await readFileContent((0,
|
|
9658
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path84.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
9659
|
+
const fileContent = await readFileContent((0, import_node_path84.join)(baseDir, relativePath));
|
|
9365
9660
|
return new _WarpRule({
|
|
9366
9661
|
baseDir,
|
|
9367
9662
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -9416,12 +9711,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
9416
9711
|
};
|
|
9417
9712
|
|
|
9418
9713
|
// src/features/rules/windsurf-rule.ts
|
|
9419
|
-
var
|
|
9714
|
+
var import_node_path85 = require("path");
|
|
9420
9715
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
9421
9716
|
static getSettablePaths() {
|
|
9422
9717
|
return {
|
|
9423
9718
|
nonRoot: {
|
|
9424
|
-
relativeDirPath: (0,
|
|
9719
|
+
relativeDirPath: (0, import_node_path85.join)(".windsurf", "rules")
|
|
9425
9720
|
}
|
|
9426
9721
|
};
|
|
9427
9722
|
}
|
|
@@ -9431,7 +9726,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
9431
9726
|
validate = true
|
|
9432
9727
|
}) {
|
|
9433
9728
|
const fileContent = await readFileContent(
|
|
9434
|
-
(0,
|
|
9729
|
+
(0, import_node_path85.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9435
9730
|
);
|
|
9436
9731
|
return new _WindsurfRule({
|
|
9437
9732
|
baseDir,
|
|
@@ -9504,7 +9799,7 @@ var rulesProcessorToolTargets = [
|
|
|
9504
9799
|
"warp",
|
|
9505
9800
|
"windsurf"
|
|
9506
9801
|
];
|
|
9507
|
-
var RulesProcessorToolTargetSchema =
|
|
9802
|
+
var RulesProcessorToolTargetSchema = import_mini38.z.enum(rulesProcessorToolTargets);
|
|
9508
9803
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
9509
9804
|
[
|
|
9510
9805
|
"agentsmd",
|
|
@@ -9592,10 +9887,7 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
9592
9887
|
meta: {
|
|
9593
9888
|
extension: "md",
|
|
9594
9889
|
supportsGlobal: false,
|
|
9595
|
-
ruleDiscoveryMode: "auto"
|
|
9596
|
-
additionalConventions: {
|
|
9597
|
-
subagents: { subagentClass: CopilotSubagent }
|
|
9598
|
-
}
|
|
9890
|
+
ruleDiscoveryMode: "auto"
|
|
9599
9891
|
}
|
|
9600
9892
|
}
|
|
9601
9893
|
],
|
|
@@ -9792,7 +10084,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
9792
10084
|
}).relativeDirPath;
|
|
9793
10085
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
9794
10086
|
const frontmatter = skill.getFrontmatter();
|
|
9795
|
-
const relativePath = (0,
|
|
10087
|
+
const relativePath = (0, import_node_path86.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
9796
10088
|
return {
|
|
9797
10089
|
name: frontmatter.name,
|
|
9798
10090
|
description: frontmatter.description,
|
|
@@ -9859,10 +10151,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
9859
10151
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
9860
10152
|
*/
|
|
9861
10153
|
async loadRulesyncFiles() {
|
|
9862
|
-
const files = await findFilesByGlobs((0,
|
|
10154
|
+
const files = await findFilesByGlobs((0, import_node_path86.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
9863
10155
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
9864
10156
|
const rulesyncRules = await Promise.all(
|
|
9865
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0,
|
|
10157
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path86.basename)(file) }))
|
|
9866
10158
|
);
|
|
9867
10159
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
9868
10160
|
if (rootRules.length > 1) {
|
|
@@ -9880,10 +10172,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
9880
10172
|
return rulesyncRules;
|
|
9881
10173
|
}
|
|
9882
10174
|
async loadRulesyncFilesLegacy() {
|
|
9883
|
-
const legacyFiles = await findFilesByGlobs((0,
|
|
10175
|
+
const legacyFiles = await findFilesByGlobs((0, import_node_path86.join)(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
9884
10176
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
9885
10177
|
return Promise.all(
|
|
9886
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0,
|
|
10178
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path86.basename)(file) }))
|
|
9887
10179
|
);
|
|
9888
10180
|
}
|
|
9889
10181
|
/**
|
|
@@ -9901,7 +10193,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
9901
10193
|
return [];
|
|
9902
10194
|
}
|
|
9903
10195
|
const rootFilePaths = await findFilesByGlobs(
|
|
9904
|
-
(0,
|
|
10196
|
+
(0, import_node_path86.join)(
|
|
9905
10197
|
this.baseDir,
|
|
9906
10198
|
settablePaths.root.relativeDirPath ?? ".",
|
|
9907
10199
|
settablePaths.root.relativeFilePath
|
|
@@ -9912,7 +10204,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
9912
10204
|
(filePath) => factory.class.forDeletion({
|
|
9913
10205
|
baseDir: this.baseDir,
|
|
9914
10206
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
9915
|
-
relativeFilePath: (0,
|
|
10207
|
+
relativeFilePath: (0, import_node_path86.basename)(filePath),
|
|
9916
10208
|
global: this.global
|
|
9917
10209
|
})
|
|
9918
10210
|
).filter((rule) => rule.isDeletable());
|
|
@@ -9921,7 +10213,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
9921
10213
|
rootFilePaths.map(
|
|
9922
10214
|
(filePath) => factory.class.fromFile({
|
|
9923
10215
|
baseDir: this.baseDir,
|
|
9924
|
-
relativeFilePath: (0,
|
|
10216
|
+
relativeFilePath: (0, import_node_path86.basename)(filePath),
|
|
9925
10217
|
global: this.global
|
|
9926
10218
|
})
|
|
9927
10219
|
)
|
|
@@ -9933,14 +10225,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
9933
10225
|
return [];
|
|
9934
10226
|
}
|
|
9935
10227
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
9936
|
-
(0,
|
|
10228
|
+
(0, import_node_path86.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
9937
10229
|
);
|
|
9938
10230
|
if (forDeletion) {
|
|
9939
10231
|
return nonRootFilePaths.map(
|
|
9940
10232
|
(filePath) => factory.class.forDeletion({
|
|
9941
10233
|
baseDir: this.baseDir,
|
|
9942
10234
|
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
9943
|
-
relativeFilePath: (0,
|
|
10235
|
+
relativeFilePath: (0, import_node_path86.basename)(filePath),
|
|
9944
10236
|
global: this.global
|
|
9945
10237
|
})
|
|
9946
10238
|
).filter((rule) => rule.isDeletable());
|
|
@@ -9949,7 +10241,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
9949
10241
|
nonRootFilePaths.map(
|
|
9950
10242
|
(filePath) => factory.class.fromFile({
|
|
9951
10243
|
baseDir: this.baseDir,
|
|
9952
|
-
relativeFilePath: (0,
|
|
10244
|
+
relativeFilePath: (0, import_node_path86.basename)(filePath),
|
|
9953
10245
|
global: this.global
|
|
9954
10246
|
})
|
|
9955
10247
|
)
|
|
@@ -10042,14 +10334,14 @@ s/<command> [arguments]
|
|
|
10042
10334
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
10043
10335
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
10044
10336
|
|
|
10045
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
10337
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path86.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
10046
10338
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
10047
10339
|
|
|
10048
10340
|
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.
|
|
10049
10341
|
|
|
10050
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
10342
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path86.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
10051
10343
|
|
|
10052
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
10344
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path86.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
10053
10345
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
10054
10346
|
const result = [
|
|
10055
10347
|
overview,
|
|
@@ -10331,7 +10623,7 @@ async function generateSkills(config) {
|
|
|
10331
10623
|
}
|
|
10332
10624
|
|
|
10333
10625
|
// src/cli/commands/gitignore.ts
|
|
10334
|
-
var
|
|
10626
|
+
var import_node_path87 = require("path");
|
|
10335
10627
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
10336
10628
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
10337
10629
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -10376,7 +10668,7 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
10376
10668
|
"**/.github/copilot-instructions.md",
|
|
10377
10669
|
"**/.github/instructions/",
|
|
10378
10670
|
"**/.github/prompts/",
|
|
10379
|
-
"**/.github/
|
|
10671
|
+
"**/.github/agents/",
|
|
10380
10672
|
"**/.github/skills/",
|
|
10381
10673
|
"**/.vscode/mcp.json",
|
|
10382
10674
|
// Junie
|
|
@@ -10388,6 +10680,7 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
10388
10680
|
// OpenCode
|
|
10389
10681
|
"**/.opencode/memories/",
|
|
10390
10682
|
"**/.opencode/command/",
|
|
10683
|
+
"**/.opencode/agent/",
|
|
10391
10684
|
"**/.opencode/skills/",
|
|
10392
10685
|
"**/opencode.json",
|
|
10393
10686
|
// Qwen
|
|
@@ -10455,7 +10748,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
10455
10748
|
return result;
|
|
10456
10749
|
};
|
|
10457
10750
|
var gitignoreCommand = async () => {
|
|
10458
|
-
const gitignorePath = (0,
|
|
10751
|
+
const gitignorePath = (0, import_node_path87.join)(process.cwd(), ".gitignore");
|
|
10459
10752
|
let gitignoreContent = "";
|
|
10460
10753
|
if (await fileExists(gitignorePath)) {
|
|
10461
10754
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -10654,7 +10947,7 @@ async function importSkills(config, tool) {
|
|
|
10654
10947
|
}
|
|
10655
10948
|
|
|
10656
10949
|
// src/cli/commands/init.ts
|
|
10657
|
-
var
|
|
10950
|
+
var import_node_path88 = require("path");
|
|
10658
10951
|
async function initCommand() {
|
|
10659
10952
|
logger.info("Initializing rulesync...");
|
|
10660
10953
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -10817,14 +11110,14 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
10817
11110
|
await ensureDir(commandPaths.relativeDirPath);
|
|
10818
11111
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
10819
11112
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
10820
|
-
const ruleFilepath = (0,
|
|
11113
|
+
const ruleFilepath = (0, import_node_path88.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
10821
11114
|
if (!await fileExists(ruleFilepath)) {
|
|
10822
11115
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
10823
11116
|
logger.success(`Created ${ruleFilepath}`);
|
|
10824
11117
|
} else {
|
|
10825
11118
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
10826
11119
|
}
|
|
10827
|
-
const mcpFilepath = (0,
|
|
11120
|
+
const mcpFilepath = (0, import_node_path88.join)(
|
|
10828
11121
|
mcpPaths.recommended.relativeDirPath,
|
|
10829
11122
|
mcpPaths.recommended.relativeFilePath
|
|
10830
11123
|
);
|
|
@@ -10834,21 +11127,21 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
10834
11127
|
} else {
|
|
10835
11128
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
10836
11129
|
}
|
|
10837
|
-
const commandFilepath = (0,
|
|
11130
|
+
const commandFilepath = (0, import_node_path88.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
10838
11131
|
if (!await fileExists(commandFilepath)) {
|
|
10839
11132
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
10840
11133
|
logger.success(`Created ${commandFilepath}`);
|
|
10841
11134
|
} else {
|
|
10842
11135
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
10843
11136
|
}
|
|
10844
|
-
const subagentFilepath = (0,
|
|
11137
|
+
const subagentFilepath = (0, import_node_path88.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
10845
11138
|
if (!await fileExists(subagentFilepath)) {
|
|
10846
11139
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
10847
11140
|
logger.success(`Created ${subagentFilepath}`);
|
|
10848
11141
|
} else {
|
|
10849
11142
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
10850
11143
|
}
|
|
10851
|
-
const ignoreFilepath = (0,
|
|
11144
|
+
const ignoreFilepath = (0, import_node_path88.join)(
|
|
10852
11145
|
ignorePaths.recommended.relativeDirPath,
|
|
10853
11146
|
ignorePaths.recommended.relativeFilePath
|
|
10854
11147
|
);
|
|
@@ -10864,12 +11157,12 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
10864
11157
|
var import_fastmcp = require("fastmcp");
|
|
10865
11158
|
|
|
10866
11159
|
// src/mcp/commands.ts
|
|
10867
|
-
var
|
|
10868
|
-
var
|
|
11160
|
+
var import_node_path89 = require("path");
|
|
11161
|
+
var import_mini39 = require("zod/mini");
|
|
10869
11162
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
10870
11163
|
var maxCommandsCount = 1e3;
|
|
10871
11164
|
async function listCommands() {
|
|
10872
|
-
const commandsDir = (0,
|
|
11165
|
+
const commandsDir = (0, import_node_path89.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
10873
11166
|
try {
|
|
10874
11167
|
const files = await listDirectoryFiles(commandsDir);
|
|
10875
11168
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -10881,7 +11174,7 @@ async function listCommands() {
|
|
|
10881
11174
|
});
|
|
10882
11175
|
const frontmatter = command.getFrontmatter();
|
|
10883
11176
|
return {
|
|
10884
|
-
relativePathFromCwd: (0,
|
|
11177
|
+
relativePathFromCwd: (0, import_node_path89.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
10885
11178
|
frontmatter
|
|
10886
11179
|
};
|
|
10887
11180
|
} catch (error) {
|
|
@@ -10901,13 +11194,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
10901
11194
|
relativePath: relativePathFromCwd,
|
|
10902
11195
|
intendedRootDir: process.cwd()
|
|
10903
11196
|
});
|
|
10904
|
-
const filename = (0,
|
|
11197
|
+
const filename = (0, import_node_path89.basename)(relativePathFromCwd);
|
|
10905
11198
|
try {
|
|
10906
11199
|
const command = await RulesyncCommand.fromFile({
|
|
10907
11200
|
relativeFilePath: filename
|
|
10908
11201
|
});
|
|
10909
11202
|
return {
|
|
10910
|
-
relativePathFromCwd: (0,
|
|
11203
|
+
relativePathFromCwd: (0, import_node_path89.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
10911
11204
|
frontmatter: command.getFrontmatter(),
|
|
10912
11205
|
body: command.getBody()
|
|
10913
11206
|
};
|
|
@@ -10926,7 +11219,7 @@ async function putCommand({
|
|
|
10926
11219
|
relativePath: relativePathFromCwd,
|
|
10927
11220
|
intendedRootDir: process.cwd()
|
|
10928
11221
|
});
|
|
10929
|
-
const filename = (0,
|
|
11222
|
+
const filename = (0, import_node_path89.basename)(relativePathFromCwd);
|
|
10930
11223
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
10931
11224
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
10932
11225
|
throw new Error(
|
|
@@ -10936,7 +11229,7 @@ async function putCommand({
|
|
|
10936
11229
|
try {
|
|
10937
11230
|
const existingCommands = await listCommands();
|
|
10938
11231
|
const isUpdate = existingCommands.some(
|
|
10939
|
-
(command2) => command2.relativePathFromCwd === (0,
|
|
11232
|
+
(command2) => command2.relativePathFromCwd === (0, import_node_path89.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
10940
11233
|
);
|
|
10941
11234
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
10942
11235
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -10951,11 +11244,11 @@ async function putCommand({
|
|
|
10951
11244
|
fileContent,
|
|
10952
11245
|
validate: true
|
|
10953
11246
|
});
|
|
10954
|
-
const commandsDir = (0,
|
|
11247
|
+
const commandsDir = (0, import_node_path89.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
10955
11248
|
await ensureDir(commandsDir);
|
|
10956
11249
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
10957
11250
|
return {
|
|
10958
|
-
relativePathFromCwd: (0,
|
|
11251
|
+
relativePathFromCwd: (0, import_node_path89.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
10959
11252
|
frontmatter: command.getFrontmatter(),
|
|
10960
11253
|
body: command.getBody()
|
|
10961
11254
|
};
|
|
@@ -10970,12 +11263,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
10970
11263
|
relativePath: relativePathFromCwd,
|
|
10971
11264
|
intendedRootDir: process.cwd()
|
|
10972
11265
|
});
|
|
10973
|
-
const filename = (0,
|
|
10974
|
-
const fullPath = (0,
|
|
11266
|
+
const filename = (0, import_node_path89.basename)(relativePathFromCwd);
|
|
11267
|
+
const fullPath = (0, import_node_path89.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
10975
11268
|
try {
|
|
10976
11269
|
await removeFile(fullPath);
|
|
10977
11270
|
return {
|
|
10978
|
-
relativePathFromCwd: (0,
|
|
11271
|
+
relativePathFromCwd: (0, import_node_path89.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
10979
11272
|
};
|
|
10980
11273
|
} catch (error) {
|
|
10981
11274
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -10984,23 +11277,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
10984
11277
|
}
|
|
10985
11278
|
}
|
|
10986
11279
|
var commandToolSchemas = {
|
|
10987
|
-
listCommands:
|
|
10988
|
-
getCommand:
|
|
10989
|
-
relativePathFromCwd:
|
|
11280
|
+
listCommands: import_mini39.z.object({}),
|
|
11281
|
+
getCommand: import_mini39.z.object({
|
|
11282
|
+
relativePathFromCwd: import_mini39.z.string()
|
|
10990
11283
|
}),
|
|
10991
|
-
putCommand:
|
|
10992
|
-
relativePathFromCwd:
|
|
11284
|
+
putCommand: import_mini39.z.object({
|
|
11285
|
+
relativePathFromCwd: import_mini39.z.string(),
|
|
10993
11286
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
10994
|
-
body:
|
|
11287
|
+
body: import_mini39.z.string()
|
|
10995
11288
|
}),
|
|
10996
|
-
deleteCommand:
|
|
10997
|
-
relativePathFromCwd:
|
|
11289
|
+
deleteCommand: import_mini39.z.object({
|
|
11290
|
+
relativePathFromCwd: import_mini39.z.string()
|
|
10998
11291
|
})
|
|
10999
11292
|
};
|
|
11000
11293
|
var commandTools = {
|
|
11001
11294
|
listCommands: {
|
|
11002
11295
|
name: "listCommands",
|
|
11003
|
-
description: `List all commands from ${(0,
|
|
11296
|
+
description: `List all commands from ${(0, import_node_path89.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
11004
11297
|
parameters: commandToolSchemas.listCommands,
|
|
11005
11298
|
execute: async () => {
|
|
11006
11299
|
const commands = await listCommands();
|
|
@@ -11042,11 +11335,11 @@ var commandTools = {
|
|
|
11042
11335
|
};
|
|
11043
11336
|
|
|
11044
11337
|
// src/mcp/ignore.ts
|
|
11045
|
-
var
|
|
11046
|
-
var
|
|
11338
|
+
var import_node_path90 = require("path");
|
|
11339
|
+
var import_mini40 = require("zod/mini");
|
|
11047
11340
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
11048
11341
|
async function getIgnoreFile() {
|
|
11049
|
-
const ignoreFilePath = (0,
|
|
11342
|
+
const ignoreFilePath = (0, import_node_path90.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
11050
11343
|
try {
|
|
11051
11344
|
const content = await readFileContent(ignoreFilePath);
|
|
11052
11345
|
return {
|
|
@@ -11060,7 +11353,7 @@ async function getIgnoreFile() {
|
|
|
11060
11353
|
}
|
|
11061
11354
|
}
|
|
11062
11355
|
async function putIgnoreFile({ content }) {
|
|
11063
|
-
const ignoreFilePath = (0,
|
|
11356
|
+
const ignoreFilePath = (0, import_node_path90.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
11064
11357
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
11065
11358
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
11066
11359
|
throw new Error(
|
|
@@ -11081,8 +11374,8 @@ async function putIgnoreFile({ content }) {
|
|
|
11081
11374
|
}
|
|
11082
11375
|
}
|
|
11083
11376
|
async function deleteIgnoreFile() {
|
|
11084
|
-
const aiignorePath = (0,
|
|
11085
|
-
const legacyIgnorePath = (0,
|
|
11377
|
+
const aiignorePath = (0, import_node_path90.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
11378
|
+
const legacyIgnorePath = (0, import_node_path90.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
11086
11379
|
try {
|
|
11087
11380
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
11088
11381
|
return {
|
|
@@ -11100,11 +11393,11 @@ async function deleteIgnoreFile() {
|
|
|
11100
11393
|
}
|
|
11101
11394
|
}
|
|
11102
11395
|
var ignoreToolSchemas = {
|
|
11103
|
-
getIgnoreFile:
|
|
11104
|
-
putIgnoreFile:
|
|
11105
|
-
content:
|
|
11396
|
+
getIgnoreFile: import_mini40.z.object({}),
|
|
11397
|
+
putIgnoreFile: import_mini40.z.object({
|
|
11398
|
+
content: import_mini40.z.string()
|
|
11106
11399
|
}),
|
|
11107
|
-
deleteIgnoreFile:
|
|
11400
|
+
deleteIgnoreFile: import_mini40.z.object({})
|
|
11108
11401
|
};
|
|
11109
11402
|
var ignoreTools = {
|
|
11110
11403
|
getIgnoreFile: {
|
|
@@ -11137,8 +11430,8 @@ var ignoreTools = {
|
|
|
11137
11430
|
};
|
|
11138
11431
|
|
|
11139
11432
|
// src/mcp/mcp.ts
|
|
11140
|
-
var
|
|
11141
|
-
var
|
|
11433
|
+
var import_node_path91 = require("path");
|
|
11434
|
+
var import_mini41 = require("zod/mini");
|
|
11142
11435
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
11143
11436
|
async function getMcpFile() {
|
|
11144
11437
|
const config = await ConfigResolver.resolve({});
|
|
@@ -11147,7 +11440,7 @@ async function getMcpFile() {
|
|
|
11147
11440
|
validate: true,
|
|
11148
11441
|
modularMcp: config.getModularMcp()
|
|
11149
11442
|
});
|
|
11150
|
-
const relativePathFromCwd = (0,
|
|
11443
|
+
const relativePathFromCwd = (0, import_node_path91.join)(
|
|
11151
11444
|
rulesyncMcp.getRelativeDirPath(),
|
|
11152
11445
|
rulesyncMcp.getRelativeFilePath()
|
|
11153
11446
|
);
|
|
@@ -11180,7 +11473,7 @@ async function putMcpFile({ content }) {
|
|
|
11180
11473
|
const paths = RulesyncMcp.getSettablePaths();
|
|
11181
11474
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
11182
11475
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
11183
|
-
const fullPath = (0,
|
|
11476
|
+
const fullPath = (0, import_node_path91.join)(baseDir, relativeDirPath, relativeFilePath);
|
|
11184
11477
|
const rulesyncMcp = new RulesyncMcp({
|
|
11185
11478
|
baseDir,
|
|
11186
11479
|
relativeDirPath,
|
|
@@ -11189,9 +11482,9 @@ async function putMcpFile({ content }) {
|
|
|
11189
11482
|
validate: true,
|
|
11190
11483
|
modularMcp: config.getModularMcp()
|
|
11191
11484
|
});
|
|
11192
|
-
await ensureDir((0,
|
|
11485
|
+
await ensureDir((0, import_node_path91.join)(baseDir, relativeDirPath));
|
|
11193
11486
|
await writeFileContent(fullPath, content);
|
|
11194
|
-
const relativePathFromCwd = (0,
|
|
11487
|
+
const relativePathFromCwd = (0, import_node_path91.join)(relativeDirPath, relativeFilePath);
|
|
11195
11488
|
return {
|
|
11196
11489
|
relativePathFromCwd,
|
|
11197
11490
|
content: rulesyncMcp.getFileContent()
|
|
@@ -11206,15 +11499,15 @@ async function deleteMcpFile() {
|
|
|
11206
11499
|
try {
|
|
11207
11500
|
const baseDir = process.cwd();
|
|
11208
11501
|
const paths = RulesyncMcp.getSettablePaths();
|
|
11209
|
-
const recommendedPath = (0,
|
|
11502
|
+
const recommendedPath = (0, import_node_path91.join)(
|
|
11210
11503
|
baseDir,
|
|
11211
11504
|
paths.recommended.relativeDirPath,
|
|
11212
11505
|
paths.recommended.relativeFilePath
|
|
11213
11506
|
);
|
|
11214
|
-
const legacyPath = (0,
|
|
11507
|
+
const legacyPath = (0, import_node_path91.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
11215
11508
|
await removeFile(recommendedPath);
|
|
11216
11509
|
await removeFile(legacyPath);
|
|
11217
|
-
const relativePathFromCwd = (0,
|
|
11510
|
+
const relativePathFromCwd = (0, import_node_path91.join)(
|
|
11218
11511
|
paths.recommended.relativeDirPath,
|
|
11219
11512
|
paths.recommended.relativeFilePath
|
|
11220
11513
|
);
|
|
@@ -11228,11 +11521,11 @@ async function deleteMcpFile() {
|
|
|
11228
11521
|
}
|
|
11229
11522
|
}
|
|
11230
11523
|
var mcpToolSchemas = {
|
|
11231
|
-
getMcpFile:
|
|
11232
|
-
putMcpFile:
|
|
11233
|
-
content:
|
|
11524
|
+
getMcpFile: import_mini41.z.object({}),
|
|
11525
|
+
putMcpFile: import_mini41.z.object({
|
|
11526
|
+
content: import_mini41.z.string()
|
|
11234
11527
|
}),
|
|
11235
|
-
deleteMcpFile:
|
|
11528
|
+
deleteMcpFile: import_mini41.z.object({})
|
|
11236
11529
|
};
|
|
11237
11530
|
var mcpTools = {
|
|
11238
11531
|
getMcpFile: {
|
|
@@ -11265,12 +11558,12 @@ var mcpTools = {
|
|
|
11265
11558
|
};
|
|
11266
11559
|
|
|
11267
11560
|
// src/mcp/rules.ts
|
|
11268
|
-
var
|
|
11269
|
-
var
|
|
11561
|
+
var import_node_path92 = require("path");
|
|
11562
|
+
var import_mini42 = require("zod/mini");
|
|
11270
11563
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
11271
11564
|
var maxRulesCount = 1e3;
|
|
11272
11565
|
async function listRules() {
|
|
11273
|
-
const rulesDir = (0,
|
|
11566
|
+
const rulesDir = (0, import_node_path92.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
11274
11567
|
try {
|
|
11275
11568
|
const files = await listDirectoryFiles(rulesDir);
|
|
11276
11569
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -11283,7 +11576,7 @@ async function listRules() {
|
|
|
11283
11576
|
});
|
|
11284
11577
|
const frontmatter = rule.getFrontmatter();
|
|
11285
11578
|
return {
|
|
11286
|
-
relativePathFromCwd: (0,
|
|
11579
|
+
relativePathFromCwd: (0, import_node_path92.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
11287
11580
|
frontmatter
|
|
11288
11581
|
};
|
|
11289
11582
|
} catch (error) {
|
|
@@ -11303,14 +11596,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
11303
11596
|
relativePath: relativePathFromCwd,
|
|
11304
11597
|
intendedRootDir: process.cwd()
|
|
11305
11598
|
});
|
|
11306
|
-
const filename = (0,
|
|
11599
|
+
const filename = (0, import_node_path92.basename)(relativePathFromCwd);
|
|
11307
11600
|
try {
|
|
11308
11601
|
const rule = await RulesyncRule.fromFile({
|
|
11309
11602
|
relativeFilePath: filename,
|
|
11310
11603
|
validate: true
|
|
11311
11604
|
});
|
|
11312
11605
|
return {
|
|
11313
|
-
relativePathFromCwd: (0,
|
|
11606
|
+
relativePathFromCwd: (0, import_node_path92.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
11314
11607
|
frontmatter: rule.getFrontmatter(),
|
|
11315
11608
|
body: rule.getBody()
|
|
11316
11609
|
};
|
|
@@ -11329,7 +11622,7 @@ async function putRule({
|
|
|
11329
11622
|
relativePath: relativePathFromCwd,
|
|
11330
11623
|
intendedRootDir: process.cwd()
|
|
11331
11624
|
});
|
|
11332
|
-
const filename = (0,
|
|
11625
|
+
const filename = (0, import_node_path92.basename)(relativePathFromCwd);
|
|
11333
11626
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
11334
11627
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
11335
11628
|
throw new Error(
|
|
@@ -11339,7 +11632,7 @@ async function putRule({
|
|
|
11339
11632
|
try {
|
|
11340
11633
|
const existingRules = await listRules();
|
|
11341
11634
|
const isUpdate = existingRules.some(
|
|
11342
|
-
(rule2) => rule2.relativePathFromCwd === (0,
|
|
11635
|
+
(rule2) => rule2.relativePathFromCwd === (0, import_node_path92.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
11343
11636
|
);
|
|
11344
11637
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
11345
11638
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -11352,11 +11645,11 @@ async function putRule({
|
|
|
11352
11645
|
body,
|
|
11353
11646
|
validate: true
|
|
11354
11647
|
});
|
|
11355
|
-
const rulesDir = (0,
|
|
11648
|
+
const rulesDir = (0, import_node_path92.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
11356
11649
|
await ensureDir(rulesDir);
|
|
11357
11650
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
11358
11651
|
return {
|
|
11359
|
-
relativePathFromCwd: (0,
|
|
11652
|
+
relativePathFromCwd: (0, import_node_path92.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
11360
11653
|
frontmatter: rule.getFrontmatter(),
|
|
11361
11654
|
body: rule.getBody()
|
|
11362
11655
|
};
|
|
@@ -11371,12 +11664,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
11371
11664
|
relativePath: relativePathFromCwd,
|
|
11372
11665
|
intendedRootDir: process.cwd()
|
|
11373
11666
|
});
|
|
11374
|
-
const filename = (0,
|
|
11375
|
-
const fullPath = (0,
|
|
11667
|
+
const filename = (0, import_node_path92.basename)(relativePathFromCwd);
|
|
11668
|
+
const fullPath = (0, import_node_path92.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
11376
11669
|
try {
|
|
11377
11670
|
await removeFile(fullPath);
|
|
11378
11671
|
return {
|
|
11379
|
-
relativePathFromCwd: (0,
|
|
11672
|
+
relativePathFromCwd: (0, import_node_path92.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
11380
11673
|
};
|
|
11381
11674
|
} catch (error) {
|
|
11382
11675
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -11385,23 +11678,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
11385
11678
|
}
|
|
11386
11679
|
}
|
|
11387
11680
|
var ruleToolSchemas = {
|
|
11388
|
-
listRules:
|
|
11389
|
-
getRule:
|
|
11390
|
-
relativePathFromCwd:
|
|
11681
|
+
listRules: import_mini42.z.object({}),
|
|
11682
|
+
getRule: import_mini42.z.object({
|
|
11683
|
+
relativePathFromCwd: import_mini42.z.string()
|
|
11391
11684
|
}),
|
|
11392
|
-
putRule:
|
|
11393
|
-
relativePathFromCwd:
|
|
11685
|
+
putRule: import_mini42.z.object({
|
|
11686
|
+
relativePathFromCwd: import_mini42.z.string(),
|
|
11394
11687
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
11395
|
-
body:
|
|
11688
|
+
body: import_mini42.z.string()
|
|
11396
11689
|
}),
|
|
11397
|
-
deleteRule:
|
|
11398
|
-
relativePathFromCwd:
|
|
11690
|
+
deleteRule: import_mini42.z.object({
|
|
11691
|
+
relativePathFromCwd: import_mini42.z.string()
|
|
11399
11692
|
})
|
|
11400
11693
|
};
|
|
11401
11694
|
var ruleTools = {
|
|
11402
11695
|
listRules: {
|
|
11403
11696
|
name: "listRules",
|
|
11404
|
-
description: `List all rules from ${(0,
|
|
11697
|
+
description: `List all rules from ${(0, import_node_path92.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
11405
11698
|
parameters: ruleToolSchemas.listRules,
|
|
11406
11699
|
execute: async () => {
|
|
11407
11700
|
const rules = await listRules();
|
|
@@ -11443,8 +11736,8 @@ var ruleTools = {
|
|
|
11443
11736
|
};
|
|
11444
11737
|
|
|
11445
11738
|
// src/mcp/skills.ts
|
|
11446
|
-
var
|
|
11447
|
-
var
|
|
11739
|
+
var import_node_path93 = require("path");
|
|
11740
|
+
var import_mini43 = require("zod/mini");
|
|
11448
11741
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
11449
11742
|
var maxSkillsCount = 1e3;
|
|
11450
11743
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -11460,19 +11753,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
11460
11753
|
};
|
|
11461
11754
|
}
|
|
11462
11755
|
function extractDirName(relativeDirPathFromCwd) {
|
|
11463
|
-
const dirName = (0,
|
|
11756
|
+
const dirName = (0, import_node_path93.basename)(relativeDirPathFromCwd);
|
|
11464
11757
|
if (!dirName) {
|
|
11465
11758
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
11466
11759
|
}
|
|
11467
11760
|
return dirName;
|
|
11468
11761
|
}
|
|
11469
11762
|
async function listSkills() {
|
|
11470
|
-
const skillsDir = (0,
|
|
11763
|
+
const skillsDir = (0, import_node_path93.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
11471
11764
|
try {
|
|
11472
|
-
const skillDirPaths = await findFilesByGlobs((0,
|
|
11765
|
+
const skillDirPaths = await findFilesByGlobs((0, import_node_path93.join)(skillsDir, "*"), { type: "dir" });
|
|
11473
11766
|
const skills = await Promise.all(
|
|
11474
11767
|
skillDirPaths.map(async (dirPath) => {
|
|
11475
|
-
const dirName = (0,
|
|
11768
|
+
const dirName = (0, import_node_path93.basename)(dirPath);
|
|
11476
11769
|
if (!dirName) return null;
|
|
11477
11770
|
try {
|
|
11478
11771
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -11480,7 +11773,7 @@ async function listSkills() {
|
|
|
11480
11773
|
});
|
|
11481
11774
|
const frontmatter = skill.getFrontmatter();
|
|
11482
11775
|
return {
|
|
11483
|
-
relativeDirPathFromCwd: (0,
|
|
11776
|
+
relativeDirPathFromCwd: (0, import_node_path93.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
11484
11777
|
frontmatter
|
|
11485
11778
|
};
|
|
11486
11779
|
} catch (error) {
|
|
@@ -11506,7 +11799,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
11506
11799
|
dirName
|
|
11507
11800
|
});
|
|
11508
11801
|
return {
|
|
11509
|
-
relativeDirPathFromCwd: (0,
|
|
11802
|
+
relativeDirPathFromCwd: (0, import_node_path93.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
11510
11803
|
frontmatter: skill.getFrontmatter(),
|
|
11511
11804
|
body: skill.getBody(),
|
|
11512
11805
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -11540,7 +11833,7 @@ async function putSkill({
|
|
|
11540
11833
|
try {
|
|
11541
11834
|
const existingSkills = await listSkills();
|
|
11542
11835
|
const isUpdate = existingSkills.some(
|
|
11543
|
-
(skill2) => skill2.relativeDirPathFromCwd === (0,
|
|
11836
|
+
(skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path93.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
11544
11837
|
);
|
|
11545
11838
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
11546
11839
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -11555,9 +11848,9 @@ async function putSkill({
|
|
|
11555
11848
|
otherFiles: aiDirFiles,
|
|
11556
11849
|
validate: true
|
|
11557
11850
|
});
|
|
11558
|
-
const skillDirPath = (0,
|
|
11851
|
+
const skillDirPath = (0, import_node_path93.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
11559
11852
|
await ensureDir(skillDirPath);
|
|
11560
|
-
const skillFilePath = (0,
|
|
11853
|
+
const skillFilePath = (0, import_node_path93.join)(skillDirPath, SKILL_FILE_NAME);
|
|
11561
11854
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
11562
11855
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
11563
11856
|
for (const file of otherFiles) {
|
|
@@ -11565,15 +11858,15 @@ async function putSkill({
|
|
|
11565
11858
|
relativePath: file.name,
|
|
11566
11859
|
intendedRootDir: skillDirPath
|
|
11567
11860
|
});
|
|
11568
|
-
const filePath = (0,
|
|
11569
|
-
const fileDir = (0,
|
|
11861
|
+
const filePath = (0, import_node_path93.join)(skillDirPath, file.name);
|
|
11862
|
+
const fileDir = (0, import_node_path93.join)(skillDirPath, (0, import_node_path93.dirname)(file.name));
|
|
11570
11863
|
if (fileDir !== skillDirPath) {
|
|
11571
11864
|
await ensureDir(fileDir);
|
|
11572
11865
|
}
|
|
11573
11866
|
await writeFileContent(filePath, file.body);
|
|
11574
11867
|
}
|
|
11575
11868
|
return {
|
|
11576
|
-
relativeDirPathFromCwd: (0,
|
|
11869
|
+
relativeDirPathFromCwd: (0, import_node_path93.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
11577
11870
|
frontmatter: skill.getFrontmatter(),
|
|
11578
11871
|
body: skill.getBody(),
|
|
11579
11872
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -11595,13 +11888,13 @@ async function deleteSkill({
|
|
|
11595
11888
|
intendedRootDir: process.cwd()
|
|
11596
11889
|
});
|
|
11597
11890
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
11598
|
-
const skillDirPath = (0,
|
|
11891
|
+
const skillDirPath = (0, import_node_path93.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
11599
11892
|
try {
|
|
11600
11893
|
if (await directoryExists(skillDirPath)) {
|
|
11601
11894
|
await removeDirectory(skillDirPath);
|
|
11602
11895
|
}
|
|
11603
11896
|
return {
|
|
11604
|
-
relativeDirPathFromCwd: (0,
|
|
11897
|
+
relativeDirPathFromCwd: (0, import_node_path93.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
11605
11898
|
};
|
|
11606
11899
|
} catch (error) {
|
|
11607
11900
|
throw new Error(
|
|
@@ -11612,29 +11905,29 @@ async function deleteSkill({
|
|
|
11612
11905
|
);
|
|
11613
11906
|
}
|
|
11614
11907
|
}
|
|
11615
|
-
var McpSkillFileSchema =
|
|
11616
|
-
name:
|
|
11617
|
-
body:
|
|
11908
|
+
var McpSkillFileSchema = import_mini43.z.object({
|
|
11909
|
+
name: import_mini43.z.string(),
|
|
11910
|
+
body: import_mini43.z.string()
|
|
11618
11911
|
});
|
|
11619
11912
|
var skillToolSchemas = {
|
|
11620
|
-
listSkills:
|
|
11621
|
-
getSkill:
|
|
11622
|
-
relativeDirPathFromCwd:
|
|
11913
|
+
listSkills: import_mini43.z.object({}),
|
|
11914
|
+
getSkill: import_mini43.z.object({
|
|
11915
|
+
relativeDirPathFromCwd: import_mini43.z.string()
|
|
11623
11916
|
}),
|
|
11624
|
-
putSkill:
|
|
11625
|
-
relativeDirPathFromCwd:
|
|
11917
|
+
putSkill: import_mini43.z.object({
|
|
11918
|
+
relativeDirPathFromCwd: import_mini43.z.string(),
|
|
11626
11919
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
11627
|
-
body:
|
|
11628
|
-
otherFiles:
|
|
11920
|
+
body: import_mini43.z.string(),
|
|
11921
|
+
otherFiles: import_mini43.z.optional(import_mini43.z.array(McpSkillFileSchema))
|
|
11629
11922
|
}),
|
|
11630
|
-
deleteSkill:
|
|
11631
|
-
relativeDirPathFromCwd:
|
|
11923
|
+
deleteSkill: import_mini43.z.object({
|
|
11924
|
+
relativeDirPathFromCwd: import_mini43.z.string()
|
|
11632
11925
|
})
|
|
11633
11926
|
};
|
|
11634
11927
|
var skillTools = {
|
|
11635
11928
|
listSkills: {
|
|
11636
11929
|
name: "listSkills",
|
|
11637
|
-
description: `List all skills from ${(0,
|
|
11930
|
+
description: `List all skills from ${(0, import_node_path93.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
11638
11931
|
parameters: skillToolSchemas.listSkills,
|
|
11639
11932
|
execute: async () => {
|
|
11640
11933
|
const skills = await listSkills();
|
|
@@ -11677,12 +11970,12 @@ var skillTools = {
|
|
|
11677
11970
|
};
|
|
11678
11971
|
|
|
11679
11972
|
// src/mcp/subagents.ts
|
|
11680
|
-
var
|
|
11681
|
-
var
|
|
11973
|
+
var import_node_path94 = require("path");
|
|
11974
|
+
var import_mini44 = require("zod/mini");
|
|
11682
11975
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
11683
11976
|
var maxSubagentsCount = 1e3;
|
|
11684
11977
|
async function listSubagents() {
|
|
11685
|
-
const subagentsDir = (0,
|
|
11978
|
+
const subagentsDir = (0, import_node_path94.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
11686
11979
|
try {
|
|
11687
11980
|
const files = await listDirectoryFiles(subagentsDir);
|
|
11688
11981
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -11695,7 +11988,7 @@ async function listSubagents() {
|
|
|
11695
11988
|
});
|
|
11696
11989
|
const frontmatter = subagent.getFrontmatter();
|
|
11697
11990
|
return {
|
|
11698
|
-
relativePathFromCwd: (0,
|
|
11991
|
+
relativePathFromCwd: (0, import_node_path94.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
11699
11992
|
frontmatter
|
|
11700
11993
|
};
|
|
11701
11994
|
} catch (error) {
|
|
@@ -11717,14 +12010,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
11717
12010
|
relativePath: relativePathFromCwd,
|
|
11718
12011
|
intendedRootDir: process.cwd()
|
|
11719
12012
|
});
|
|
11720
|
-
const filename = (0,
|
|
12013
|
+
const filename = (0, import_node_path94.basename)(relativePathFromCwd);
|
|
11721
12014
|
try {
|
|
11722
12015
|
const subagent = await RulesyncSubagent.fromFile({
|
|
11723
12016
|
relativeFilePath: filename,
|
|
11724
12017
|
validate: true
|
|
11725
12018
|
});
|
|
11726
12019
|
return {
|
|
11727
|
-
relativePathFromCwd: (0,
|
|
12020
|
+
relativePathFromCwd: (0, import_node_path94.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
11728
12021
|
frontmatter: subagent.getFrontmatter(),
|
|
11729
12022
|
body: subagent.getBody()
|
|
11730
12023
|
};
|
|
@@ -11743,7 +12036,7 @@ async function putSubagent({
|
|
|
11743
12036
|
relativePath: relativePathFromCwd,
|
|
11744
12037
|
intendedRootDir: process.cwd()
|
|
11745
12038
|
});
|
|
11746
|
-
const filename = (0,
|
|
12039
|
+
const filename = (0, import_node_path94.basename)(relativePathFromCwd);
|
|
11747
12040
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
11748
12041
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
11749
12042
|
throw new Error(
|
|
@@ -11753,7 +12046,7 @@ async function putSubagent({
|
|
|
11753
12046
|
try {
|
|
11754
12047
|
const existingSubagents = await listSubagents();
|
|
11755
12048
|
const isUpdate = existingSubagents.some(
|
|
11756
|
-
(subagent2) => subagent2.relativePathFromCwd === (0,
|
|
12049
|
+
(subagent2) => subagent2.relativePathFromCwd === (0, import_node_path94.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
11757
12050
|
);
|
|
11758
12051
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
11759
12052
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -11766,11 +12059,11 @@ async function putSubagent({
|
|
|
11766
12059
|
body,
|
|
11767
12060
|
validate: true
|
|
11768
12061
|
});
|
|
11769
|
-
const subagentsDir = (0,
|
|
12062
|
+
const subagentsDir = (0, import_node_path94.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
11770
12063
|
await ensureDir(subagentsDir);
|
|
11771
12064
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
11772
12065
|
return {
|
|
11773
|
-
relativePathFromCwd: (0,
|
|
12066
|
+
relativePathFromCwd: (0, import_node_path94.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
11774
12067
|
frontmatter: subagent.getFrontmatter(),
|
|
11775
12068
|
body: subagent.getBody()
|
|
11776
12069
|
};
|
|
@@ -11785,12 +12078,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
11785
12078
|
relativePath: relativePathFromCwd,
|
|
11786
12079
|
intendedRootDir: process.cwd()
|
|
11787
12080
|
});
|
|
11788
|
-
const filename = (0,
|
|
11789
|
-
const fullPath = (0,
|
|
12081
|
+
const filename = (0, import_node_path94.basename)(relativePathFromCwd);
|
|
12082
|
+
const fullPath = (0, import_node_path94.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
11790
12083
|
try {
|
|
11791
12084
|
await removeFile(fullPath);
|
|
11792
12085
|
return {
|
|
11793
|
-
relativePathFromCwd: (0,
|
|
12086
|
+
relativePathFromCwd: (0, import_node_path94.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
11794
12087
|
};
|
|
11795
12088
|
} catch (error) {
|
|
11796
12089
|
throw new Error(
|
|
@@ -11802,23 +12095,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
11802
12095
|
}
|
|
11803
12096
|
}
|
|
11804
12097
|
var subagentToolSchemas = {
|
|
11805
|
-
listSubagents:
|
|
11806
|
-
getSubagent:
|
|
11807
|
-
relativePathFromCwd:
|
|
12098
|
+
listSubagents: import_mini44.z.object({}),
|
|
12099
|
+
getSubagent: import_mini44.z.object({
|
|
12100
|
+
relativePathFromCwd: import_mini44.z.string()
|
|
11808
12101
|
}),
|
|
11809
|
-
putSubagent:
|
|
11810
|
-
relativePathFromCwd:
|
|
12102
|
+
putSubagent: import_mini44.z.object({
|
|
12103
|
+
relativePathFromCwd: import_mini44.z.string(),
|
|
11811
12104
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
11812
|
-
body:
|
|
12105
|
+
body: import_mini44.z.string()
|
|
11813
12106
|
}),
|
|
11814
|
-
deleteSubagent:
|
|
11815
|
-
relativePathFromCwd:
|
|
12107
|
+
deleteSubagent: import_mini44.z.object({
|
|
12108
|
+
relativePathFromCwd: import_mini44.z.string()
|
|
11816
12109
|
})
|
|
11817
12110
|
};
|
|
11818
12111
|
var subagentTools = {
|
|
11819
12112
|
listSubagents: {
|
|
11820
12113
|
name: "listSubagents",
|
|
11821
|
-
description: `List all subagents from ${(0,
|
|
12114
|
+
description: `List all subagents from ${(0, import_node_path94.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
11822
12115
|
parameters: subagentToolSchemas.listSubagents,
|
|
11823
12116
|
execute: async () => {
|
|
11824
12117
|
const subagents = await listSubagents();
|
|
@@ -11896,7 +12189,7 @@ async function mcpCommand({ version }) {
|
|
|
11896
12189
|
}
|
|
11897
12190
|
|
|
11898
12191
|
// src/cli/index.ts
|
|
11899
|
-
var getVersion = () => "4.
|
|
12192
|
+
var getVersion = () => "4.2.0";
|
|
11900
12193
|
var main = async () => {
|
|
11901
12194
|
const program = new import_commander.Command();
|
|
11902
12195
|
const version = getVersion();
|