rulesync 0.78.0 → 0.80.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 +23 -13
- package/dist/index.cjs +108 -70
- package/dist/index.js +103 -65
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Rulesync
|
|
2
2
|
|
|
3
3
|
[](https://github.com/dyoshikawa/rulesync/actions/workflows/ci.yml)
|
|
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
|
|
|
@@ -48,7 +52,7 @@ npx rulesync generate --targets "*" --features "*"
|
|
|
48
52
|
|
|
49
53
|
## Supported Tools and Features
|
|
50
54
|
|
|
51
|
-
|
|
55
|
+
Rulesync supports both **generation** and **import** for All of the major AI coding tools:
|
|
52
56
|
|
|
53
57
|
| Tool | rules | ignore | mcp | commands | subagents |
|
|
54
58
|
|------------------------|:-----:|:------:|:-----:|:--------:|:---------:|
|
|
@@ -72,19 +76,19 @@ rulesync supports both **generation** and **import** for All of the major AI cod
|
|
|
72
76
|
|
|
73
77
|
🎮: Simulated Commands/Subagents (Experimental Feature)
|
|
74
78
|
|
|
75
|
-
## Why
|
|
79
|
+
## Why Rulesync?
|
|
76
80
|
|
|
77
81
|
### 🔧 **Tool Flexibility**
|
|
78
82
|
Team members can freely choose their preferred AI coding tools. Whether it's GitHub Copilot, Cursor, Cline, or Claude Code, each developer can use the tool that maximizes their productivity.
|
|
79
83
|
|
|
80
84
|
### 📈 **Future-Proof Development**
|
|
81
|
-
AI development tools evolve rapidly with new tools emerging frequently. With
|
|
85
|
+
AI development tools evolve rapidly with new tools emerging frequently. With Rulesync, switching between tools doesn't require redefining your rules from scratch.
|
|
82
86
|
|
|
83
87
|
### 🎯 **Multi-Tool Workflow**
|
|
84
88
|
Enable hybrid development workflows combining multiple AI tools.
|
|
85
89
|
|
|
86
90
|
### 🔓 **No Lock-in**
|
|
87
|
-
Avoid lock-in completely. If you decide to stop using
|
|
91
|
+
Avoid lock-in completely. If you decide to stop using Rulesync, you can continue using the generated rule files as-is.
|
|
88
92
|
|
|
89
93
|
### 🎯 **Consistency Across Tools**
|
|
90
94
|
Apply consistent rules across all AI tools, improving code quality and development experience for the entire team.
|
|
@@ -120,7 +124,7 @@ npx rulesync gitignore
|
|
|
120
124
|
|
|
121
125
|
## Configuration
|
|
122
126
|
|
|
123
|
-
You can configure
|
|
127
|
+
You can configure Rulesync by creating a `rulesync.jsonc` file in the root of your project.
|
|
124
128
|
|
|
125
129
|
Example:
|
|
126
130
|
|
|
@@ -156,19 +160,25 @@ 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
|
-
description: "
|
|
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
|
-
description: "
|
|
175
|
+
description: "Rulesync project overview and development guidelines for unified AI rules management CLI tool"
|
|
166
176
|
globs: ["*"]
|
|
167
177
|
---
|
|
168
178
|
|
|
169
|
-
#
|
|
179
|
+
# Rulesync Project Overview
|
|
170
180
|
|
|
171
|
-
This is
|
|
181
|
+
This is Rulesync, a Node.js CLI tool that automatically generates configuration files for various AI development tools from unified AI rule files. The project enables teams to maintain consistent AI coding assistant rules across multiple tools.
|
|
172
182
|
|
|
173
183
|
...
|
|
174
184
|
```
|
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
|
|
|
@@ -46,6 +46,7 @@ var import_node_path = require("path");
|
|
|
46
46
|
|
|
47
47
|
// src/utils/logger.ts
|
|
48
48
|
var import_consola = require("consola");
|
|
49
|
+
var isEnvTest = process.env.NODE_ENV === "test";
|
|
49
50
|
var Logger = class {
|
|
50
51
|
_verbose = false;
|
|
51
52
|
console = import_consola.consola.withDefaults({
|
|
@@ -58,22 +59,27 @@ var Logger = class {
|
|
|
58
59
|
return this._verbose;
|
|
59
60
|
}
|
|
60
61
|
info(message, ...args) {
|
|
62
|
+
if (isEnvTest) return;
|
|
61
63
|
this.console.info(message, ...args);
|
|
62
64
|
}
|
|
63
65
|
// Success (always shown)
|
|
64
66
|
success(message, ...args) {
|
|
67
|
+
if (isEnvTest) return;
|
|
65
68
|
this.console.success(message, ...args);
|
|
66
69
|
}
|
|
67
70
|
// Warning (always shown)
|
|
68
71
|
warn(message, ...args) {
|
|
72
|
+
if (isEnvTest) return;
|
|
69
73
|
this.console.warn(message, ...args);
|
|
70
74
|
}
|
|
71
75
|
// Error (always shown)
|
|
72
76
|
error(message, ...args) {
|
|
77
|
+
if (isEnvTest) return;
|
|
73
78
|
this.console.error(message, ...args);
|
|
74
79
|
}
|
|
75
80
|
// Debug level (shown only in verbose mode)
|
|
76
81
|
debug(message, ...args) {
|
|
82
|
+
if (isEnvTest) return;
|
|
77
83
|
if (this._verbose) {
|
|
78
84
|
this.console.info(message, ...args);
|
|
79
85
|
}
|
|
@@ -2803,7 +2809,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
2803
2809
|
};
|
|
2804
2810
|
|
|
2805
2811
|
// src/rules/rules-processor.ts
|
|
2806
|
-
var
|
|
2812
|
+
var import_node_path54 = require("path");
|
|
2807
2813
|
var import_fast_xml_parser = require("fast-xml-parser");
|
|
2808
2814
|
var import_mini20 = require("zod/mini");
|
|
2809
2815
|
|
|
@@ -3503,6 +3509,9 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3503
3509
|
};
|
|
3504
3510
|
|
|
3505
3511
|
// src/rules/agentsmd-rule.ts
|
|
3512
|
+
var import_node_path37 = require("path");
|
|
3513
|
+
|
|
3514
|
+
// src/rules/tool-rule.ts
|
|
3506
3515
|
var import_node_path36 = require("path");
|
|
3507
3516
|
|
|
3508
3517
|
// src/rules/rulesync-rule.ts
|
|
@@ -3513,6 +3522,12 @@ var RulesyncRuleFrontmatterSchema = import_mini16.z.object({
|
|
|
3513
3522
|
targets: import_mini16.z.optional(RulesyncTargetsSchema),
|
|
3514
3523
|
description: import_mini16.z.optional(import_mini16.z.string()),
|
|
3515
3524
|
globs: import_mini16.z.optional(import_mini16.z.array(import_mini16.z.string())),
|
|
3525
|
+
agentsmd: import_mini16.z.optional(
|
|
3526
|
+
import_mini16.z.object({
|
|
3527
|
+
// @example "path/to/subproject"
|
|
3528
|
+
subprojectPath: import_mini16.z.optional(import_mini16.z.string())
|
|
3529
|
+
})
|
|
3530
|
+
),
|
|
3516
3531
|
cursor: import_mini16.z.optional(
|
|
3517
3532
|
import_mini16.z.object({
|
|
3518
3533
|
alwaysApply: import_mini16.z.optional(import_mini16.z.boolean()),
|
|
@@ -3578,6 +3593,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
3578
3593
|
targets: result.data.targets ?? ["*"],
|
|
3579
3594
|
description: result.data.description ?? "",
|
|
3580
3595
|
globs: result.data.globs ?? [],
|
|
3596
|
+
agentsmd: result.data.agentsmd,
|
|
3581
3597
|
cursor: result.data.cursor
|
|
3582
3598
|
};
|
|
3583
3599
|
const filename = (0, import_node_path35.basename)(filePath);
|
|
@@ -3606,6 +3622,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
3606
3622
|
targets: result.data.targets ?? ["*"],
|
|
3607
3623
|
description: result.data.description ?? "",
|
|
3608
3624
|
globs: result.data.globs ?? [],
|
|
3625
|
+
agentsmd: result.data.agentsmd,
|
|
3609
3626
|
cursor: result.data.cursor
|
|
3610
3627
|
};
|
|
3611
3628
|
const filename = (0, import_node_path35.basename)(filePath);
|
|
@@ -3659,6 +3676,27 @@ var ToolRule = class extends ToolFile {
|
|
|
3659
3676
|
globs: rulesyncRule.getFrontmatter().globs
|
|
3660
3677
|
};
|
|
3661
3678
|
}
|
|
3679
|
+
static buildToolRuleParamsAgentsmd({
|
|
3680
|
+
baseDir = ".",
|
|
3681
|
+
rulesyncRule,
|
|
3682
|
+
validate = true,
|
|
3683
|
+
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
3684
|
+
nonRootPath = { relativeDirPath: ".agents/memories" }
|
|
3685
|
+
}) {
|
|
3686
|
+
const params = this.buildToolRuleParamsDefault({
|
|
3687
|
+
baseDir,
|
|
3688
|
+
rulesyncRule,
|
|
3689
|
+
validate,
|
|
3690
|
+
rootPath,
|
|
3691
|
+
nonRootPath
|
|
3692
|
+
});
|
|
3693
|
+
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
3694
|
+
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
3695
|
+
params.relativeDirPath = (0, import_node_path36.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
3696
|
+
params.relativeFilePath = "AGENTS.md";
|
|
3697
|
+
}
|
|
3698
|
+
return params;
|
|
3699
|
+
}
|
|
3662
3700
|
toRulesyncRuleDefault() {
|
|
3663
3701
|
return new RulesyncRule({
|
|
3664
3702
|
baseDir: this.getBaseDir(),
|
|
@@ -3729,8 +3767,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
3729
3767
|
validate = true
|
|
3730
3768
|
}) {
|
|
3731
3769
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
3732
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
3733
|
-
const fileContent = await readFileContent((0,
|
|
3770
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path37.join)(".agents/memories", relativeFilePath);
|
|
3771
|
+
const fileContent = await readFileContent((0, import_node_path37.join)(baseDir, relativePath));
|
|
3734
3772
|
return new _AgentsMdRule({
|
|
3735
3773
|
baseDir,
|
|
3736
3774
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -3746,7 +3784,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
3746
3784
|
validate = true
|
|
3747
3785
|
}) {
|
|
3748
3786
|
return new _AgentsMdRule(
|
|
3749
|
-
this.
|
|
3787
|
+
this.buildToolRuleParamsAgentsmd({
|
|
3750
3788
|
baseDir,
|
|
3751
3789
|
rulesyncRule,
|
|
3752
3790
|
validate,
|
|
@@ -3770,7 +3808,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
3770
3808
|
};
|
|
3771
3809
|
|
|
3772
3810
|
// src/rules/amazonqcli-rule.ts
|
|
3773
|
-
var
|
|
3811
|
+
var import_node_path38 = require("path");
|
|
3774
3812
|
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
3775
3813
|
static getSettablePaths() {
|
|
3776
3814
|
return {
|
|
@@ -3785,7 +3823,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
3785
3823
|
validate = true
|
|
3786
3824
|
}) {
|
|
3787
3825
|
const fileContent = await readFileContent(
|
|
3788
|
-
(0,
|
|
3826
|
+
(0, import_node_path38.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
3789
3827
|
);
|
|
3790
3828
|
return new _AmazonQCliRule({
|
|
3791
3829
|
baseDir,
|
|
@@ -3825,7 +3863,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
3825
3863
|
};
|
|
3826
3864
|
|
|
3827
3865
|
// src/rules/augmentcode-legacy-rule.ts
|
|
3828
|
-
var
|
|
3866
|
+
var import_node_path39 = require("path");
|
|
3829
3867
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
3830
3868
|
toRulesyncRule() {
|
|
3831
3869
|
const rulesyncFrontmatter = {
|
|
@@ -3885,8 +3923,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
3885
3923
|
}) {
|
|
3886
3924
|
const settablePaths = this.getSettablePaths();
|
|
3887
3925
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
3888
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
3889
|
-
const fileContent = await readFileContent((0,
|
|
3926
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path39.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
3927
|
+
const fileContent = await readFileContent((0, import_node_path39.join)(baseDir, relativePath));
|
|
3890
3928
|
return new _AugmentcodeLegacyRule({
|
|
3891
3929
|
baseDir,
|
|
3892
3930
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -3899,7 +3937,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
3899
3937
|
};
|
|
3900
3938
|
|
|
3901
3939
|
// src/rules/augmentcode-rule.ts
|
|
3902
|
-
var
|
|
3940
|
+
var import_node_path40 = require("path");
|
|
3903
3941
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
3904
3942
|
toRulesyncRule() {
|
|
3905
3943
|
return this.toRulesyncRuleDefault();
|
|
@@ -3931,7 +3969,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
3931
3969
|
validate = true
|
|
3932
3970
|
}) {
|
|
3933
3971
|
const fileContent = await readFileContent(
|
|
3934
|
-
(0,
|
|
3972
|
+
(0, import_node_path40.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
3935
3973
|
);
|
|
3936
3974
|
const { body: content } = parseFrontmatter(fileContent);
|
|
3937
3975
|
return new _AugmentcodeRule({
|
|
@@ -3954,7 +3992,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
3954
3992
|
};
|
|
3955
3993
|
|
|
3956
3994
|
// src/rules/claudecode-rule.ts
|
|
3957
|
-
var
|
|
3995
|
+
var import_node_path41 = require("path");
|
|
3958
3996
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
3959
3997
|
static getSettablePaths() {
|
|
3960
3998
|
return {
|
|
@@ -3973,8 +4011,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
3973
4011
|
validate = true
|
|
3974
4012
|
}) {
|
|
3975
4013
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
3976
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
3977
|
-
const fileContent = await readFileContent((0,
|
|
4014
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path41.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4015
|
+
const fileContent = await readFileContent((0, import_node_path41.join)(baseDir, relativePath));
|
|
3978
4016
|
return new _ClaudecodeRule({
|
|
3979
4017
|
baseDir,
|
|
3980
4018
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4014,7 +4052,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
4014
4052
|
};
|
|
4015
4053
|
|
|
4016
4054
|
// src/rules/cline-rule.ts
|
|
4017
|
-
var
|
|
4055
|
+
var import_node_path42 = require("path");
|
|
4018
4056
|
var import_mini17 = require("zod/mini");
|
|
4019
4057
|
var ClineRuleFrontmatterSchema = import_mini17.z.object({
|
|
4020
4058
|
description: import_mini17.z.string()
|
|
@@ -4059,7 +4097,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
4059
4097
|
validate = true
|
|
4060
4098
|
}) {
|
|
4061
4099
|
const fileContent = await readFileContent(
|
|
4062
|
-
(0,
|
|
4100
|
+
(0, import_node_path42.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4063
4101
|
);
|
|
4064
4102
|
return new _ClineRule({
|
|
4065
4103
|
baseDir,
|
|
@@ -4072,7 +4110,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
4072
4110
|
};
|
|
4073
4111
|
|
|
4074
4112
|
// src/rules/codexcli-rule.ts
|
|
4075
|
-
var
|
|
4113
|
+
var import_node_path43 = require("path");
|
|
4076
4114
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
4077
4115
|
static getSettablePaths() {
|
|
4078
4116
|
return {
|
|
@@ -4091,8 +4129,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4091
4129
|
validate = true
|
|
4092
4130
|
}) {
|
|
4093
4131
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
4094
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
4095
|
-
const fileContent = await readFileContent((0,
|
|
4132
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path43.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4133
|
+
const fileContent = await readFileContent((0, import_node_path43.join)(baseDir, relativePath));
|
|
4096
4134
|
return new _CodexcliRule({
|
|
4097
4135
|
baseDir,
|
|
4098
4136
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4108,7 +4146,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4108
4146
|
validate = true
|
|
4109
4147
|
}) {
|
|
4110
4148
|
return new _CodexcliRule(
|
|
4111
|
-
this.
|
|
4149
|
+
this.buildToolRuleParamsAgentsmd({
|
|
4112
4150
|
baseDir,
|
|
4113
4151
|
rulesyncRule,
|
|
4114
4152
|
validate,
|
|
@@ -4132,7 +4170,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4132
4170
|
};
|
|
4133
4171
|
|
|
4134
4172
|
// src/rules/copilot-rule.ts
|
|
4135
|
-
var
|
|
4173
|
+
var import_node_path44 = require("path");
|
|
4136
4174
|
var import_mini18 = require("zod/mini");
|
|
4137
4175
|
var CopilotRuleFrontmatterSchema = import_mini18.z.object({
|
|
4138
4176
|
description: import_mini18.z.optional(import_mini18.z.string()),
|
|
@@ -4224,11 +4262,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4224
4262
|
validate = true
|
|
4225
4263
|
}) {
|
|
4226
4264
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
4227
|
-
const relativePath = isRoot ? (0,
|
|
4265
|
+
const relativePath = isRoot ? (0, import_node_path44.join)(
|
|
4228
4266
|
this.getSettablePaths().root.relativeDirPath,
|
|
4229
4267
|
this.getSettablePaths().root.relativeFilePath
|
|
4230
|
-
) : (0,
|
|
4231
|
-
const fileContent = await readFileContent((0,
|
|
4268
|
+
) : (0, import_node_path44.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4269
|
+
const fileContent = await readFileContent((0, import_node_path44.join)(baseDir, relativePath));
|
|
4232
4270
|
if (isRoot) {
|
|
4233
4271
|
return new _CopilotRule({
|
|
4234
4272
|
baseDir,
|
|
@@ -4247,7 +4285,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4247
4285
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
4248
4286
|
if (!result.success) {
|
|
4249
4287
|
throw new Error(
|
|
4250
|
-
`Invalid frontmatter in ${(0,
|
|
4288
|
+
`Invalid frontmatter in ${(0, import_node_path44.join)(baseDir, relativeFilePath)}: ${result.error.message}`
|
|
4251
4289
|
);
|
|
4252
4290
|
}
|
|
4253
4291
|
return new _CopilotRule({
|
|
@@ -4286,7 +4324,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4286
4324
|
};
|
|
4287
4325
|
|
|
4288
4326
|
// src/rules/cursor-rule.ts
|
|
4289
|
-
var
|
|
4327
|
+
var import_node_path45 = require("path");
|
|
4290
4328
|
var import_mini19 = require("zod/mini");
|
|
4291
4329
|
var CursorRuleFrontmatterSchema = import_mini19.z.object({
|
|
4292
4330
|
description: import_mini19.z.optional(import_mini19.z.string()),
|
|
@@ -4416,19 +4454,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
4416
4454
|
validate = true
|
|
4417
4455
|
}) {
|
|
4418
4456
|
const fileContent = await readFileContent(
|
|
4419
|
-
(0,
|
|
4457
|
+
(0, import_node_path45.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4420
4458
|
);
|
|
4421
4459
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
4422
4460
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
4423
4461
|
if (!result.success) {
|
|
4424
4462
|
throw new Error(
|
|
4425
|
-
`Invalid frontmatter in ${(0,
|
|
4463
|
+
`Invalid frontmatter in ${(0, import_node_path45.join)(baseDir, relativeFilePath)}: ${result.error.message}`
|
|
4426
4464
|
);
|
|
4427
4465
|
}
|
|
4428
4466
|
return new _CursorRule({
|
|
4429
4467
|
baseDir,
|
|
4430
4468
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
4431
|
-
relativeFilePath: (0,
|
|
4469
|
+
relativeFilePath: (0, import_node_path45.basename)(relativeFilePath),
|
|
4432
4470
|
frontmatter: result.data,
|
|
4433
4471
|
body: content.trim(),
|
|
4434
4472
|
validate
|
|
@@ -4460,7 +4498,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
4460
4498
|
};
|
|
4461
4499
|
|
|
4462
4500
|
// src/rules/geminicli-rule.ts
|
|
4463
|
-
var
|
|
4501
|
+
var import_node_path46 = require("path");
|
|
4464
4502
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
4465
4503
|
static getSettablePaths() {
|
|
4466
4504
|
return {
|
|
@@ -4479,8 +4517,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
4479
4517
|
validate = true
|
|
4480
4518
|
}) {
|
|
4481
4519
|
const isRoot = relativeFilePath === "GEMINI.md";
|
|
4482
|
-
const relativePath = isRoot ? "GEMINI.md" : (0,
|
|
4483
|
-
const fileContent = await readFileContent((0,
|
|
4520
|
+
const relativePath = isRoot ? "GEMINI.md" : (0, import_node_path46.join)(".gemini/memories", relativeFilePath);
|
|
4521
|
+
const fileContent = await readFileContent((0, import_node_path46.join)(baseDir, relativePath));
|
|
4484
4522
|
return new _GeminiCliRule({
|
|
4485
4523
|
baseDir,
|
|
4486
4524
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4520,7 +4558,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
4520
4558
|
};
|
|
4521
4559
|
|
|
4522
4560
|
// src/rules/junie-rule.ts
|
|
4523
|
-
var
|
|
4561
|
+
var import_node_path47 = require("path");
|
|
4524
4562
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
4525
4563
|
static getSettablePaths() {
|
|
4526
4564
|
return {
|
|
@@ -4539,8 +4577,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
4539
4577
|
validate = true
|
|
4540
4578
|
}) {
|
|
4541
4579
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
4542
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
4543
|
-
const fileContent = await readFileContent((0,
|
|
4580
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path47.join)(".junie/memories", relativeFilePath);
|
|
4581
|
+
const fileContent = await readFileContent((0, import_node_path47.join)(baseDir, relativePath));
|
|
4544
4582
|
return new _JunieRule({
|
|
4545
4583
|
baseDir,
|
|
4546
4584
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4580,7 +4618,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
4580
4618
|
};
|
|
4581
4619
|
|
|
4582
4620
|
// src/rules/kiro-rule.ts
|
|
4583
|
-
var
|
|
4621
|
+
var import_node_path48 = require("path");
|
|
4584
4622
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
4585
4623
|
static getSettablePaths() {
|
|
4586
4624
|
return {
|
|
@@ -4595,7 +4633,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
4595
4633
|
validate = true
|
|
4596
4634
|
}) {
|
|
4597
4635
|
const fileContent = await readFileContent(
|
|
4598
|
-
(0,
|
|
4636
|
+
(0, import_node_path48.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4599
4637
|
);
|
|
4600
4638
|
return new _KiroRule({
|
|
4601
4639
|
baseDir,
|
|
@@ -4635,7 +4673,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
4635
4673
|
};
|
|
4636
4674
|
|
|
4637
4675
|
// src/rules/opencode-rule.ts
|
|
4638
|
-
var
|
|
4676
|
+
var import_node_path49 = require("path");
|
|
4639
4677
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
4640
4678
|
static getSettablePaths() {
|
|
4641
4679
|
return {
|
|
@@ -4654,8 +4692,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
4654
4692
|
validate = true
|
|
4655
4693
|
}) {
|
|
4656
4694
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
4657
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
4658
|
-
const fileContent = await readFileContent((0,
|
|
4695
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path49.join)(".opencode/memories", relativeFilePath);
|
|
4696
|
+
const fileContent = await readFileContent((0, import_node_path49.join)(baseDir, relativePath));
|
|
4659
4697
|
return new _OpenCodeRule({
|
|
4660
4698
|
baseDir,
|
|
4661
4699
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4695,7 +4733,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
4695
4733
|
};
|
|
4696
4734
|
|
|
4697
4735
|
// src/rules/qwencode-rule.ts
|
|
4698
|
-
var
|
|
4736
|
+
var import_node_path50 = require("path");
|
|
4699
4737
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
4700
4738
|
static getSettablePaths() {
|
|
4701
4739
|
return {
|
|
@@ -4714,8 +4752,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
4714
4752
|
validate = true
|
|
4715
4753
|
}) {
|
|
4716
4754
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
4717
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
4718
|
-
const fileContent = await readFileContent((0,
|
|
4755
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path50.join)(".qwen/memories", relativeFilePath);
|
|
4756
|
+
const fileContent = await readFileContent((0, import_node_path50.join)(baseDir, relativePath));
|
|
4719
4757
|
return new _QwencodeRule({
|
|
4720
4758
|
baseDir,
|
|
4721
4759
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4752,7 +4790,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
4752
4790
|
};
|
|
4753
4791
|
|
|
4754
4792
|
// src/rules/roo-rule.ts
|
|
4755
|
-
var
|
|
4793
|
+
var import_node_path51 = require("path");
|
|
4756
4794
|
var RooRule = class _RooRule extends ToolRule {
|
|
4757
4795
|
static getSettablePaths() {
|
|
4758
4796
|
return {
|
|
@@ -4767,7 +4805,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
4767
4805
|
validate = true
|
|
4768
4806
|
}) {
|
|
4769
4807
|
const fileContent = await readFileContent(
|
|
4770
|
-
(0,
|
|
4808
|
+
(0, import_node_path51.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4771
4809
|
);
|
|
4772
4810
|
return new _RooRule({
|
|
4773
4811
|
baseDir,
|
|
@@ -4822,7 +4860,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
4822
4860
|
};
|
|
4823
4861
|
|
|
4824
4862
|
// src/rules/warp-rule.ts
|
|
4825
|
-
var
|
|
4863
|
+
var import_node_path52 = require("path");
|
|
4826
4864
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
4827
4865
|
constructor({ fileContent, root, ...rest }) {
|
|
4828
4866
|
super({
|
|
@@ -4848,8 +4886,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
4848
4886
|
validate = true
|
|
4849
4887
|
}) {
|
|
4850
4888
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
4851
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
4852
|
-
const fileContent = await readFileContent((0,
|
|
4889
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path52.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4890
|
+
const fileContent = await readFileContent((0, import_node_path52.join)(baseDir, relativePath));
|
|
4853
4891
|
return new _WarpRule({
|
|
4854
4892
|
baseDir,
|
|
4855
4893
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -4889,7 +4927,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
4889
4927
|
};
|
|
4890
4928
|
|
|
4891
4929
|
// src/rules/windsurf-rule.ts
|
|
4892
|
-
var
|
|
4930
|
+
var import_node_path53 = require("path");
|
|
4893
4931
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
4894
4932
|
static getSettablePaths() {
|
|
4895
4933
|
return {
|
|
@@ -4904,7 +4942,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
4904
4942
|
validate = true
|
|
4905
4943
|
}) {
|
|
4906
4944
|
const fileContent = await readFileContent(
|
|
4907
|
-
(0,
|
|
4945
|
+
(0, import_node_path53.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4908
4946
|
);
|
|
4909
4947
|
return new _WindsurfRule({
|
|
4910
4948
|
baseDir,
|
|
@@ -5283,17 +5321,17 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5283
5321
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
5284
5322
|
*/
|
|
5285
5323
|
async loadRulesyncFiles() {
|
|
5286
|
-
const files = await findFilesByGlobs((0,
|
|
5324
|
+
const files = await findFilesByGlobs((0, import_node_path54.join)(RULESYNC_RULES_DIR, "*.md"));
|
|
5287
5325
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
5288
5326
|
return Promise.all(
|
|
5289
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0,
|
|
5327
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path54.basename)(file) }))
|
|
5290
5328
|
);
|
|
5291
5329
|
}
|
|
5292
5330
|
async loadRulesyncFilesLegacy() {
|
|
5293
|
-
const legacyFiles = await findFilesByGlobs((0,
|
|
5331
|
+
const legacyFiles = await findFilesByGlobs((0, import_node_path54.join)(RULESYNC_RULES_DIR_LEGACY, "*.md"));
|
|
5294
5332
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
5295
5333
|
return Promise.all(
|
|
5296
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0,
|
|
5334
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path54.basename)(file) }))
|
|
5297
5335
|
);
|
|
5298
5336
|
}
|
|
5299
5337
|
/**
|
|
@@ -5354,13 +5392,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5354
5392
|
return [];
|
|
5355
5393
|
}
|
|
5356
5394
|
const rootFilePaths = await findFilesByGlobs(
|
|
5357
|
-
(0,
|
|
5395
|
+
(0, import_node_path54.join)(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
|
|
5358
5396
|
);
|
|
5359
5397
|
return await Promise.all(
|
|
5360
5398
|
rootFilePaths.map(
|
|
5361
5399
|
(filePath) => root.fromFile({
|
|
5362
5400
|
baseDir: this.baseDir,
|
|
5363
|
-
relativeFilePath: (0,
|
|
5401
|
+
relativeFilePath: (0, import_node_path54.basename)(filePath)
|
|
5364
5402
|
})
|
|
5365
5403
|
)
|
|
5366
5404
|
);
|
|
@@ -5371,13 +5409,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5371
5409
|
return [];
|
|
5372
5410
|
}
|
|
5373
5411
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
5374
|
-
(0,
|
|
5412
|
+
(0, import_node_path54.join)(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
|
|
5375
5413
|
);
|
|
5376
5414
|
return await Promise.all(
|
|
5377
5415
|
nonRootFilePaths.map(
|
|
5378
5416
|
(filePath) => nonRoot.fromFile({
|
|
5379
5417
|
baseDir: this.baseDir,
|
|
5380
|
-
relativeFilePath: (0,
|
|
5418
|
+
relativeFilePath: (0, import_node_path54.basename)(filePath)
|
|
5381
5419
|
})
|
|
5382
5420
|
)
|
|
5383
5421
|
);
|
|
@@ -5737,14 +5775,14 @@ s/<command> [arguments]
|
|
|
5737
5775
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
5738
5776
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
5739
5777
|
|
|
5740
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
5778
|
+
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.`;
|
|
5741
5779
|
const subagentsSection = `## Simulated Subagents
|
|
5742
5780
|
|
|
5743
5781
|
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.
|
|
5744
5782
|
|
|
5745
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
5783
|
+
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.
|
|
5746
5784
|
|
|
5747
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
5785
|
+
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.`;
|
|
5748
5786
|
const result = [
|
|
5749
5787
|
overview,
|
|
5750
5788
|
...this.simulateCommands && CommandsProcessor.getToolTargetsSimulated().includes(this.toolTarget) ? [commandsSection] : [],
|
|
@@ -5931,9 +5969,9 @@ async function generateCommand(options) {
|
|
|
5931
5969
|
}
|
|
5932
5970
|
|
|
5933
5971
|
// src/cli/commands/gitignore.ts
|
|
5934
|
-
var
|
|
5972
|
+
var import_node_path55 = require("path");
|
|
5935
5973
|
var gitignoreCommand = async () => {
|
|
5936
|
-
const gitignorePath = (0,
|
|
5974
|
+
const gitignorePath = (0, import_node_path55.join)(process.cwd(), ".gitignore");
|
|
5937
5975
|
const rulesFilesToIgnore = [
|
|
5938
5976
|
"# Generated by rulesync - AI tool configuration files",
|
|
5939
5977
|
"**/.amazonq/",
|
|
@@ -6123,7 +6161,7 @@ async function importCommand(options) {
|
|
|
6123
6161
|
}
|
|
6124
6162
|
|
|
6125
6163
|
// src/cli/commands/init.ts
|
|
6126
|
-
var
|
|
6164
|
+
var import_node_path56 = require("path");
|
|
6127
6165
|
async function initCommand() {
|
|
6128
6166
|
logger.info("Initializing rulesync...");
|
|
6129
6167
|
await ensureDir(RULESYNC_DIR);
|
|
@@ -6169,7 +6207,7 @@ globs: ["**/*"]
|
|
|
6169
6207
|
- Follow single responsibility principle
|
|
6170
6208
|
`
|
|
6171
6209
|
};
|
|
6172
|
-
const filepath = (0,
|
|
6210
|
+
const filepath = (0, import_node_path56.join)(RULESYNC_RULES_DIR, sampleFile.filename);
|
|
6173
6211
|
await ensureDir(RULESYNC_RULES_DIR);
|
|
6174
6212
|
await ensureDir(RulesyncCommand.getSettablePaths().relativeDirPath);
|
|
6175
6213
|
await ensureDir(RULESYNC_SUBAGENTS_DIR);
|
|
@@ -6188,15 +6226,15 @@ var getVersion = async () => {
|
|
|
6188
6226
|
let packageJsonPath;
|
|
6189
6227
|
if (typeof import_meta !== "undefined" && import_meta.url) {
|
|
6190
6228
|
const __filename = (0, import_node_url.fileURLToPath)(import_meta.url);
|
|
6191
|
-
const __dirname = (0,
|
|
6192
|
-
packageJsonPath = (0,
|
|
6229
|
+
const __dirname = (0, import_node_path57.join)(__filename, "..");
|
|
6230
|
+
packageJsonPath = (0, import_node_path57.join)(__dirname, "../../package.json");
|
|
6193
6231
|
} else {
|
|
6194
|
-
packageJsonPath = (0,
|
|
6232
|
+
packageJsonPath = (0, import_node_path57.join)(process.cwd(), "package.json");
|
|
6195
6233
|
}
|
|
6196
6234
|
const packageJson = await readJsonFile(packageJsonPath);
|
|
6197
6235
|
return packageJson.version;
|
|
6198
6236
|
} catch {
|
|
6199
|
-
return "0.
|
|
6237
|
+
return "0.80.0";
|
|
6200
6238
|
}
|
|
6201
6239
|
};
|
|
6202
6240
|
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
|
|
|
@@ -23,6 +23,7 @@ import { basename, dirname, join, relative, resolve } from "path";
|
|
|
23
23
|
|
|
24
24
|
// src/utils/logger.ts
|
|
25
25
|
import { consola } from "consola";
|
|
26
|
+
var isEnvTest = process.env.NODE_ENV === "test";
|
|
26
27
|
var Logger = class {
|
|
27
28
|
_verbose = false;
|
|
28
29
|
console = consola.withDefaults({
|
|
@@ -35,22 +36,27 @@ var Logger = class {
|
|
|
35
36
|
return this._verbose;
|
|
36
37
|
}
|
|
37
38
|
info(message, ...args) {
|
|
39
|
+
if (isEnvTest) return;
|
|
38
40
|
this.console.info(message, ...args);
|
|
39
41
|
}
|
|
40
42
|
// Success (always shown)
|
|
41
43
|
success(message, ...args) {
|
|
44
|
+
if (isEnvTest) return;
|
|
42
45
|
this.console.success(message, ...args);
|
|
43
46
|
}
|
|
44
47
|
// Warning (always shown)
|
|
45
48
|
warn(message, ...args) {
|
|
49
|
+
if (isEnvTest) return;
|
|
46
50
|
this.console.warn(message, ...args);
|
|
47
51
|
}
|
|
48
52
|
// Error (always shown)
|
|
49
53
|
error(message, ...args) {
|
|
54
|
+
if (isEnvTest) return;
|
|
50
55
|
this.console.error(message, ...args);
|
|
51
56
|
}
|
|
52
57
|
// Debug level (shown only in verbose mode)
|
|
53
58
|
debug(message, ...args) {
|
|
59
|
+
if (isEnvTest) return;
|
|
54
60
|
if (this._verbose) {
|
|
55
61
|
this.console.info(message, ...args);
|
|
56
62
|
}
|
|
@@ -2780,7 +2786,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
2780
2786
|
};
|
|
2781
2787
|
|
|
2782
2788
|
// src/rules/rules-processor.ts
|
|
2783
|
-
import { basename as basename16, join as
|
|
2789
|
+
import { basename as basename16, join as join53 } from "path";
|
|
2784
2790
|
import { XMLBuilder } from "fast-xml-parser";
|
|
2785
2791
|
import { z as z20 } from "zod/mini";
|
|
2786
2792
|
|
|
@@ -3480,6 +3486,9 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3480
3486
|
};
|
|
3481
3487
|
|
|
3482
3488
|
// src/rules/agentsmd-rule.ts
|
|
3489
|
+
import { join as join36 } from "path";
|
|
3490
|
+
|
|
3491
|
+
// src/rules/tool-rule.ts
|
|
3483
3492
|
import { join as join35 } from "path";
|
|
3484
3493
|
|
|
3485
3494
|
// src/rules/rulesync-rule.ts
|
|
@@ -3490,6 +3499,12 @@ var RulesyncRuleFrontmatterSchema = z16.object({
|
|
|
3490
3499
|
targets: z16.optional(RulesyncTargetsSchema),
|
|
3491
3500
|
description: z16.optional(z16.string()),
|
|
3492
3501
|
globs: z16.optional(z16.array(z16.string())),
|
|
3502
|
+
agentsmd: z16.optional(
|
|
3503
|
+
z16.object({
|
|
3504
|
+
// @example "path/to/subproject"
|
|
3505
|
+
subprojectPath: z16.optional(z16.string())
|
|
3506
|
+
})
|
|
3507
|
+
),
|
|
3493
3508
|
cursor: z16.optional(
|
|
3494
3509
|
z16.object({
|
|
3495
3510
|
alwaysApply: z16.optional(z16.boolean()),
|
|
@@ -3555,6 +3570,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
3555
3570
|
targets: result.data.targets ?? ["*"],
|
|
3556
3571
|
description: result.data.description ?? "",
|
|
3557
3572
|
globs: result.data.globs ?? [],
|
|
3573
|
+
agentsmd: result.data.agentsmd,
|
|
3558
3574
|
cursor: result.data.cursor
|
|
3559
3575
|
};
|
|
3560
3576
|
const filename = basename14(filePath);
|
|
@@ -3583,6 +3599,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
3583
3599
|
targets: result.data.targets ?? ["*"],
|
|
3584
3600
|
description: result.data.description ?? "",
|
|
3585
3601
|
globs: result.data.globs ?? [],
|
|
3602
|
+
agentsmd: result.data.agentsmd,
|
|
3586
3603
|
cursor: result.data.cursor
|
|
3587
3604
|
};
|
|
3588
3605
|
const filename = basename14(filePath);
|
|
@@ -3636,6 +3653,27 @@ var ToolRule = class extends ToolFile {
|
|
|
3636
3653
|
globs: rulesyncRule.getFrontmatter().globs
|
|
3637
3654
|
};
|
|
3638
3655
|
}
|
|
3656
|
+
static buildToolRuleParamsAgentsmd({
|
|
3657
|
+
baseDir = ".",
|
|
3658
|
+
rulesyncRule,
|
|
3659
|
+
validate = true,
|
|
3660
|
+
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
3661
|
+
nonRootPath = { relativeDirPath: ".agents/memories" }
|
|
3662
|
+
}) {
|
|
3663
|
+
const params = this.buildToolRuleParamsDefault({
|
|
3664
|
+
baseDir,
|
|
3665
|
+
rulesyncRule,
|
|
3666
|
+
validate,
|
|
3667
|
+
rootPath,
|
|
3668
|
+
nonRootPath
|
|
3669
|
+
});
|
|
3670
|
+
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
3671
|
+
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
3672
|
+
params.relativeDirPath = join35(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
3673
|
+
params.relativeFilePath = "AGENTS.md";
|
|
3674
|
+
}
|
|
3675
|
+
return params;
|
|
3676
|
+
}
|
|
3639
3677
|
toRulesyncRuleDefault() {
|
|
3640
3678
|
return new RulesyncRule({
|
|
3641
3679
|
baseDir: this.getBaseDir(),
|
|
@@ -3706,8 +3744,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
3706
3744
|
validate = true
|
|
3707
3745
|
}) {
|
|
3708
3746
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
3709
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
3710
|
-
const fileContent = await readFileContent(
|
|
3747
|
+
const relativePath = isRoot ? "AGENTS.md" : join36(".agents/memories", relativeFilePath);
|
|
3748
|
+
const fileContent = await readFileContent(join36(baseDir, relativePath));
|
|
3711
3749
|
return new _AgentsMdRule({
|
|
3712
3750
|
baseDir,
|
|
3713
3751
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -3723,7 +3761,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
3723
3761
|
validate = true
|
|
3724
3762
|
}) {
|
|
3725
3763
|
return new _AgentsMdRule(
|
|
3726
|
-
this.
|
|
3764
|
+
this.buildToolRuleParamsAgentsmd({
|
|
3727
3765
|
baseDir,
|
|
3728
3766
|
rulesyncRule,
|
|
3729
3767
|
validate,
|
|
@@ -3747,7 +3785,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
3747
3785
|
};
|
|
3748
3786
|
|
|
3749
3787
|
// src/rules/amazonqcli-rule.ts
|
|
3750
|
-
import { join as
|
|
3788
|
+
import { join as join37 } from "path";
|
|
3751
3789
|
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
3752
3790
|
static getSettablePaths() {
|
|
3753
3791
|
return {
|
|
@@ -3762,7 +3800,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
3762
3800
|
validate = true
|
|
3763
3801
|
}) {
|
|
3764
3802
|
const fileContent = await readFileContent(
|
|
3765
|
-
|
|
3803
|
+
join37(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
3766
3804
|
);
|
|
3767
3805
|
return new _AmazonQCliRule({
|
|
3768
3806
|
baseDir,
|
|
@@ -3802,7 +3840,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
3802
3840
|
};
|
|
3803
3841
|
|
|
3804
3842
|
// src/rules/augmentcode-legacy-rule.ts
|
|
3805
|
-
import { join as
|
|
3843
|
+
import { join as join38 } from "path";
|
|
3806
3844
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
3807
3845
|
toRulesyncRule() {
|
|
3808
3846
|
const rulesyncFrontmatter = {
|
|
@@ -3862,8 +3900,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
3862
3900
|
}) {
|
|
3863
3901
|
const settablePaths = this.getSettablePaths();
|
|
3864
3902
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
3865
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
3866
|
-
const fileContent = await readFileContent(
|
|
3903
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join38(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
3904
|
+
const fileContent = await readFileContent(join38(baseDir, relativePath));
|
|
3867
3905
|
return new _AugmentcodeLegacyRule({
|
|
3868
3906
|
baseDir,
|
|
3869
3907
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -3876,7 +3914,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
3876
3914
|
};
|
|
3877
3915
|
|
|
3878
3916
|
// src/rules/augmentcode-rule.ts
|
|
3879
|
-
import { join as
|
|
3917
|
+
import { join as join39 } from "path";
|
|
3880
3918
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
3881
3919
|
toRulesyncRule() {
|
|
3882
3920
|
return this.toRulesyncRuleDefault();
|
|
@@ -3908,7 +3946,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
3908
3946
|
validate = true
|
|
3909
3947
|
}) {
|
|
3910
3948
|
const fileContent = await readFileContent(
|
|
3911
|
-
|
|
3949
|
+
join39(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
3912
3950
|
);
|
|
3913
3951
|
const { body: content } = parseFrontmatter(fileContent);
|
|
3914
3952
|
return new _AugmentcodeRule({
|
|
@@ -3931,7 +3969,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
3931
3969
|
};
|
|
3932
3970
|
|
|
3933
3971
|
// src/rules/claudecode-rule.ts
|
|
3934
|
-
import { join as
|
|
3972
|
+
import { join as join40 } from "path";
|
|
3935
3973
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
3936
3974
|
static getSettablePaths() {
|
|
3937
3975
|
return {
|
|
@@ -3950,8 +3988,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
3950
3988
|
validate = true
|
|
3951
3989
|
}) {
|
|
3952
3990
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
3953
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
3954
|
-
const fileContent = await readFileContent(
|
|
3991
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join40(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
3992
|
+
const fileContent = await readFileContent(join40(baseDir, relativePath));
|
|
3955
3993
|
return new _ClaudecodeRule({
|
|
3956
3994
|
baseDir,
|
|
3957
3995
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -3991,7 +4029,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
3991
4029
|
};
|
|
3992
4030
|
|
|
3993
4031
|
// src/rules/cline-rule.ts
|
|
3994
|
-
import { join as
|
|
4032
|
+
import { join as join41 } from "path";
|
|
3995
4033
|
import { z as z17 } from "zod/mini";
|
|
3996
4034
|
var ClineRuleFrontmatterSchema = z17.object({
|
|
3997
4035
|
description: z17.string()
|
|
@@ -4036,7 +4074,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
4036
4074
|
validate = true
|
|
4037
4075
|
}) {
|
|
4038
4076
|
const fileContent = await readFileContent(
|
|
4039
|
-
|
|
4077
|
+
join41(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4040
4078
|
);
|
|
4041
4079
|
return new _ClineRule({
|
|
4042
4080
|
baseDir,
|
|
@@ -4049,7 +4087,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
4049
4087
|
};
|
|
4050
4088
|
|
|
4051
4089
|
// src/rules/codexcli-rule.ts
|
|
4052
|
-
import { join as
|
|
4090
|
+
import { join as join42 } from "path";
|
|
4053
4091
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
4054
4092
|
static getSettablePaths() {
|
|
4055
4093
|
return {
|
|
@@ -4068,8 +4106,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4068
4106
|
validate = true
|
|
4069
4107
|
}) {
|
|
4070
4108
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
4071
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
4072
|
-
const fileContent = await readFileContent(
|
|
4109
|
+
const relativePath = isRoot ? "AGENTS.md" : join42(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4110
|
+
const fileContent = await readFileContent(join42(baseDir, relativePath));
|
|
4073
4111
|
return new _CodexcliRule({
|
|
4074
4112
|
baseDir,
|
|
4075
4113
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4085,7 +4123,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4085
4123
|
validate = true
|
|
4086
4124
|
}) {
|
|
4087
4125
|
return new _CodexcliRule(
|
|
4088
|
-
this.
|
|
4126
|
+
this.buildToolRuleParamsAgentsmd({
|
|
4089
4127
|
baseDir,
|
|
4090
4128
|
rulesyncRule,
|
|
4091
4129
|
validate,
|
|
@@ -4109,7 +4147,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4109
4147
|
};
|
|
4110
4148
|
|
|
4111
4149
|
// src/rules/copilot-rule.ts
|
|
4112
|
-
import { join as
|
|
4150
|
+
import { join as join43 } from "path";
|
|
4113
4151
|
import { z as z18 } from "zod/mini";
|
|
4114
4152
|
var CopilotRuleFrontmatterSchema = z18.object({
|
|
4115
4153
|
description: z18.optional(z18.string()),
|
|
@@ -4201,11 +4239,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4201
4239
|
validate = true
|
|
4202
4240
|
}) {
|
|
4203
4241
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
4204
|
-
const relativePath = isRoot ?
|
|
4242
|
+
const relativePath = isRoot ? join43(
|
|
4205
4243
|
this.getSettablePaths().root.relativeDirPath,
|
|
4206
4244
|
this.getSettablePaths().root.relativeFilePath
|
|
4207
|
-
) :
|
|
4208
|
-
const fileContent = await readFileContent(
|
|
4245
|
+
) : join43(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4246
|
+
const fileContent = await readFileContent(join43(baseDir, relativePath));
|
|
4209
4247
|
if (isRoot) {
|
|
4210
4248
|
return new _CopilotRule({
|
|
4211
4249
|
baseDir,
|
|
@@ -4224,7 +4262,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4224
4262
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
4225
4263
|
if (!result.success) {
|
|
4226
4264
|
throw new Error(
|
|
4227
|
-
`Invalid frontmatter in ${
|
|
4265
|
+
`Invalid frontmatter in ${join43(baseDir, relativeFilePath)}: ${result.error.message}`
|
|
4228
4266
|
);
|
|
4229
4267
|
}
|
|
4230
4268
|
return new _CopilotRule({
|
|
@@ -4263,7 +4301,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4263
4301
|
};
|
|
4264
4302
|
|
|
4265
4303
|
// src/rules/cursor-rule.ts
|
|
4266
|
-
import { basename as basename15, join as
|
|
4304
|
+
import { basename as basename15, join as join44 } from "path";
|
|
4267
4305
|
import { z as z19 } from "zod/mini";
|
|
4268
4306
|
var CursorRuleFrontmatterSchema = z19.object({
|
|
4269
4307
|
description: z19.optional(z19.string()),
|
|
@@ -4393,13 +4431,13 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
4393
4431
|
validate = true
|
|
4394
4432
|
}) {
|
|
4395
4433
|
const fileContent = await readFileContent(
|
|
4396
|
-
|
|
4434
|
+
join44(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4397
4435
|
);
|
|
4398
4436
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
4399
4437
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
4400
4438
|
if (!result.success) {
|
|
4401
4439
|
throw new Error(
|
|
4402
|
-
`Invalid frontmatter in ${
|
|
4440
|
+
`Invalid frontmatter in ${join44(baseDir, relativeFilePath)}: ${result.error.message}`
|
|
4403
4441
|
);
|
|
4404
4442
|
}
|
|
4405
4443
|
return new _CursorRule({
|
|
@@ -4437,7 +4475,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
4437
4475
|
};
|
|
4438
4476
|
|
|
4439
4477
|
// src/rules/geminicli-rule.ts
|
|
4440
|
-
import { join as
|
|
4478
|
+
import { join as join45 } from "path";
|
|
4441
4479
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
4442
4480
|
static getSettablePaths() {
|
|
4443
4481
|
return {
|
|
@@ -4456,8 +4494,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
4456
4494
|
validate = true
|
|
4457
4495
|
}) {
|
|
4458
4496
|
const isRoot = relativeFilePath === "GEMINI.md";
|
|
4459
|
-
const relativePath = isRoot ? "GEMINI.md" :
|
|
4460
|
-
const fileContent = await readFileContent(
|
|
4497
|
+
const relativePath = isRoot ? "GEMINI.md" : join45(".gemini/memories", relativeFilePath);
|
|
4498
|
+
const fileContent = await readFileContent(join45(baseDir, relativePath));
|
|
4461
4499
|
return new _GeminiCliRule({
|
|
4462
4500
|
baseDir,
|
|
4463
4501
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4497,7 +4535,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
4497
4535
|
};
|
|
4498
4536
|
|
|
4499
4537
|
// src/rules/junie-rule.ts
|
|
4500
|
-
import { join as
|
|
4538
|
+
import { join as join46 } from "path";
|
|
4501
4539
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
4502
4540
|
static getSettablePaths() {
|
|
4503
4541
|
return {
|
|
@@ -4516,8 +4554,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
4516
4554
|
validate = true
|
|
4517
4555
|
}) {
|
|
4518
4556
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
4519
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
4520
|
-
const fileContent = await readFileContent(
|
|
4557
|
+
const relativePath = isRoot ? "guidelines.md" : join46(".junie/memories", relativeFilePath);
|
|
4558
|
+
const fileContent = await readFileContent(join46(baseDir, relativePath));
|
|
4521
4559
|
return new _JunieRule({
|
|
4522
4560
|
baseDir,
|
|
4523
4561
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4557,7 +4595,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
4557
4595
|
};
|
|
4558
4596
|
|
|
4559
4597
|
// src/rules/kiro-rule.ts
|
|
4560
|
-
import { join as
|
|
4598
|
+
import { join as join47 } from "path";
|
|
4561
4599
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
4562
4600
|
static getSettablePaths() {
|
|
4563
4601
|
return {
|
|
@@ -4572,7 +4610,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
4572
4610
|
validate = true
|
|
4573
4611
|
}) {
|
|
4574
4612
|
const fileContent = await readFileContent(
|
|
4575
|
-
|
|
4613
|
+
join47(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4576
4614
|
);
|
|
4577
4615
|
return new _KiroRule({
|
|
4578
4616
|
baseDir,
|
|
@@ -4612,7 +4650,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
4612
4650
|
};
|
|
4613
4651
|
|
|
4614
4652
|
// src/rules/opencode-rule.ts
|
|
4615
|
-
import { join as
|
|
4653
|
+
import { join as join48 } from "path";
|
|
4616
4654
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
4617
4655
|
static getSettablePaths() {
|
|
4618
4656
|
return {
|
|
@@ -4631,8 +4669,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
4631
4669
|
validate = true
|
|
4632
4670
|
}) {
|
|
4633
4671
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
4634
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
4635
|
-
const fileContent = await readFileContent(
|
|
4672
|
+
const relativePath = isRoot ? "AGENTS.md" : join48(".opencode/memories", relativeFilePath);
|
|
4673
|
+
const fileContent = await readFileContent(join48(baseDir, relativePath));
|
|
4636
4674
|
return new _OpenCodeRule({
|
|
4637
4675
|
baseDir,
|
|
4638
4676
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4672,7 +4710,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
4672
4710
|
};
|
|
4673
4711
|
|
|
4674
4712
|
// src/rules/qwencode-rule.ts
|
|
4675
|
-
import { join as
|
|
4713
|
+
import { join as join49 } from "path";
|
|
4676
4714
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
4677
4715
|
static getSettablePaths() {
|
|
4678
4716
|
return {
|
|
@@ -4691,8 +4729,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
4691
4729
|
validate = true
|
|
4692
4730
|
}) {
|
|
4693
4731
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
4694
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
4695
|
-
const fileContent = await readFileContent(
|
|
4732
|
+
const relativePath = isRoot ? "QWEN.md" : join49(".qwen/memories", relativeFilePath);
|
|
4733
|
+
const fileContent = await readFileContent(join49(baseDir, relativePath));
|
|
4696
4734
|
return new _QwencodeRule({
|
|
4697
4735
|
baseDir,
|
|
4698
4736
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4729,7 +4767,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
4729
4767
|
};
|
|
4730
4768
|
|
|
4731
4769
|
// src/rules/roo-rule.ts
|
|
4732
|
-
import { join as
|
|
4770
|
+
import { join as join50 } from "path";
|
|
4733
4771
|
var RooRule = class _RooRule extends ToolRule {
|
|
4734
4772
|
static getSettablePaths() {
|
|
4735
4773
|
return {
|
|
@@ -4744,7 +4782,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
4744
4782
|
validate = true
|
|
4745
4783
|
}) {
|
|
4746
4784
|
const fileContent = await readFileContent(
|
|
4747
|
-
|
|
4785
|
+
join50(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4748
4786
|
);
|
|
4749
4787
|
return new _RooRule({
|
|
4750
4788
|
baseDir,
|
|
@@ -4799,7 +4837,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
4799
4837
|
};
|
|
4800
4838
|
|
|
4801
4839
|
// src/rules/warp-rule.ts
|
|
4802
|
-
import { join as
|
|
4840
|
+
import { join as join51 } from "path";
|
|
4803
4841
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
4804
4842
|
constructor({ fileContent, root, ...rest }) {
|
|
4805
4843
|
super({
|
|
@@ -4825,8 +4863,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
4825
4863
|
validate = true
|
|
4826
4864
|
}) {
|
|
4827
4865
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
4828
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
4829
|
-
const fileContent = await readFileContent(
|
|
4866
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join51(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4867
|
+
const fileContent = await readFileContent(join51(baseDir, relativePath));
|
|
4830
4868
|
return new _WarpRule({
|
|
4831
4869
|
baseDir,
|
|
4832
4870
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -4866,7 +4904,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
4866
4904
|
};
|
|
4867
4905
|
|
|
4868
4906
|
// src/rules/windsurf-rule.ts
|
|
4869
|
-
import { join as
|
|
4907
|
+
import { join as join52 } from "path";
|
|
4870
4908
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
4871
4909
|
static getSettablePaths() {
|
|
4872
4910
|
return {
|
|
@@ -4881,7 +4919,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
4881
4919
|
validate = true
|
|
4882
4920
|
}) {
|
|
4883
4921
|
const fileContent = await readFileContent(
|
|
4884
|
-
|
|
4922
|
+
join52(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4885
4923
|
);
|
|
4886
4924
|
return new _WindsurfRule({
|
|
4887
4925
|
baseDir,
|
|
@@ -5260,14 +5298,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5260
5298
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
5261
5299
|
*/
|
|
5262
5300
|
async loadRulesyncFiles() {
|
|
5263
|
-
const files = await findFilesByGlobs(
|
|
5301
|
+
const files = await findFilesByGlobs(join53(RULESYNC_RULES_DIR, "*.md"));
|
|
5264
5302
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
5265
5303
|
return Promise.all(
|
|
5266
5304
|
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename16(file) }))
|
|
5267
5305
|
);
|
|
5268
5306
|
}
|
|
5269
5307
|
async loadRulesyncFilesLegacy() {
|
|
5270
|
-
const legacyFiles = await findFilesByGlobs(
|
|
5308
|
+
const legacyFiles = await findFilesByGlobs(join53(RULESYNC_RULES_DIR_LEGACY, "*.md"));
|
|
5271
5309
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
5272
5310
|
return Promise.all(
|
|
5273
5311
|
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename16(file) }))
|
|
@@ -5331,7 +5369,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5331
5369
|
return [];
|
|
5332
5370
|
}
|
|
5333
5371
|
const rootFilePaths = await findFilesByGlobs(
|
|
5334
|
-
|
|
5372
|
+
join53(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
|
|
5335
5373
|
);
|
|
5336
5374
|
return await Promise.all(
|
|
5337
5375
|
rootFilePaths.map(
|
|
@@ -5348,7 +5386,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5348
5386
|
return [];
|
|
5349
5387
|
}
|
|
5350
5388
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
5351
|
-
|
|
5389
|
+
join53(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
|
|
5352
5390
|
);
|
|
5353
5391
|
return await Promise.all(
|
|
5354
5392
|
nonRootFilePaths.map(
|
|
@@ -5714,14 +5752,14 @@ s/<command> [arguments]
|
|
|
5714
5752
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
5715
5753
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
5716
5754
|
|
|
5717
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
5755
|
+
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.`;
|
|
5718
5756
|
const subagentsSection = `## Simulated Subagents
|
|
5719
5757
|
|
|
5720
5758
|
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.
|
|
5721
5759
|
|
|
5722
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
5760
|
+
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.
|
|
5723
5761
|
|
|
5724
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
5762
|
+
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.`;
|
|
5725
5763
|
const result = [
|
|
5726
5764
|
overview,
|
|
5727
5765
|
...this.simulateCommands && CommandsProcessor.getToolTargetsSimulated().includes(this.toolTarget) ? [commandsSection] : [],
|
|
@@ -5908,9 +5946,9 @@ async function generateCommand(options) {
|
|
|
5908
5946
|
}
|
|
5909
5947
|
|
|
5910
5948
|
// src/cli/commands/gitignore.ts
|
|
5911
|
-
import { join as
|
|
5949
|
+
import { join as join54 } from "path";
|
|
5912
5950
|
var gitignoreCommand = async () => {
|
|
5913
|
-
const gitignorePath =
|
|
5951
|
+
const gitignorePath = join54(process.cwd(), ".gitignore");
|
|
5914
5952
|
const rulesFilesToIgnore = [
|
|
5915
5953
|
"# Generated by rulesync - AI tool configuration files",
|
|
5916
5954
|
"**/.amazonq/",
|
|
@@ -6100,7 +6138,7 @@ async function importCommand(options) {
|
|
|
6100
6138
|
}
|
|
6101
6139
|
|
|
6102
6140
|
// src/cli/commands/init.ts
|
|
6103
|
-
import { join as
|
|
6141
|
+
import { join as join55 } from "path";
|
|
6104
6142
|
async function initCommand() {
|
|
6105
6143
|
logger.info("Initializing rulesync...");
|
|
6106
6144
|
await ensureDir(RULESYNC_DIR);
|
|
@@ -6146,7 +6184,7 @@ globs: ["**/*"]
|
|
|
6146
6184
|
- Follow single responsibility principle
|
|
6147
6185
|
`
|
|
6148
6186
|
};
|
|
6149
|
-
const filepath =
|
|
6187
|
+
const filepath = join55(RULESYNC_RULES_DIR, sampleFile.filename);
|
|
6150
6188
|
await ensureDir(RULESYNC_RULES_DIR);
|
|
6151
6189
|
await ensureDir(RulesyncCommand.getSettablePaths().relativeDirPath);
|
|
6152
6190
|
await ensureDir(RULESYNC_SUBAGENTS_DIR);
|
|
@@ -6164,15 +6202,15 @@ var getVersion = async () => {
|
|
|
6164
6202
|
let packageJsonPath;
|
|
6165
6203
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
6166
6204
|
const __filename = fileURLToPath(import.meta.url);
|
|
6167
|
-
const __dirname =
|
|
6168
|
-
packageJsonPath =
|
|
6205
|
+
const __dirname = join56(__filename, "..");
|
|
6206
|
+
packageJsonPath = join56(__dirname, "../../package.json");
|
|
6169
6207
|
} else {
|
|
6170
|
-
packageJsonPath =
|
|
6208
|
+
packageJsonPath = join56(process.cwd(), "package.json");
|
|
6171
6209
|
}
|
|
6172
6210
|
const packageJson = await readJsonFile(packageJsonPath);
|
|
6173
6211
|
return packageJson.version;
|
|
6174
6212
|
} catch {
|
|
6175
|
-
return "0.
|
|
6213
|
+
return "0.80.0";
|
|
6176
6214
|
}
|
|
6177
6215
|
};
|
|
6178
6216
|
var main = async () => {
|