rulesync 0.77.0 → 0.79.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 +13 -3
- package/dist/index.cjs +120 -78
- package/dist/index.js +115 -73
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/rulesync)
|
|
5
5
|
[](https://www.npmjs.com/package/rulesync)
|
|
6
6
|
|
|
7
|
-
A Node.js CLI tool that automatically generates configuration files for various AI development tools from unified AI rule files. Features selective generation, comprehensive import/export capabilities, and supports
|
|
7
|
+
A Node.js CLI tool that automatically generates configuration files for various AI development tools from unified AI rule files. Features selective generation, comprehensive import/export capabilities, and supports major AI development tools with rules, commands, MCP, ignore files, and subagents. Uses the recommended `.rulesync/rules/*.md` structure, with full backward compatibility for legacy `.rulesync/*.md` layouts.
|
|
8
|
+
|
|
9
|
+
> [!NOTE]
|
|
10
|
+
> If you are interested in rulesync latest news, please follow the maintainer's X(Twitter) account:
|
|
11
|
+
> [@dyoshikawa1993](https://x.com/dyoshikawa1993)
|
|
8
12
|
|
|
9
13
|
## Installation
|
|
10
14
|
|
|
@@ -156,11 +160,17 @@ Example:
|
|
|
156
160
|
|
|
157
161
|
```md
|
|
158
162
|
---
|
|
159
|
-
root: true # true that is less than or equal to one file for overview such as AGENTS.md
|
|
163
|
+
root: true # true that is less than or equal to one file for overview such as `AGENTS.md`, false for details such as `.agents/memories/*.md`
|
|
160
164
|
targets: ["*"] # * = all, or specific tools
|
|
161
165
|
description: "rulesync project overview and development guidelines for unified AI rules management CLI tool"
|
|
162
166
|
globs: ["**/*"] # file patterns to match (e.g., ["*.md", "*.txt"])
|
|
163
|
-
|
|
167
|
+
agentsmd: # agentsmd and codexcli specific rules
|
|
168
|
+
# Support for using nested AGENTS.md files for subprojects in a large monorepo.
|
|
169
|
+
# This option is available only if root is false.
|
|
170
|
+
# If subprojectPath is provided, the file is located in `${subprojectPath}/AGENTS.md`.
|
|
171
|
+
# If subprojectPath is not provided and root is false, the file is located in `.agents/memories/*.md`.
|
|
172
|
+
subprojectPath: "path/to/subproject"
|
|
173
|
+
cursor: # cursor specific rules
|
|
164
174
|
alwaysApply: true
|
|
165
175
|
description: "rulesync project overview and development guidelines for unified AI rules management CLI tool"
|
|
166
176
|
globs: ["*"]
|
package/dist/index.cjs
CHANGED
|
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
));
|
|
25
25
|
|
|
26
26
|
// src/cli/index.ts
|
|
27
|
-
var
|
|
27
|
+
var import_node_path57 = require("path");
|
|
28
28
|
var import_node_url = require("url");
|
|
29
29
|
var import_commander = require("commander");
|
|
30
30
|
|
|
@@ -2803,7 +2803,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
2803
2803
|
};
|
|
2804
2804
|
|
|
2805
2805
|
// src/rules/rules-processor.ts
|
|
2806
|
-
var
|
|
2806
|
+
var import_node_path54 = require("path");
|
|
2807
2807
|
var import_fast_xml_parser = require("fast-xml-parser");
|
|
2808
2808
|
var import_mini20 = require("zod/mini");
|
|
2809
2809
|
|
|
@@ -3503,6 +3503,9 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3503
3503
|
};
|
|
3504
3504
|
|
|
3505
3505
|
// src/rules/agentsmd-rule.ts
|
|
3506
|
+
var import_node_path37 = require("path");
|
|
3507
|
+
|
|
3508
|
+
// src/rules/tool-rule.ts
|
|
3506
3509
|
var import_node_path36 = require("path");
|
|
3507
3510
|
|
|
3508
3511
|
// src/rules/rulesync-rule.ts
|
|
@@ -3513,6 +3516,12 @@ var RulesyncRuleFrontmatterSchema = import_mini16.z.object({
|
|
|
3513
3516
|
targets: import_mini16.z.optional(RulesyncTargetsSchema),
|
|
3514
3517
|
description: import_mini16.z.optional(import_mini16.z.string()),
|
|
3515
3518
|
globs: import_mini16.z.optional(import_mini16.z.array(import_mini16.z.string())),
|
|
3519
|
+
agentsmd: import_mini16.z.optional(
|
|
3520
|
+
import_mini16.z.object({
|
|
3521
|
+
// @example "path/to/subproject"
|
|
3522
|
+
subprojectPath: import_mini16.z.optional(import_mini16.z.string())
|
|
3523
|
+
})
|
|
3524
|
+
),
|
|
3516
3525
|
cursor: import_mini16.z.optional(
|
|
3517
3526
|
import_mini16.z.object({
|
|
3518
3527
|
alwaysApply: import_mini16.z.optional(import_mini16.z.boolean()),
|
|
@@ -3578,6 +3587,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
3578
3587
|
targets: result.data.targets ?? ["*"],
|
|
3579
3588
|
description: result.data.description ?? "",
|
|
3580
3589
|
globs: result.data.globs ?? [],
|
|
3590
|
+
agentsmd: result.data.agentsmd,
|
|
3581
3591
|
cursor: result.data.cursor
|
|
3582
3592
|
};
|
|
3583
3593
|
const filename = (0, import_node_path35.basename)(filePath);
|
|
@@ -3606,6 +3616,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
3606
3616
|
targets: result.data.targets ?? ["*"],
|
|
3607
3617
|
description: result.data.description ?? "",
|
|
3608
3618
|
globs: result.data.globs ?? [],
|
|
3619
|
+
agentsmd: result.data.agentsmd,
|
|
3609
3620
|
cursor: result.data.cursor
|
|
3610
3621
|
};
|
|
3611
3622
|
const filename = (0, import_node_path35.basename)(filePath);
|
|
@@ -3626,9 +3637,13 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
3626
3637
|
// src/rules/tool-rule.ts
|
|
3627
3638
|
var ToolRule = class extends ToolFile {
|
|
3628
3639
|
root;
|
|
3629
|
-
|
|
3640
|
+
description;
|
|
3641
|
+
globs;
|
|
3642
|
+
constructor({ root = false, description, globs, ...rest }) {
|
|
3630
3643
|
super(rest);
|
|
3631
3644
|
this.root = root;
|
|
3645
|
+
this.description = description;
|
|
3646
|
+
this.globs = globs;
|
|
3632
3647
|
}
|
|
3633
3648
|
static async fromFile(_params) {
|
|
3634
3649
|
throw new Error("Please implement this method in the subclass.");
|
|
@@ -3650,9 +3665,32 @@ var ToolRule = class extends ToolFile {
|
|
|
3650
3665
|
relativeFilePath: rulesyncRule.getFrontmatter().root ? rootPath.relativeFilePath : rulesyncRule.getRelativeFilePath(),
|
|
3651
3666
|
fileContent,
|
|
3652
3667
|
validate,
|
|
3653
|
-
root: rulesyncRule.getFrontmatter().root ?? false
|
|
3668
|
+
root: rulesyncRule.getFrontmatter().root ?? false,
|
|
3669
|
+
description: rulesyncRule.getFrontmatter().description,
|
|
3670
|
+
globs: rulesyncRule.getFrontmatter().globs
|
|
3654
3671
|
};
|
|
3655
3672
|
}
|
|
3673
|
+
static buildToolRuleParamsAgentsmd({
|
|
3674
|
+
baseDir = ".",
|
|
3675
|
+
rulesyncRule,
|
|
3676
|
+
validate = true,
|
|
3677
|
+
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
3678
|
+
nonRootPath = { relativeDirPath: ".agents/memories" }
|
|
3679
|
+
}) {
|
|
3680
|
+
const params = this.buildToolRuleParamsDefault({
|
|
3681
|
+
baseDir,
|
|
3682
|
+
rulesyncRule,
|
|
3683
|
+
validate,
|
|
3684
|
+
rootPath,
|
|
3685
|
+
nonRootPath
|
|
3686
|
+
});
|
|
3687
|
+
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
3688
|
+
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
3689
|
+
params.relativeDirPath = (0, import_node_path36.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
3690
|
+
params.relativeFilePath = "AGENTS.md";
|
|
3691
|
+
}
|
|
3692
|
+
return params;
|
|
3693
|
+
}
|
|
3656
3694
|
toRulesyncRuleDefault() {
|
|
3657
3695
|
return new RulesyncRule({
|
|
3658
3696
|
baseDir: this.getBaseDir(),
|
|
@@ -3661,8 +3699,8 @@ var ToolRule = class extends ToolFile {
|
|
|
3661
3699
|
frontmatter: {
|
|
3662
3700
|
root: this.isRoot(),
|
|
3663
3701
|
targets: ["*"],
|
|
3664
|
-
description: "",
|
|
3665
|
-
globs: this.isRoot() ? ["**/*"] : []
|
|
3702
|
+
description: this.description ?? "",
|
|
3703
|
+
globs: this.globs ?? (this.isRoot() ? ["**/*"] : [])
|
|
3666
3704
|
},
|
|
3667
3705
|
body: this.getFileContent()
|
|
3668
3706
|
});
|
|
@@ -3670,6 +3708,12 @@ var ToolRule = class extends ToolFile {
|
|
|
3670
3708
|
isRoot() {
|
|
3671
3709
|
return this.root;
|
|
3672
3710
|
}
|
|
3711
|
+
getDescription() {
|
|
3712
|
+
return this.description;
|
|
3713
|
+
}
|
|
3714
|
+
getGlobs() {
|
|
3715
|
+
return this.globs;
|
|
3716
|
+
}
|
|
3673
3717
|
static isTargetedByRulesyncRule(_rulesyncRule) {
|
|
3674
3718
|
throw new Error("Please implement this method in the subclass.");
|
|
3675
3719
|
}
|
|
@@ -3717,8 +3761,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
3717
3761
|
validate = true
|
|
3718
3762
|
}) {
|
|
3719
3763
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
3720
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
3721
|
-
const fileContent = await readFileContent((0,
|
|
3764
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path37.join)(".agents/memories", relativeFilePath);
|
|
3765
|
+
const fileContent = await readFileContent((0, import_node_path37.join)(baseDir, relativePath));
|
|
3722
3766
|
return new _AgentsMdRule({
|
|
3723
3767
|
baseDir,
|
|
3724
3768
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -3734,7 +3778,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
3734
3778
|
validate = true
|
|
3735
3779
|
}) {
|
|
3736
3780
|
return new _AgentsMdRule(
|
|
3737
|
-
this.
|
|
3781
|
+
this.buildToolRuleParamsAgentsmd({
|
|
3738
3782
|
baseDir,
|
|
3739
3783
|
rulesyncRule,
|
|
3740
3784
|
validate,
|
|
@@ -3758,7 +3802,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
3758
3802
|
};
|
|
3759
3803
|
|
|
3760
3804
|
// src/rules/amazonqcli-rule.ts
|
|
3761
|
-
var
|
|
3805
|
+
var import_node_path38 = require("path");
|
|
3762
3806
|
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
3763
3807
|
static getSettablePaths() {
|
|
3764
3808
|
return {
|
|
@@ -3773,7 +3817,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
3773
3817
|
validate = true
|
|
3774
3818
|
}) {
|
|
3775
3819
|
const fileContent = await readFileContent(
|
|
3776
|
-
(0,
|
|
3820
|
+
(0, import_node_path38.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
3777
3821
|
);
|
|
3778
3822
|
return new _AmazonQCliRule({
|
|
3779
3823
|
baseDir,
|
|
@@ -3813,7 +3857,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
3813
3857
|
};
|
|
3814
3858
|
|
|
3815
3859
|
// src/rules/augmentcode-legacy-rule.ts
|
|
3816
|
-
var
|
|
3860
|
+
var import_node_path39 = require("path");
|
|
3817
3861
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
3818
3862
|
toRulesyncRule() {
|
|
3819
3863
|
const rulesyncFrontmatter = {
|
|
@@ -3873,8 +3917,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
3873
3917
|
}) {
|
|
3874
3918
|
const settablePaths = this.getSettablePaths();
|
|
3875
3919
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
3876
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
3877
|
-
const fileContent = await readFileContent((0,
|
|
3920
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path39.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
3921
|
+
const fileContent = await readFileContent((0, import_node_path39.join)(baseDir, relativePath));
|
|
3878
3922
|
return new _AugmentcodeLegacyRule({
|
|
3879
3923
|
baseDir,
|
|
3880
3924
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -3887,7 +3931,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
3887
3931
|
};
|
|
3888
3932
|
|
|
3889
3933
|
// src/rules/augmentcode-rule.ts
|
|
3890
|
-
var
|
|
3934
|
+
var import_node_path40 = require("path");
|
|
3891
3935
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
3892
3936
|
toRulesyncRule() {
|
|
3893
3937
|
return this.toRulesyncRuleDefault();
|
|
@@ -3919,7 +3963,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
3919
3963
|
validate = true
|
|
3920
3964
|
}) {
|
|
3921
3965
|
const fileContent = await readFileContent(
|
|
3922
|
-
(0,
|
|
3966
|
+
(0, import_node_path40.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
3923
3967
|
);
|
|
3924
3968
|
const { body: content } = parseFrontmatter(fileContent);
|
|
3925
3969
|
return new _AugmentcodeRule({
|
|
@@ -3942,7 +3986,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
3942
3986
|
};
|
|
3943
3987
|
|
|
3944
3988
|
// src/rules/claudecode-rule.ts
|
|
3945
|
-
var
|
|
3989
|
+
var import_node_path41 = require("path");
|
|
3946
3990
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
3947
3991
|
static getSettablePaths() {
|
|
3948
3992
|
return {
|
|
@@ -3961,8 +4005,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
3961
4005
|
validate = true
|
|
3962
4006
|
}) {
|
|
3963
4007
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
3964
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
3965
|
-
const fileContent = await readFileContent((0,
|
|
4008
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path41.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4009
|
+
const fileContent = await readFileContent((0, import_node_path41.join)(baseDir, relativePath));
|
|
3966
4010
|
return new _ClaudecodeRule({
|
|
3967
4011
|
baseDir,
|
|
3968
4012
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4002,7 +4046,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
4002
4046
|
};
|
|
4003
4047
|
|
|
4004
4048
|
// src/rules/cline-rule.ts
|
|
4005
|
-
var
|
|
4049
|
+
var import_node_path42 = require("path");
|
|
4006
4050
|
var import_mini17 = require("zod/mini");
|
|
4007
4051
|
var ClineRuleFrontmatterSchema = import_mini17.z.object({
|
|
4008
4052
|
description: import_mini17.z.string()
|
|
@@ -4047,7 +4091,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
4047
4091
|
validate = true
|
|
4048
4092
|
}) {
|
|
4049
4093
|
const fileContent = await readFileContent(
|
|
4050
|
-
(0,
|
|
4094
|
+
(0, import_node_path42.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4051
4095
|
);
|
|
4052
4096
|
return new _ClineRule({
|
|
4053
4097
|
baseDir,
|
|
@@ -4060,7 +4104,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
4060
4104
|
};
|
|
4061
4105
|
|
|
4062
4106
|
// src/rules/codexcli-rule.ts
|
|
4063
|
-
var
|
|
4107
|
+
var import_node_path43 = require("path");
|
|
4064
4108
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
4065
4109
|
static getSettablePaths() {
|
|
4066
4110
|
return {
|
|
@@ -4079,8 +4123,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4079
4123
|
validate = true
|
|
4080
4124
|
}) {
|
|
4081
4125
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
4082
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
4083
|
-
const fileContent = await readFileContent((0,
|
|
4126
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path43.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4127
|
+
const fileContent = await readFileContent((0, import_node_path43.join)(baseDir, relativePath));
|
|
4084
4128
|
return new _CodexcliRule({
|
|
4085
4129
|
baseDir,
|
|
4086
4130
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4096,7 +4140,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4096
4140
|
validate = true
|
|
4097
4141
|
}) {
|
|
4098
4142
|
return new _CodexcliRule(
|
|
4099
|
-
this.
|
|
4143
|
+
this.buildToolRuleParamsAgentsmd({
|
|
4100
4144
|
baseDir,
|
|
4101
4145
|
rulesyncRule,
|
|
4102
4146
|
validate,
|
|
@@ -4120,7 +4164,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4120
4164
|
};
|
|
4121
4165
|
|
|
4122
4166
|
// src/rules/copilot-rule.ts
|
|
4123
|
-
var
|
|
4167
|
+
var import_node_path44 = require("path");
|
|
4124
4168
|
var import_mini18 = require("zod/mini");
|
|
4125
4169
|
var CopilotRuleFrontmatterSchema = import_mini18.z.object({
|
|
4126
4170
|
description: import_mini18.z.optional(import_mini18.z.string()),
|
|
@@ -4212,11 +4256,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4212
4256
|
validate = true
|
|
4213
4257
|
}) {
|
|
4214
4258
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
4215
|
-
const relativePath = isRoot ? (0,
|
|
4259
|
+
const relativePath = isRoot ? (0, import_node_path44.join)(
|
|
4216
4260
|
this.getSettablePaths().root.relativeDirPath,
|
|
4217
4261
|
this.getSettablePaths().root.relativeFilePath
|
|
4218
|
-
) : (0,
|
|
4219
|
-
const fileContent = await readFileContent((0,
|
|
4262
|
+
) : (0, import_node_path44.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4263
|
+
const fileContent = await readFileContent((0, import_node_path44.join)(baseDir, relativePath));
|
|
4220
4264
|
if (isRoot) {
|
|
4221
4265
|
return new _CopilotRule({
|
|
4222
4266
|
baseDir,
|
|
@@ -4235,7 +4279,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4235
4279
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
4236
4280
|
if (!result.success) {
|
|
4237
4281
|
throw new Error(
|
|
4238
|
-
`Invalid frontmatter in ${(0,
|
|
4282
|
+
`Invalid frontmatter in ${(0, import_node_path44.join)(baseDir, relativeFilePath)}: ${result.error.message}`
|
|
4239
4283
|
);
|
|
4240
4284
|
}
|
|
4241
4285
|
return new _CopilotRule({
|
|
@@ -4274,7 +4318,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4274
4318
|
};
|
|
4275
4319
|
|
|
4276
4320
|
// src/rules/cursor-rule.ts
|
|
4277
|
-
var
|
|
4321
|
+
var import_node_path45 = require("path");
|
|
4278
4322
|
var import_mini19 = require("zod/mini");
|
|
4279
4323
|
var CursorRuleFrontmatterSchema = import_mini19.z.object({
|
|
4280
4324
|
description: import_mini19.z.optional(import_mini19.z.string()),
|
|
@@ -4404,19 +4448,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
4404
4448
|
validate = true
|
|
4405
4449
|
}) {
|
|
4406
4450
|
const fileContent = await readFileContent(
|
|
4407
|
-
(0,
|
|
4451
|
+
(0, import_node_path45.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4408
4452
|
);
|
|
4409
4453
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
4410
4454
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
4411
4455
|
if (!result.success) {
|
|
4412
4456
|
throw new Error(
|
|
4413
|
-
`Invalid frontmatter in ${(0,
|
|
4457
|
+
`Invalid frontmatter in ${(0, import_node_path45.join)(baseDir, relativeFilePath)}: ${result.error.message}`
|
|
4414
4458
|
);
|
|
4415
4459
|
}
|
|
4416
4460
|
return new _CursorRule({
|
|
4417
4461
|
baseDir,
|
|
4418
4462
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
4419
|
-
relativeFilePath: (0,
|
|
4463
|
+
relativeFilePath: (0, import_node_path45.basename)(relativeFilePath),
|
|
4420
4464
|
frontmatter: result.data,
|
|
4421
4465
|
body: content.trim(),
|
|
4422
4466
|
validate
|
|
@@ -4448,7 +4492,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
4448
4492
|
};
|
|
4449
4493
|
|
|
4450
4494
|
// src/rules/geminicli-rule.ts
|
|
4451
|
-
var
|
|
4495
|
+
var import_node_path46 = require("path");
|
|
4452
4496
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
4453
4497
|
static getSettablePaths() {
|
|
4454
4498
|
return {
|
|
@@ -4467,8 +4511,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
4467
4511
|
validate = true
|
|
4468
4512
|
}) {
|
|
4469
4513
|
const isRoot = relativeFilePath === "GEMINI.md";
|
|
4470
|
-
const relativePath = isRoot ? "GEMINI.md" : (0,
|
|
4471
|
-
const fileContent = await readFileContent((0,
|
|
4514
|
+
const relativePath = isRoot ? "GEMINI.md" : (0, import_node_path46.join)(".gemini/memories", relativeFilePath);
|
|
4515
|
+
const fileContent = await readFileContent((0, import_node_path46.join)(baseDir, relativePath));
|
|
4472
4516
|
return new _GeminiCliRule({
|
|
4473
4517
|
baseDir,
|
|
4474
4518
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4508,7 +4552,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
4508
4552
|
};
|
|
4509
4553
|
|
|
4510
4554
|
// src/rules/junie-rule.ts
|
|
4511
|
-
var
|
|
4555
|
+
var import_node_path47 = require("path");
|
|
4512
4556
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
4513
4557
|
static getSettablePaths() {
|
|
4514
4558
|
return {
|
|
@@ -4527,8 +4571,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
4527
4571
|
validate = true
|
|
4528
4572
|
}) {
|
|
4529
4573
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
4530
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
4531
|
-
const fileContent = await readFileContent((0,
|
|
4574
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path47.join)(".junie/memories", relativeFilePath);
|
|
4575
|
+
const fileContent = await readFileContent((0, import_node_path47.join)(baseDir, relativePath));
|
|
4532
4576
|
return new _JunieRule({
|
|
4533
4577
|
baseDir,
|
|
4534
4578
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4568,7 +4612,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
4568
4612
|
};
|
|
4569
4613
|
|
|
4570
4614
|
// src/rules/kiro-rule.ts
|
|
4571
|
-
var
|
|
4615
|
+
var import_node_path48 = require("path");
|
|
4572
4616
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
4573
4617
|
static getSettablePaths() {
|
|
4574
4618
|
return {
|
|
@@ -4583,7 +4627,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
4583
4627
|
validate = true
|
|
4584
4628
|
}) {
|
|
4585
4629
|
const fileContent = await readFileContent(
|
|
4586
|
-
(0,
|
|
4630
|
+
(0, import_node_path48.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4587
4631
|
);
|
|
4588
4632
|
return new _KiroRule({
|
|
4589
4633
|
baseDir,
|
|
@@ -4623,7 +4667,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
4623
4667
|
};
|
|
4624
4668
|
|
|
4625
4669
|
// src/rules/opencode-rule.ts
|
|
4626
|
-
var
|
|
4670
|
+
var import_node_path49 = require("path");
|
|
4627
4671
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
4628
4672
|
static getSettablePaths() {
|
|
4629
4673
|
return {
|
|
@@ -4642,8 +4686,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
4642
4686
|
validate = true
|
|
4643
4687
|
}) {
|
|
4644
4688
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
4645
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
4646
|
-
const fileContent = await readFileContent((0,
|
|
4689
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path49.join)(".opencode/memories", relativeFilePath);
|
|
4690
|
+
const fileContent = await readFileContent((0, import_node_path49.join)(baseDir, relativePath));
|
|
4647
4691
|
return new _OpenCodeRule({
|
|
4648
4692
|
baseDir,
|
|
4649
4693
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4683,7 +4727,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
4683
4727
|
};
|
|
4684
4728
|
|
|
4685
4729
|
// src/rules/qwencode-rule.ts
|
|
4686
|
-
var
|
|
4730
|
+
var import_node_path50 = require("path");
|
|
4687
4731
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
4688
4732
|
static getSettablePaths() {
|
|
4689
4733
|
return {
|
|
@@ -4702,8 +4746,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
4702
4746
|
validate = true
|
|
4703
4747
|
}) {
|
|
4704
4748
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
4705
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
4706
|
-
const fileContent = await readFileContent((0,
|
|
4749
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path50.join)(".qwen/memories", relativeFilePath);
|
|
4750
|
+
const fileContent = await readFileContent((0, import_node_path50.join)(baseDir, relativePath));
|
|
4707
4751
|
return new _QwencodeRule({
|
|
4708
4752
|
baseDir,
|
|
4709
4753
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4740,7 +4784,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
4740
4784
|
};
|
|
4741
4785
|
|
|
4742
4786
|
// src/rules/roo-rule.ts
|
|
4743
|
-
var
|
|
4787
|
+
var import_node_path51 = require("path");
|
|
4744
4788
|
var RooRule = class _RooRule extends ToolRule {
|
|
4745
4789
|
static getSettablePaths() {
|
|
4746
4790
|
return {
|
|
@@ -4755,7 +4799,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
4755
4799
|
validate = true
|
|
4756
4800
|
}) {
|
|
4757
4801
|
const fileContent = await readFileContent(
|
|
4758
|
-
(0,
|
|
4802
|
+
(0, import_node_path51.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4759
4803
|
);
|
|
4760
4804
|
return new _RooRule({
|
|
4761
4805
|
baseDir,
|
|
@@ -4810,7 +4854,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
4810
4854
|
};
|
|
4811
4855
|
|
|
4812
4856
|
// src/rules/warp-rule.ts
|
|
4813
|
-
var
|
|
4857
|
+
var import_node_path52 = require("path");
|
|
4814
4858
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
4815
4859
|
constructor({ fileContent, root, ...rest }) {
|
|
4816
4860
|
super({
|
|
@@ -4836,8 +4880,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
4836
4880
|
validate = true
|
|
4837
4881
|
}) {
|
|
4838
4882
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
4839
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
4840
|
-
const fileContent = await readFileContent((0,
|
|
4883
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path52.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4884
|
+
const fileContent = await readFileContent((0, import_node_path52.join)(baseDir, relativePath));
|
|
4841
4885
|
return new _WarpRule({
|
|
4842
4886
|
baseDir,
|
|
4843
4887
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -4877,7 +4921,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
4877
4921
|
};
|
|
4878
4922
|
|
|
4879
4923
|
// src/rules/windsurf-rule.ts
|
|
4880
|
-
var
|
|
4924
|
+
var import_node_path53 = require("path");
|
|
4881
4925
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
4882
4926
|
static getSettablePaths() {
|
|
4883
4927
|
return {
|
|
@@ -4892,7 +4936,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
4892
4936
|
validate = true
|
|
4893
4937
|
}) {
|
|
4894
4938
|
const fileContent = await readFileContent(
|
|
4895
|
-
(0,
|
|
4939
|
+
(0, import_node_path53.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4896
4940
|
);
|
|
4897
4941
|
return new _WindsurfRule({
|
|
4898
4942
|
baseDir,
|
|
@@ -5271,17 +5315,17 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5271
5315
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
5272
5316
|
*/
|
|
5273
5317
|
async loadRulesyncFiles() {
|
|
5274
|
-
const files = await findFilesByGlobs((0,
|
|
5318
|
+
const files = await findFilesByGlobs((0, import_node_path54.join)(RULESYNC_RULES_DIR, "*.md"));
|
|
5275
5319
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
5276
5320
|
return Promise.all(
|
|
5277
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0,
|
|
5321
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path54.basename)(file) }))
|
|
5278
5322
|
);
|
|
5279
5323
|
}
|
|
5280
5324
|
async loadRulesyncFilesLegacy() {
|
|
5281
|
-
const legacyFiles = await findFilesByGlobs((0,
|
|
5325
|
+
const legacyFiles = await findFilesByGlobs((0, import_node_path54.join)(RULESYNC_RULES_DIR_LEGACY, "*.md"));
|
|
5282
5326
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
5283
5327
|
return Promise.all(
|
|
5284
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0,
|
|
5328
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path54.basename)(file) }))
|
|
5285
5329
|
);
|
|
5286
5330
|
}
|
|
5287
5331
|
/**
|
|
@@ -5342,13 +5386,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5342
5386
|
return [];
|
|
5343
5387
|
}
|
|
5344
5388
|
const rootFilePaths = await findFilesByGlobs(
|
|
5345
|
-
(0,
|
|
5389
|
+
(0, import_node_path54.join)(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
|
|
5346
5390
|
);
|
|
5347
5391
|
return await Promise.all(
|
|
5348
5392
|
rootFilePaths.map(
|
|
5349
5393
|
(filePath) => root.fromFile({
|
|
5350
5394
|
baseDir: this.baseDir,
|
|
5351
|
-
relativeFilePath: (0,
|
|
5395
|
+
relativeFilePath: (0, import_node_path54.basename)(filePath)
|
|
5352
5396
|
})
|
|
5353
5397
|
)
|
|
5354
5398
|
);
|
|
@@ -5359,13 +5403,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5359
5403
|
return [];
|
|
5360
5404
|
}
|
|
5361
5405
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
5362
|
-
(0,
|
|
5406
|
+
(0, import_node_path54.join)(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
|
|
5363
5407
|
);
|
|
5364
5408
|
return await Promise.all(
|
|
5365
5409
|
nonRootFilePaths.map(
|
|
5366
5410
|
(filePath) => nonRoot.fromFile({
|
|
5367
5411
|
baseDir: this.baseDir,
|
|
5368
|
-
relativeFilePath: (0,
|
|
5412
|
+
relativeFilePath: (0, import_node_path54.basename)(filePath)
|
|
5369
5413
|
})
|
|
5370
5414
|
)
|
|
5371
5415
|
);
|
|
@@ -5695,10 +5739,8 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5695
5739
|
lines.push("Please also reference the following documents as needed:");
|
|
5696
5740
|
lines.push("");
|
|
5697
5741
|
for (const rule of toolRulesWithoutRoot) {
|
|
5698
|
-
const
|
|
5699
|
-
const
|
|
5700
|
-
const escapedDescription = frontmatter.description?.replace(/"/g, '\\"');
|
|
5701
|
-
const globsText = frontmatter.globs?.join(",");
|
|
5742
|
+
const escapedDescription = rule.getDescription()?.replace(/"/g, '\\"');
|
|
5743
|
+
const globsText = rule.getGlobs()?.join(",");
|
|
5702
5744
|
lines.push(
|
|
5703
5745
|
`@${rule.getRelativePathFromCwd()} description: "${escapedDescription}" globs: "${globsText}"`
|
|
5704
5746
|
);
|
|
@@ -5727,14 +5769,14 @@ s/<command> [arguments]
|
|
|
5727
5769
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
5728
5770
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
5729
5771
|
|
|
5730
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
5772
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path54.join)(commands.relativeDirPath, "{command}.md")}\`, then execute the contents of that file as the block of operations.`;
|
|
5731
5773
|
const subagentsSection = `## Simulated Subagents
|
|
5732
5774
|
|
|
5733
5775
|
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.
|
|
5734
5776
|
|
|
5735
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
5777
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path54.join)(subagents.relativeDirPath, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
5736
5778
|
|
|
5737
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
5779
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path54.join)(subagents.relativeDirPath, "planner.md")}\`, and execute its contents as the block of operations.`;
|
|
5738
5780
|
const result = [
|
|
5739
5781
|
overview,
|
|
5740
5782
|
...this.simulateCommands && CommandsProcessor.getToolTargetsSimulated().includes(this.toolTarget) ? [commandsSection] : [],
|
|
@@ -5921,9 +5963,9 @@ async function generateCommand(options) {
|
|
|
5921
5963
|
}
|
|
5922
5964
|
|
|
5923
5965
|
// src/cli/commands/gitignore.ts
|
|
5924
|
-
var
|
|
5966
|
+
var import_node_path55 = require("path");
|
|
5925
5967
|
var gitignoreCommand = async () => {
|
|
5926
|
-
const gitignorePath = (0,
|
|
5968
|
+
const gitignorePath = (0, import_node_path55.join)(process.cwd(), ".gitignore");
|
|
5927
5969
|
const rulesFilesToIgnore = [
|
|
5928
5970
|
"# Generated by rulesync - AI tool configuration files",
|
|
5929
5971
|
"**/.amazonq/",
|
|
@@ -6113,7 +6155,7 @@ async function importCommand(options) {
|
|
|
6113
6155
|
}
|
|
6114
6156
|
|
|
6115
6157
|
// src/cli/commands/init.ts
|
|
6116
|
-
var
|
|
6158
|
+
var import_node_path56 = require("path");
|
|
6117
6159
|
async function initCommand() {
|
|
6118
6160
|
logger.info("Initializing rulesync...");
|
|
6119
6161
|
await ensureDir(RULESYNC_DIR);
|
|
@@ -6159,7 +6201,7 @@ globs: ["**/*"]
|
|
|
6159
6201
|
- Follow single responsibility principle
|
|
6160
6202
|
`
|
|
6161
6203
|
};
|
|
6162
|
-
const filepath = (0,
|
|
6204
|
+
const filepath = (0, import_node_path56.join)(RULESYNC_RULES_DIR, sampleFile.filename);
|
|
6163
6205
|
await ensureDir(RULESYNC_RULES_DIR);
|
|
6164
6206
|
await ensureDir(RulesyncCommand.getSettablePaths().relativeDirPath);
|
|
6165
6207
|
await ensureDir(RULESYNC_SUBAGENTS_DIR);
|
|
@@ -6178,15 +6220,15 @@ var getVersion = async () => {
|
|
|
6178
6220
|
let packageJsonPath;
|
|
6179
6221
|
if (typeof import_meta !== "undefined" && import_meta.url) {
|
|
6180
6222
|
const __filename = (0, import_node_url.fileURLToPath)(import_meta.url);
|
|
6181
|
-
const __dirname = (0,
|
|
6182
|
-
packageJsonPath = (0,
|
|
6223
|
+
const __dirname = (0, import_node_path57.join)(__filename, "..");
|
|
6224
|
+
packageJsonPath = (0, import_node_path57.join)(__dirname, "../../package.json");
|
|
6183
6225
|
} else {
|
|
6184
|
-
packageJsonPath = (0,
|
|
6226
|
+
packageJsonPath = (0, import_node_path57.join)(process.cwd(), "package.json");
|
|
6185
6227
|
}
|
|
6186
6228
|
const packageJson = await readJsonFile(packageJsonPath);
|
|
6187
6229
|
return packageJson.version;
|
|
6188
6230
|
} catch {
|
|
6189
|
-
return "0.
|
|
6231
|
+
return "0.79.0";
|
|
6190
6232
|
}
|
|
6191
6233
|
};
|
|
6192
6234
|
var main = async () => {
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/cli/index.ts
|
|
4
|
-
import { join as
|
|
4
|
+
import { join as join56 } from "path";
|
|
5
5
|
import { fileURLToPath } from "url";
|
|
6
6
|
import { Command } from "commander";
|
|
7
7
|
|
|
@@ -2780,7 +2780,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
2780
2780
|
};
|
|
2781
2781
|
|
|
2782
2782
|
// src/rules/rules-processor.ts
|
|
2783
|
-
import { basename as basename16, join as
|
|
2783
|
+
import { basename as basename16, join as join53 } from "path";
|
|
2784
2784
|
import { XMLBuilder } from "fast-xml-parser";
|
|
2785
2785
|
import { z as z20 } from "zod/mini";
|
|
2786
2786
|
|
|
@@ -3480,6 +3480,9 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3480
3480
|
};
|
|
3481
3481
|
|
|
3482
3482
|
// src/rules/agentsmd-rule.ts
|
|
3483
|
+
import { join as join36 } from "path";
|
|
3484
|
+
|
|
3485
|
+
// src/rules/tool-rule.ts
|
|
3483
3486
|
import { join as join35 } from "path";
|
|
3484
3487
|
|
|
3485
3488
|
// src/rules/rulesync-rule.ts
|
|
@@ -3490,6 +3493,12 @@ var RulesyncRuleFrontmatterSchema = z16.object({
|
|
|
3490
3493
|
targets: z16.optional(RulesyncTargetsSchema),
|
|
3491
3494
|
description: z16.optional(z16.string()),
|
|
3492
3495
|
globs: z16.optional(z16.array(z16.string())),
|
|
3496
|
+
agentsmd: z16.optional(
|
|
3497
|
+
z16.object({
|
|
3498
|
+
// @example "path/to/subproject"
|
|
3499
|
+
subprojectPath: z16.optional(z16.string())
|
|
3500
|
+
})
|
|
3501
|
+
),
|
|
3493
3502
|
cursor: z16.optional(
|
|
3494
3503
|
z16.object({
|
|
3495
3504
|
alwaysApply: z16.optional(z16.boolean()),
|
|
@@ -3555,6 +3564,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
3555
3564
|
targets: result.data.targets ?? ["*"],
|
|
3556
3565
|
description: result.data.description ?? "",
|
|
3557
3566
|
globs: result.data.globs ?? [],
|
|
3567
|
+
agentsmd: result.data.agentsmd,
|
|
3558
3568
|
cursor: result.data.cursor
|
|
3559
3569
|
};
|
|
3560
3570
|
const filename = basename14(filePath);
|
|
@@ -3583,6 +3593,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
3583
3593
|
targets: result.data.targets ?? ["*"],
|
|
3584
3594
|
description: result.data.description ?? "",
|
|
3585
3595
|
globs: result.data.globs ?? [],
|
|
3596
|
+
agentsmd: result.data.agentsmd,
|
|
3586
3597
|
cursor: result.data.cursor
|
|
3587
3598
|
};
|
|
3588
3599
|
const filename = basename14(filePath);
|
|
@@ -3603,9 +3614,13 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
3603
3614
|
// src/rules/tool-rule.ts
|
|
3604
3615
|
var ToolRule = class extends ToolFile {
|
|
3605
3616
|
root;
|
|
3606
|
-
|
|
3617
|
+
description;
|
|
3618
|
+
globs;
|
|
3619
|
+
constructor({ root = false, description, globs, ...rest }) {
|
|
3607
3620
|
super(rest);
|
|
3608
3621
|
this.root = root;
|
|
3622
|
+
this.description = description;
|
|
3623
|
+
this.globs = globs;
|
|
3609
3624
|
}
|
|
3610
3625
|
static async fromFile(_params) {
|
|
3611
3626
|
throw new Error("Please implement this method in the subclass.");
|
|
@@ -3627,9 +3642,32 @@ var ToolRule = class extends ToolFile {
|
|
|
3627
3642
|
relativeFilePath: rulesyncRule.getFrontmatter().root ? rootPath.relativeFilePath : rulesyncRule.getRelativeFilePath(),
|
|
3628
3643
|
fileContent,
|
|
3629
3644
|
validate,
|
|
3630
|
-
root: rulesyncRule.getFrontmatter().root ?? false
|
|
3645
|
+
root: rulesyncRule.getFrontmatter().root ?? false,
|
|
3646
|
+
description: rulesyncRule.getFrontmatter().description,
|
|
3647
|
+
globs: rulesyncRule.getFrontmatter().globs
|
|
3631
3648
|
};
|
|
3632
3649
|
}
|
|
3650
|
+
static buildToolRuleParamsAgentsmd({
|
|
3651
|
+
baseDir = ".",
|
|
3652
|
+
rulesyncRule,
|
|
3653
|
+
validate = true,
|
|
3654
|
+
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
3655
|
+
nonRootPath = { relativeDirPath: ".agents/memories" }
|
|
3656
|
+
}) {
|
|
3657
|
+
const params = this.buildToolRuleParamsDefault({
|
|
3658
|
+
baseDir,
|
|
3659
|
+
rulesyncRule,
|
|
3660
|
+
validate,
|
|
3661
|
+
rootPath,
|
|
3662
|
+
nonRootPath
|
|
3663
|
+
});
|
|
3664
|
+
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
3665
|
+
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
3666
|
+
params.relativeDirPath = join35(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
3667
|
+
params.relativeFilePath = "AGENTS.md";
|
|
3668
|
+
}
|
|
3669
|
+
return params;
|
|
3670
|
+
}
|
|
3633
3671
|
toRulesyncRuleDefault() {
|
|
3634
3672
|
return new RulesyncRule({
|
|
3635
3673
|
baseDir: this.getBaseDir(),
|
|
@@ -3638,8 +3676,8 @@ var ToolRule = class extends ToolFile {
|
|
|
3638
3676
|
frontmatter: {
|
|
3639
3677
|
root: this.isRoot(),
|
|
3640
3678
|
targets: ["*"],
|
|
3641
|
-
description: "",
|
|
3642
|
-
globs: this.isRoot() ? ["**/*"] : []
|
|
3679
|
+
description: this.description ?? "",
|
|
3680
|
+
globs: this.globs ?? (this.isRoot() ? ["**/*"] : [])
|
|
3643
3681
|
},
|
|
3644
3682
|
body: this.getFileContent()
|
|
3645
3683
|
});
|
|
@@ -3647,6 +3685,12 @@ var ToolRule = class extends ToolFile {
|
|
|
3647
3685
|
isRoot() {
|
|
3648
3686
|
return this.root;
|
|
3649
3687
|
}
|
|
3688
|
+
getDescription() {
|
|
3689
|
+
return this.description;
|
|
3690
|
+
}
|
|
3691
|
+
getGlobs() {
|
|
3692
|
+
return this.globs;
|
|
3693
|
+
}
|
|
3650
3694
|
static isTargetedByRulesyncRule(_rulesyncRule) {
|
|
3651
3695
|
throw new Error("Please implement this method in the subclass.");
|
|
3652
3696
|
}
|
|
@@ -3694,8 +3738,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
3694
3738
|
validate = true
|
|
3695
3739
|
}) {
|
|
3696
3740
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
3697
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
3698
|
-
const fileContent = await readFileContent(
|
|
3741
|
+
const relativePath = isRoot ? "AGENTS.md" : join36(".agents/memories", relativeFilePath);
|
|
3742
|
+
const fileContent = await readFileContent(join36(baseDir, relativePath));
|
|
3699
3743
|
return new _AgentsMdRule({
|
|
3700
3744
|
baseDir,
|
|
3701
3745
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -3711,7 +3755,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
3711
3755
|
validate = true
|
|
3712
3756
|
}) {
|
|
3713
3757
|
return new _AgentsMdRule(
|
|
3714
|
-
this.
|
|
3758
|
+
this.buildToolRuleParamsAgentsmd({
|
|
3715
3759
|
baseDir,
|
|
3716
3760
|
rulesyncRule,
|
|
3717
3761
|
validate,
|
|
@@ -3735,7 +3779,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
3735
3779
|
};
|
|
3736
3780
|
|
|
3737
3781
|
// src/rules/amazonqcli-rule.ts
|
|
3738
|
-
import { join as
|
|
3782
|
+
import { join as join37 } from "path";
|
|
3739
3783
|
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
3740
3784
|
static getSettablePaths() {
|
|
3741
3785
|
return {
|
|
@@ -3750,7 +3794,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
3750
3794
|
validate = true
|
|
3751
3795
|
}) {
|
|
3752
3796
|
const fileContent = await readFileContent(
|
|
3753
|
-
|
|
3797
|
+
join37(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
3754
3798
|
);
|
|
3755
3799
|
return new _AmazonQCliRule({
|
|
3756
3800
|
baseDir,
|
|
@@ -3790,7 +3834,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
3790
3834
|
};
|
|
3791
3835
|
|
|
3792
3836
|
// src/rules/augmentcode-legacy-rule.ts
|
|
3793
|
-
import { join as
|
|
3837
|
+
import { join as join38 } from "path";
|
|
3794
3838
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
3795
3839
|
toRulesyncRule() {
|
|
3796
3840
|
const rulesyncFrontmatter = {
|
|
@@ -3850,8 +3894,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
3850
3894
|
}) {
|
|
3851
3895
|
const settablePaths = this.getSettablePaths();
|
|
3852
3896
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
3853
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
3854
|
-
const fileContent = await readFileContent(
|
|
3897
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join38(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
3898
|
+
const fileContent = await readFileContent(join38(baseDir, relativePath));
|
|
3855
3899
|
return new _AugmentcodeLegacyRule({
|
|
3856
3900
|
baseDir,
|
|
3857
3901
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -3864,7 +3908,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
3864
3908
|
};
|
|
3865
3909
|
|
|
3866
3910
|
// src/rules/augmentcode-rule.ts
|
|
3867
|
-
import { join as
|
|
3911
|
+
import { join as join39 } from "path";
|
|
3868
3912
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
3869
3913
|
toRulesyncRule() {
|
|
3870
3914
|
return this.toRulesyncRuleDefault();
|
|
@@ -3896,7 +3940,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
3896
3940
|
validate = true
|
|
3897
3941
|
}) {
|
|
3898
3942
|
const fileContent = await readFileContent(
|
|
3899
|
-
|
|
3943
|
+
join39(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
3900
3944
|
);
|
|
3901
3945
|
const { body: content } = parseFrontmatter(fileContent);
|
|
3902
3946
|
return new _AugmentcodeRule({
|
|
@@ -3919,7 +3963,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
3919
3963
|
};
|
|
3920
3964
|
|
|
3921
3965
|
// src/rules/claudecode-rule.ts
|
|
3922
|
-
import { join as
|
|
3966
|
+
import { join as join40 } from "path";
|
|
3923
3967
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
3924
3968
|
static getSettablePaths() {
|
|
3925
3969
|
return {
|
|
@@ -3938,8 +3982,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
3938
3982
|
validate = true
|
|
3939
3983
|
}) {
|
|
3940
3984
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
3941
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
3942
|
-
const fileContent = await readFileContent(
|
|
3985
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join40(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
3986
|
+
const fileContent = await readFileContent(join40(baseDir, relativePath));
|
|
3943
3987
|
return new _ClaudecodeRule({
|
|
3944
3988
|
baseDir,
|
|
3945
3989
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -3979,7 +4023,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
3979
4023
|
};
|
|
3980
4024
|
|
|
3981
4025
|
// src/rules/cline-rule.ts
|
|
3982
|
-
import { join as
|
|
4026
|
+
import { join as join41 } from "path";
|
|
3983
4027
|
import { z as z17 } from "zod/mini";
|
|
3984
4028
|
var ClineRuleFrontmatterSchema = z17.object({
|
|
3985
4029
|
description: z17.string()
|
|
@@ -4024,7 +4068,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
4024
4068
|
validate = true
|
|
4025
4069
|
}) {
|
|
4026
4070
|
const fileContent = await readFileContent(
|
|
4027
|
-
|
|
4071
|
+
join41(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4028
4072
|
);
|
|
4029
4073
|
return new _ClineRule({
|
|
4030
4074
|
baseDir,
|
|
@@ -4037,7 +4081,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
4037
4081
|
};
|
|
4038
4082
|
|
|
4039
4083
|
// src/rules/codexcli-rule.ts
|
|
4040
|
-
import { join as
|
|
4084
|
+
import { join as join42 } from "path";
|
|
4041
4085
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
4042
4086
|
static getSettablePaths() {
|
|
4043
4087
|
return {
|
|
@@ -4056,8 +4100,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4056
4100
|
validate = true
|
|
4057
4101
|
}) {
|
|
4058
4102
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
4059
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
4060
|
-
const fileContent = await readFileContent(
|
|
4103
|
+
const relativePath = isRoot ? "AGENTS.md" : join42(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4104
|
+
const fileContent = await readFileContent(join42(baseDir, relativePath));
|
|
4061
4105
|
return new _CodexcliRule({
|
|
4062
4106
|
baseDir,
|
|
4063
4107
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4073,7 +4117,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4073
4117
|
validate = true
|
|
4074
4118
|
}) {
|
|
4075
4119
|
return new _CodexcliRule(
|
|
4076
|
-
this.
|
|
4120
|
+
this.buildToolRuleParamsAgentsmd({
|
|
4077
4121
|
baseDir,
|
|
4078
4122
|
rulesyncRule,
|
|
4079
4123
|
validate,
|
|
@@ -4097,7 +4141,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4097
4141
|
};
|
|
4098
4142
|
|
|
4099
4143
|
// src/rules/copilot-rule.ts
|
|
4100
|
-
import { join as
|
|
4144
|
+
import { join as join43 } from "path";
|
|
4101
4145
|
import { z as z18 } from "zod/mini";
|
|
4102
4146
|
var CopilotRuleFrontmatterSchema = z18.object({
|
|
4103
4147
|
description: z18.optional(z18.string()),
|
|
@@ -4189,11 +4233,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4189
4233
|
validate = true
|
|
4190
4234
|
}) {
|
|
4191
4235
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
4192
|
-
const relativePath = isRoot ?
|
|
4236
|
+
const relativePath = isRoot ? join43(
|
|
4193
4237
|
this.getSettablePaths().root.relativeDirPath,
|
|
4194
4238
|
this.getSettablePaths().root.relativeFilePath
|
|
4195
|
-
) :
|
|
4196
|
-
const fileContent = await readFileContent(
|
|
4239
|
+
) : join43(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4240
|
+
const fileContent = await readFileContent(join43(baseDir, relativePath));
|
|
4197
4241
|
if (isRoot) {
|
|
4198
4242
|
return new _CopilotRule({
|
|
4199
4243
|
baseDir,
|
|
@@ -4212,7 +4256,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4212
4256
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
4213
4257
|
if (!result.success) {
|
|
4214
4258
|
throw new Error(
|
|
4215
|
-
`Invalid frontmatter in ${
|
|
4259
|
+
`Invalid frontmatter in ${join43(baseDir, relativeFilePath)}: ${result.error.message}`
|
|
4216
4260
|
);
|
|
4217
4261
|
}
|
|
4218
4262
|
return new _CopilotRule({
|
|
@@ -4251,7 +4295,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4251
4295
|
};
|
|
4252
4296
|
|
|
4253
4297
|
// src/rules/cursor-rule.ts
|
|
4254
|
-
import { basename as basename15, join as
|
|
4298
|
+
import { basename as basename15, join as join44 } from "path";
|
|
4255
4299
|
import { z as z19 } from "zod/mini";
|
|
4256
4300
|
var CursorRuleFrontmatterSchema = z19.object({
|
|
4257
4301
|
description: z19.optional(z19.string()),
|
|
@@ -4381,13 +4425,13 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
4381
4425
|
validate = true
|
|
4382
4426
|
}) {
|
|
4383
4427
|
const fileContent = await readFileContent(
|
|
4384
|
-
|
|
4428
|
+
join44(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4385
4429
|
);
|
|
4386
4430
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
4387
4431
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
4388
4432
|
if (!result.success) {
|
|
4389
4433
|
throw new Error(
|
|
4390
|
-
`Invalid frontmatter in ${
|
|
4434
|
+
`Invalid frontmatter in ${join44(baseDir, relativeFilePath)}: ${result.error.message}`
|
|
4391
4435
|
);
|
|
4392
4436
|
}
|
|
4393
4437
|
return new _CursorRule({
|
|
@@ -4425,7 +4469,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
4425
4469
|
};
|
|
4426
4470
|
|
|
4427
4471
|
// src/rules/geminicli-rule.ts
|
|
4428
|
-
import { join as
|
|
4472
|
+
import { join as join45 } from "path";
|
|
4429
4473
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
4430
4474
|
static getSettablePaths() {
|
|
4431
4475
|
return {
|
|
@@ -4444,8 +4488,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
4444
4488
|
validate = true
|
|
4445
4489
|
}) {
|
|
4446
4490
|
const isRoot = relativeFilePath === "GEMINI.md";
|
|
4447
|
-
const relativePath = isRoot ? "GEMINI.md" :
|
|
4448
|
-
const fileContent = await readFileContent(
|
|
4491
|
+
const relativePath = isRoot ? "GEMINI.md" : join45(".gemini/memories", relativeFilePath);
|
|
4492
|
+
const fileContent = await readFileContent(join45(baseDir, relativePath));
|
|
4449
4493
|
return new _GeminiCliRule({
|
|
4450
4494
|
baseDir,
|
|
4451
4495
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4485,7 +4529,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
4485
4529
|
};
|
|
4486
4530
|
|
|
4487
4531
|
// src/rules/junie-rule.ts
|
|
4488
|
-
import { join as
|
|
4532
|
+
import { join as join46 } from "path";
|
|
4489
4533
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
4490
4534
|
static getSettablePaths() {
|
|
4491
4535
|
return {
|
|
@@ -4504,8 +4548,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
4504
4548
|
validate = true
|
|
4505
4549
|
}) {
|
|
4506
4550
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
4507
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
4508
|
-
const fileContent = await readFileContent(
|
|
4551
|
+
const relativePath = isRoot ? "guidelines.md" : join46(".junie/memories", relativeFilePath);
|
|
4552
|
+
const fileContent = await readFileContent(join46(baseDir, relativePath));
|
|
4509
4553
|
return new _JunieRule({
|
|
4510
4554
|
baseDir,
|
|
4511
4555
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4545,7 +4589,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
4545
4589
|
};
|
|
4546
4590
|
|
|
4547
4591
|
// src/rules/kiro-rule.ts
|
|
4548
|
-
import { join as
|
|
4592
|
+
import { join as join47 } from "path";
|
|
4549
4593
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
4550
4594
|
static getSettablePaths() {
|
|
4551
4595
|
return {
|
|
@@ -4560,7 +4604,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
4560
4604
|
validate = true
|
|
4561
4605
|
}) {
|
|
4562
4606
|
const fileContent = await readFileContent(
|
|
4563
|
-
|
|
4607
|
+
join47(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4564
4608
|
);
|
|
4565
4609
|
return new _KiroRule({
|
|
4566
4610
|
baseDir,
|
|
@@ -4600,7 +4644,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
4600
4644
|
};
|
|
4601
4645
|
|
|
4602
4646
|
// src/rules/opencode-rule.ts
|
|
4603
|
-
import { join as
|
|
4647
|
+
import { join as join48 } from "path";
|
|
4604
4648
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
4605
4649
|
static getSettablePaths() {
|
|
4606
4650
|
return {
|
|
@@ -4619,8 +4663,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
4619
4663
|
validate = true
|
|
4620
4664
|
}) {
|
|
4621
4665
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
4622
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
4623
|
-
const fileContent = await readFileContent(
|
|
4666
|
+
const relativePath = isRoot ? "AGENTS.md" : join48(".opencode/memories", relativeFilePath);
|
|
4667
|
+
const fileContent = await readFileContent(join48(baseDir, relativePath));
|
|
4624
4668
|
return new _OpenCodeRule({
|
|
4625
4669
|
baseDir,
|
|
4626
4670
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4660,7 +4704,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
4660
4704
|
};
|
|
4661
4705
|
|
|
4662
4706
|
// src/rules/qwencode-rule.ts
|
|
4663
|
-
import { join as
|
|
4707
|
+
import { join as join49 } from "path";
|
|
4664
4708
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
4665
4709
|
static getSettablePaths() {
|
|
4666
4710
|
return {
|
|
@@ -4679,8 +4723,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
4679
4723
|
validate = true
|
|
4680
4724
|
}) {
|
|
4681
4725
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
4682
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
4683
|
-
const fileContent = await readFileContent(
|
|
4726
|
+
const relativePath = isRoot ? "QWEN.md" : join49(".qwen/memories", relativeFilePath);
|
|
4727
|
+
const fileContent = await readFileContent(join49(baseDir, relativePath));
|
|
4684
4728
|
return new _QwencodeRule({
|
|
4685
4729
|
baseDir,
|
|
4686
4730
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4717,7 +4761,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
4717
4761
|
};
|
|
4718
4762
|
|
|
4719
4763
|
// src/rules/roo-rule.ts
|
|
4720
|
-
import { join as
|
|
4764
|
+
import { join as join50 } from "path";
|
|
4721
4765
|
var RooRule = class _RooRule extends ToolRule {
|
|
4722
4766
|
static getSettablePaths() {
|
|
4723
4767
|
return {
|
|
@@ -4732,7 +4776,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
4732
4776
|
validate = true
|
|
4733
4777
|
}) {
|
|
4734
4778
|
const fileContent = await readFileContent(
|
|
4735
|
-
|
|
4779
|
+
join50(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4736
4780
|
);
|
|
4737
4781
|
return new _RooRule({
|
|
4738
4782
|
baseDir,
|
|
@@ -4787,7 +4831,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
4787
4831
|
};
|
|
4788
4832
|
|
|
4789
4833
|
// src/rules/warp-rule.ts
|
|
4790
|
-
import { join as
|
|
4834
|
+
import { join as join51 } from "path";
|
|
4791
4835
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
4792
4836
|
constructor({ fileContent, root, ...rest }) {
|
|
4793
4837
|
super({
|
|
@@ -4813,8 +4857,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
4813
4857
|
validate = true
|
|
4814
4858
|
}) {
|
|
4815
4859
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
4816
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
4817
|
-
const fileContent = await readFileContent(
|
|
4860
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join51(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4861
|
+
const fileContent = await readFileContent(join51(baseDir, relativePath));
|
|
4818
4862
|
return new _WarpRule({
|
|
4819
4863
|
baseDir,
|
|
4820
4864
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -4854,7 +4898,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
4854
4898
|
};
|
|
4855
4899
|
|
|
4856
4900
|
// src/rules/windsurf-rule.ts
|
|
4857
|
-
import { join as
|
|
4901
|
+
import { join as join52 } from "path";
|
|
4858
4902
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
4859
4903
|
static getSettablePaths() {
|
|
4860
4904
|
return {
|
|
@@ -4869,7 +4913,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
4869
4913
|
validate = true
|
|
4870
4914
|
}) {
|
|
4871
4915
|
const fileContent = await readFileContent(
|
|
4872
|
-
|
|
4916
|
+
join52(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4873
4917
|
);
|
|
4874
4918
|
return new _WindsurfRule({
|
|
4875
4919
|
baseDir,
|
|
@@ -5248,14 +5292,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5248
5292
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
5249
5293
|
*/
|
|
5250
5294
|
async loadRulesyncFiles() {
|
|
5251
|
-
const files = await findFilesByGlobs(
|
|
5295
|
+
const files = await findFilesByGlobs(join53(RULESYNC_RULES_DIR, "*.md"));
|
|
5252
5296
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
5253
5297
|
return Promise.all(
|
|
5254
5298
|
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename16(file) }))
|
|
5255
5299
|
);
|
|
5256
5300
|
}
|
|
5257
5301
|
async loadRulesyncFilesLegacy() {
|
|
5258
|
-
const legacyFiles = await findFilesByGlobs(
|
|
5302
|
+
const legacyFiles = await findFilesByGlobs(join53(RULESYNC_RULES_DIR_LEGACY, "*.md"));
|
|
5259
5303
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
5260
5304
|
return Promise.all(
|
|
5261
5305
|
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename16(file) }))
|
|
@@ -5319,7 +5363,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5319
5363
|
return [];
|
|
5320
5364
|
}
|
|
5321
5365
|
const rootFilePaths = await findFilesByGlobs(
|
|
5322
|
-
|
|
5366
|
+
join53(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
|
|
5323
5367
|
);
|
|
5324
5368
|
return await Promise.all(
|
|
5325
5369
|
rootFilePaths.map(
|
|
@@ -5336,7 +5380,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5336
5380
|
return [];
|
|
5337
5381
|
}
|
|
5338
5382
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
5339
|
-
|
|
5383
|
+
join53(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
|
|
5340
5384
|
);
|
|
5341
5385
|
return await Promise.all(
|
|
5342
5386
|
nonRootFilePaths.map(
|
|
@@ -5672,10 +5716,8 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5672
5716
|
lines.push("Please also reference the following documents as needed:");
|
|
5673
5717
|
lines.push("");
|
|
5674
5718
|
for (const rule of toolRulesWithoutRoot) {
|
|
5675
|
-
const
|
|
5676
|
-
const
|
|
5677
|
-
const escapedDescription = frontmatter.description?.replace(/"/g, '\\"');
|
|
5678
|
-
const globsText = frontmatter.globs?.join(",");
|
|
5719
|
+
const escapedDescription = rule.getDescription()?.replace(/"/g, '\\"');
|
|
5720
|
+
const globsText = rule.getGlobs()?.join(",");
|
|
5679
5721
|
lines.push(
|
|
5680
5722
|
`@${rule.getRelativePathFromCwd()} description: "${escapedDescription}" globs: "${globsText}"`
|
|
5681
5723
|
);
|
|
@@ -5704,14 +5746,14 @@ s/<command> [arguments]
|
|
|
5704
5746
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
5705
5747
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
5706
5748
|
|
|
5707
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
5749
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join53(commands.relativeDirPath, "{command}.md")}\`, then execute the contents of that file as the block of operations.`;
|
|
5708
5750
|
const subagentsSection = `## Simulated Subagents
|
|
5709
5751
|
|
|
5710
5752
|
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.
|
|
5711
5753
|
|
|
5712
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
5754
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join53(subagents.relativeDirPath, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
5713
5755
|
|
|
5714
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
5756
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join53(subagents.relativeDirPath, "planner.md")}\`, and execute its contents as the block of operations.`;
|
|
5715
5757
|
const result = [
|
|
5716
5758
|
overview,
|
|
5717
5759
|
...this.simulateCommands && CommandsProcessor.getToolTargetsSimulated().includes(this.toolTarget) ? [commandsSection] : [],
|
|
@@ -5898,9 +5940,9 @@ async function generateCommand(options) {
|
|
|
5898
5940
|
}
|
|
5899
5941
|
|
|
5900
5942
|
// src/cli/commands/gitignore.ts
|
|
5901
|
-
import { join as
|
|
5943
|
+
import { join as join54 } from "path";
|
|
5902
5944
|
var gitignoreCommand = async () => {
|
|
5903
|
-
const gitignorePath =
|
|
5945
|
+
const gitignorePath = join54(process.cwd(), ".gitignore");
|
|
5904
5946
|
const rulesFilesToIgnore = [
|
|
5905
5947
|
"# Generated by rulesync - AI tool configuration files",
|
|
5906
5948
|
"**/.amazonq/",
|
|
@@ -6090,7 +6132,7 @@ async function importCommand(options) {
|
|
|
6090
6132
|
}
|
|
6091
6133
|
|
|
6092
6134
|
// src/cli/commands/init.ts
|
|
6093
|
-
import { join as
|
|
6135
|
+
import { join as join55 } from "path";
|
|
6094
6136
|
async function initCommand() {
|
|
6095
6137
|
logger.info("Initializing rulesync...");
|
|
6096
6138
|
await ensureDir(RULESYNC_DIR);
|
|
@@ -6136,7 +6178,7 @@ globs: ["**/*"]
|
|
|
6136
6178
|
- Follow single responsibility principle
|
|
6137
6179
|
`
|
|
6138
6180
|
};
|
|
6139
|
-
const filepath =
|
|
6181
|
+
const filepath = join55(RULESYNC_RULES_DIR, sampleFile.filename);
|
|
6140
6182
|
await ensureDir(RULESYNC_RULES_DIR);
|
|
6141
6183
|
await ensureDir(RulesyncCommand.getSettablePaths().relativeDirPath);
|
|
6142
6184
|
await ensureDir(RULESYNC_SUBAGENTS_DIR);
|
|
@@ -6154,15 +6196,15 @@ var getVersion = async () => {
|
|
|
6154
6196
|
let packageJsonPath;
|
|
6155
6197
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
6156
6198
|
const __filename = fileURLToPath(import.meta.url);
|
|
6157
|
-
const __dirname =
|
|
6158
|
-
packageJsonPath =
|
|
6199
|
+
const __dirname = join56(__filename, "..");
|
|
6200
|
+
packageJsonPath = join56(__dirname, "../../package.json");
|
|
6159
6201
|
} else {
|
|
6160
|
-
packageJsonPath =
|
|
6202
|
+
packageJsonPath = join56(process.cwd(), "package.json");
|
|
6161
6203
|
}
|
|
6162
6204
|
const packageJson = await readJsonFile(packageJsonPath);
|
|
6163
6205
|
return packageJson.version;
|
|
6164
6206
|
} catch {
|
|
6165
|
-
return "0.
|
|
6207
|
+
return "0.79.0";
|
|
6166
6208
|
}
|
|
6167
6209
|
};
|
|
6168
6210
|
var main = async () => {
|