rulesync 7.24.0 → 7.25.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/dist/{chunk-A4FZT3JT.js → chunk-XGT6BGPR.js} +91 -86
- package/dist/cli/index.cjs +100 -88
- package/dist/cli/index.js +12 -3
- package/dist/index.cjs +90 -86
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -137,6 +137,9 @@ async function readOrInitializeFileContent(filePath, initialContent = "") {
|
|
|
137
137
|
return initialContent;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
+
function toPosixPath(p) {
|
|
141
|
+
return p.replace(/\\/g, "/");
|
|
142
|
+
}
|
|
140
143
|
function checkPathTraversal({
|
|
141
144
|
relativePath,
|
|
142
145
|
intendedRootDir
|
|
@@ -944,8 +947,11 @@ var AiFile = class {
|
|
|
944
947
|
getFileContent() {
|
|
945
948
|
return this.fileContent;
|
|
946
949
|
}
|
|
950
|
+
/**
|
|
951
|
+
* Returns the relative path from CWD with POSIX separators for consistent cross-platform output.
|
|
952
|
+
*/
|
|
947
953
|
getRelativePathFromCwd() {
|
|
948
|
-
return path.join(this.relativeDirPath, this.relativeFilePath)
|
|
954
|
+
return toPosixPath(path.join(this.relativeDirPath, this.relativeFilePath));
|
|
949
955
|
}
|
|
950
956
|
setFileContent(newFileContent) {
|
|
951
957
|
this.fileContent = newFileContent;
|
|
@@ -6740,11 +6746,13 @@ function addTypeField(mcpServers) {
|
|
|
6740
6746
|
command = cmd;
|
|
6741
6747
|
args = cmdArgs.length > 0 ? [...cmdArgs, ...parsed.args ?? []] : parsed.args;
|
|
6742
6748
|
}
|
|
6749
|
+
const serverRecord = server;
|
|
6743
6750
|
result[name] = {
|
|
6744
|
-
|
|
6751
|
+
...serverRecord,
|
|
6752
|
+
...parsed,
|
|
6753
|
+
type: parsed.type ?? "stdio",
|
|
6745
6754
|
command,
|
|
6746
|
-
...args && { args }
|
|
6747
|
-
...parsed.env && { env: parsed.env }
|
|
6755
|
+
...args && { args }
|
|
6748
6756
|
};
|
|
6749
6757
|
}
|
|
6750
6758
|
return result;
|
|
@@ -8396,8 +8404,11 @@ var AiDir = class {
|
|
|
8396
8404
|
getOtherFiles() {
|
|
8397
8405
|
return this.otherFiles;
|
|
8398
8406
|
}
|
|
8407
|
+
/**
|
|
8408
|
+
* Returns the relative path from CWD with POSIX separators for consistent cross-platform output.
|
|
8409
|
+
*/
|
|
8399
8410
|
getRelativePathFromCwd() {
|
|
8400
|
-
return path2.join(this.relativeDirPath, this.dirName)
|
|
8411
|
+
return toPosixPath(path2.join(this.relativeDirPath, this.dirName));
|
|
8401
8412
|
}
|
|
8402
8413
|
getGlobal() {
|
|
8403
8414
|
return this.global;
|
|
@@ -16940,7 +16951,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
16940
16951
|
|
|
16941
16952
|
// src/features/rules/rovodev-rule.ts
|
|
16942
16953
|
import { join as join123 } from "path";
|
|
16943
|
-
var DISALLOWED_ROVODEV_MODULAR_RULE_BASENAMES = /* @__PURE__ */ new Set(["
|
|
16954
|
+
var DISALLOWED_ROVODEV_MODULAR_RULE_BASENAMES = /* @__PURE__ */ new Set(["agents.md", "agents.local.md"]);
|
|
16944
16955
|
var RovodevRule = class _RovodevRule extends ToolRule {
|
|
16945
16956
|
/**
|
|
16946
16957
|
* Whether `relativePath` (posix-style path relative to modular-rules root) may be imported as a modular rule.
|
|
@@ -16954,7 +16965,7 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
16954
16965
|
if (segment === "" || segment === "." || segment === "..") {
|
|
16955
16966
|
continue;
|
|
16956
16967
|
}
|
|
16957
|
-
if (DISALLOWED_ROVODEV_MODULAR_RULE_BASENAMES.has(segment)) {
|
|
16968
|
+
if (DISALLOWED_ROVODEV_MODULAR_RULE_BASENAMES.has(segment.toLowerCase())) {
|
|
16958
16969
|
return false;
|
|
16959
16970
|
}
|
|
16960
16971
|
}
|
|
@@ -16996,22 +17007,54 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
16996
17007
|
}) {
|
|
16997
17008
|
const paths = this.getSettablePaths({ global });
|
|
16998
17009
|
if (!global && "nonRoot" in paths && paths.nonRoot && overrideDirPath === paths.nonRoot.relativeDirPath) {
|
|
16999
|
-
|
|
17000
|
-
throw new Error(
|
|
17001
|
-
`Reserved Rovodev memory basename under modular-rules (not a modular rule): ${join123(overrideDirPath, relativeFilePath)}`
|
|
17002
|
-
);
|
|
17003
|
-
}
|
|
17004
|
-
const fileContent2 = await readFileContent(join123(baseDir, overrideDirPath, relativeFilePath));
|
|
17005
|
-
return new _RovodevRule({
|
|
17010
|
+
return this.fromModularFile({
|
|
17006
17011
|
baseDir,
|
|
17007
|
-
relativeDirPath: overrideDirPath,
|
|
17008
17012
|
relativeFilePath,
|
|
17009
|
-
|
|
17013
|
+
relativeDirPath: overrideDirPath,
|
|
17010
17014
|
validate,
|
|
17011
|
-
global
|
|
17012
|
-
root: false
|
|
17015
|
+
global
|
|
17013
17016
|
});
|
|
17014
17017
|
}
|
|
17018
|
+
return this.fromRootFile({
|
|
17019
|
+
baseDir,
|
|
17020
|
+
relativeFilePath,
|
|
17021
|
+
overrideDirPath,
|
|
17022
|
+
validate,
|
|
17023
|
+
global,
|
|
17024
|
+
paths
|
|
17025
|
+
});
|
|
17026
|
+
}
|
|
17027
|
+
static async fromModularFile({
|
|
17028
|
+
baseDir,
|
|
17029
|
+
relativeFilePath,
|
|
17030
|
+
relativeDirPath,
|
|
17031
|
+
validate,
|
|
17032
|
+
global
|
|
17033
|
+
}) {
|
|
17034
|
+
if (!this.isAllowedModularRulesRelativePath(relativeFilePath)) {
|
|
17035
|
+
throw new Error(
|
|
17036
|
+
`Reserved Rovodev memory basename under modular-rules (not a modular rule): ${join123(relativeDirPath, relativeFilePath)}`
|
|
17037
|
+
);
|
|
17038
|
+
}
|
|
17039
|
+
const fileContent = await readFileContent(join123(baseDir, relativeDirPath, relativeFilePath));
|
|
17040
|
+
return new _RovodevRule({
|
|
17041
|
+
baseDir,
|
|
17042
|
+
relativeDirPath,
|
|
17043
|
+
relativeFilePath,
|
|
17044
|
+
fileContent,
|
|
17045
|
+
validate,
|
|
17046
|
+
global,
|
|
17047
|
+
root: false
|
|
17048
|
+
});
|
|
17049
|
+
}
|
|
17050
|
+
static async fromRootFile({
|
|
17051
|
+
baseDir,
|
|
17052
|
+
relativeFilePath,
|
|
17053
|
+
overrideDirPath,
|
|
17054
|
+
validate,
|
|
17055
|
+
global,
|
|
17056
|
+
paths
|
|
17057
|
+
}) {
|
|
17015
17058
|
const relativeDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
17016
17059
|
const agentsMdExpectedLocationsDescription = "alternativeRoots" in paths && paths.alternativeRoots && paths.alternativeRoots.length > 0 ? `${join123(paths.root.relativeDirPath, paths.root.relativeFilePath)} or project root` : join123(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
17017
17060
|
if (relativeFilePath !== "AGENTS.md") {
|
|
@@ -17942,6 +17985,24 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
17942
17985
|
const dirName = dirname3(relative5(this.baseDir, filePath));
|
|
17943
17986
|
return dirName === "" ? "." : dirName;
|
|
17944
17987
|
};
|
|
17988
|
+
const buildDeletionRulesFromPaths = (filePaths, opts) => {
|
|
17989
|
+
const isNonRoot = opts !== void 0;
|
|
17990
|
+
const effectiveBaseDir = isNonRoot ? opts.baseDirOverride : this.baseDir;
|
|
17991
|
+
return filePaths.map((filePath) => {
|
|
17992
|
+
const relativeDirPath = isNonRoot ? opts.relativeDirPathOverride : resolveRelativeDirPath(filePath);
|
|
17993
|
+
const relativeFilePath = isNonRoot ? relative5(effectiveBaseDir, filePath) : basename10(filePath);
|
|
17994
|
+
checkPathTraversal({
|
|
17995
|
+
relativePath: isNonRoot ? relativeFilePath : relativeDirPath,
|
|
17996
|
+
intendedRootDir: effectiveBaseDir
|
|
17997
|
+
});
|
|
17998
|
+
return factory.class.forDeletion({
|
|
17999
|
+
baseDir: this.baseDir,
|
|
18000
|
+
relativeDirPath,
|
|
18001
|
+
relativeFilePath,
|
|
18002
|
+
global: this.global
|
|
18003
|
+
});
|
|
18004
|
+
}).filter((rule) => rule.isDeletable());
|
|
18005
|
+
};
|
|
17945
18006
|
const findFilesWithFallback = async (primaryGlob, alternativeRoots, buildAltGlob) => {
|
|
17946
18007
|
const primaryFilePaths = await findFilesByGlobs(primaryGlob);
|
|
17947
18008
|
if (primaryFilePaths.length > 0) {
|
|
@@ -17966,19 +18027,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
17966
18027
|
(alt) => join126(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
|
|
17967
18028
|
);
|
|
17968
18029
|
if (forDeletion) {
|
|
17969
|
-
return uniqueRootFilePaths
|
|
17970
|
-
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
17971
|
-
checkPathTraversal({
|
|
17972
|
-
relativePath: relativeDirPath,
|
|
17973
|
-
intendedRootDir: this.baseDir
|
|
17974
|
-
});
|
|
17975
|
-
return factory.class.forDeletion({
|
|
17976
|
-
baseDir: this.baseDir,
|
|
17977
|
-
relativeDirPath,
|
|
17978
|
-
relativeFilePath: basename10(filePath),
|
|
17979
|
-
global: this.global
|
|
17980
|
-
});
|
|
17981
|
-
}).filter((rule) => rule.isDeletable());
|
|
18030
|
+
return buildDeletionRulesFromPaths(uniqueRootFilePaths);
|
|
17982
18031
|
}
|
|
17983
18032
|
return await Promise.all(
|
|
17984
18033
|
uniqueRootFilePaths.map((filePath) => {
|
|
@@ -18008,19 +18057,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18008
18057
|
const uniqueLocalRootFilePaths2 = await findFilesByGlobs(
|
|
18009
18058
|
join126(this.baseDir, "AGENTS.local.md")
|
|
18010
18059
|
);
|
|
18011
|
-
return uniqueLocalRootFilePaths2
|
|
18012
|
-
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
18013
|
-
checkPathTraversal({
|
|
18014
|
-
relativePath: relativeDirPath,
|
|
18015
|
-
intendedRootDir: this.baseDir
|
|
18016
|
-
});
|
|
18017
|
-
return factory.class.forDeletion({
|
|
18018
|
-
baseDir: this.baseDir,
|
|
18019
|
-
relativeDirPath,
|
|
18020
|
-
relativeFilePath: basename10(filePath),
|
|
18021
|
-
global: this.global
|
|
18022
|
-
});
|
|
18023
|
-
}).filter((rule) => rule.isDeletable());
|
|
18060
|
+
return buildDeletionRulesFromPaths(uniqueLocalRootFilePaths2);
|
|
18024
18061
|
}
|
|
18025
18062
|
if (this.toolTarget !== "claudecode" && this.toolTarget !== "claudecode-legacy") {
|
|
18026
18063
|
return [];
|
|
@@ -18033,19 +18070,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18033
18070
|
settablePaths.alternativeRoots,
|
|
18034
18071
|
(alt) => join126(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
|
|
18035
18072
|
);
|
|
18036
|
-
return uniqueLocalRootFilePaths
|
|
18037
|
-
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
18038
|
-
checkPathTraversal({
|
|
18039
|
-
relativePath: relativeDirPath,
|
|
18040
|
-
intendedRootDir: this.baseDir
|
|
18041
|
-
});
|
|
18042
|
-
return factory.class.forDeletion({
|
|
18043
|
-
baseDir: this.baseDir,
|
|
18044
|
-
relativeDirPath,
|
|
18045
|
-
relativeFilePath: basename10(filePath),
|
|
18046
|
-
global: this.global
|
|
18047
|
-
});
|
|
18048
|
-
}).filter((rule) => rule.isDeletable());
|
|
18073
|
+
return buildDeletionRulesFromPaths(uniqueLocalRootFilePaths);
|
|
18049
18074
|
})();
|
|
18050
18075
|
this.logger.debug(
|
|
18051
18076
|
`Found ${localRootToolRules.length} local root tool rule files for deletion`
|
|
@@ -18059,19 +18084,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18059
18084
|
return [];
|
|
18060
18085
|
}
|
|
18061
18086
|
const mirrorPaths = await findFilesByGlobs(join126(this.baseDir, "AGENTS.md"));
|
|
18062
|
-
return mirrorPaths
|
|
18063
|
-
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
18064
|
-
checkPathTraversal({
|
|
18065
|
-
relativePath: relativeDirPath,
|
|
18066
|
-
intendedRootDir: this.baseDir
|
|
18067
|
-
});
|
|
18068
|
-
return factory.class.forDeletion({
|
|
18069
|
-
baseDir: this.baseDir,
|
|
18070
|
-
relativeDirPath,
|
|
18071
|
-
relativeFilePath: basename10(filePath),
|
|
18072
|
-
global: this.global
|
|
18073
|
-
});
|
|
18074
|
-
}).filter((rule) => rule.isDeletable());
|
|
18087
|
+
return buildDeletionRulesFromPaths(mirrorPaths);
|
|
18075
18088
|
})();
|
|
18076
18089
|
const nonRootToolRules = await (async () => {
|
|
18077
18090
|
if (!settablePaths.nonRoot) {
|
|
@@ -18081,8 +18094,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18081
18094
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
18082
18095
|
join126(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
18083
18096
|
);
|
|
18097
|
+
if (forDeletion) {
|
|
18098
|
+
return buildDeletionRulesFromPaths(nonRootFilePaths, {
|
|
18099
|
+
baseDirOverride: nonRootBaseDir,
|
|
18100
|
+
relativeDirPathOverride: settablePaths.nonRoot.relativeDirPath
|
|
18101
|
+
});
|
|
18102
|
+
}
|
|
18084
18103
|
const modularRootRelative = settablePaths.nonRoot.relativeDirPath;
|
|
18085
|
-
const nonRootPathsForImport =
|
|
18104
|
+
const nonRootPathsForImport = this.toolTarget === "rovodev" ? nonRootFilePaths.filter((filePath) => {
|
|
18086
18105
|
const relativeFilePath = relative5(nonRootBaseDir, filePath);
|
|
18087
18106
|
const ok = RovodevRule.isAllowedModularRulesRelativePath(relativeFilePath);
|
|
18088
18107
|
if (!ok) {
|
|
@@ -18092,21 +18111,6 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18092
18111
|
}
|
|
18093
18112
|
return ok;
|
|
18094
18113
|
}) : nonRootFilePaths;
|
|
18095
|
-
if (forDeletion) {
|
|
18096
|
-
return nonRootFilePaths.map((filePath) => {
|
|
18097
|
-
const relativeFilePath = relative5(nonRootBaseDir, filePath);
|
|
18098
|
-
checkPathTraversal({
|
|
18099
|
-
relativePath: relativeFilePath,
|
|
18100
|
-
intendedRootDir: nonRootBaseDir
|
|
18101
|
-
});
|
|
18102
|
-
return factory.class.forDeletion({
|
|
18103
|
-
baseDir: this.baseDir,
|
|
18104
|
-
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
18105
|
-
relativeFilePath,
|
|
18106
|
-
global: this.global
|
|
18107
|
-
});
|
|
18108
|
-
}).filter((rule) => rule.isDeletable());
|
|
18109
|
-
}
|
|
18110
18114
|
return await Promise.all(
|
|
18111
18115
|
nonRootPathsForImport.map((filePath) => {
|
|
18112
18116
|
const relativeFilePath = relative5(nonRootBaseDir, filePath);
|
|
@@ -19093,6 +19097,7 @@ export {
|
|
|
19093
19097
|
FETCH_CONCURRENCY_LIMIT,
|
|
19094
19098
|
formatError,
|
|
19095
19099
|
ensureDir,
|
|
19100
|
+
toPosixPath,
|
|
19096
19101
|
checkPathTraversal,
|
|
19097
19102
|
directoryExists,
|
|
19098
19103
|
readFileContent,
|
package/dist/cli/index.cjs
CHANGED
|
@@ -143,6 +143,9 @@ async function readOrInitializeFileContent(filePath, initialContent = "") {
|
|
|
143
143
|
return initialContent;
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
+
function toPosixPath(p) {
|
|
147
|
+
return p.replace(/\\/g, "/");
|
|
148
|
+
}
|
|
146
149
|
function checkPathTraversal({
|
|
147
150
|
relativePath,
|
|
148
151
|
intendedRootDir
|
|
@@ -617,8 +620,11 @@ var AiFile = class {
|
|
|
617
620
|
getFileContent() {
|
|
618
621
|
return this.fileContent;
|
|
619
622
|
}
|
|
623
|
+
/**
|
|
624
|
+
* Returns the relative path from CWD with POSIX separators for consistent cross-platform output.
|
|
625
|
+
*/
|
|
620
626
|
getRelativePathFromCwd() {
|
|
621
|
-
return import_node_path4.default.join(this.relativeDirPath, this.relativeFilePath)
|
|
627
|
+
return toPosixPath(import_node_path4.default.join(this.relativeDirPath, this.relativeFilePath));
|
|
622
628
|
}
|
|
623
629
|
setFileContent(newFileContent) {
|
|
624
630
|
this.fileContent = newFileContent;
|
|
@@ -6449,11 +6455,13 @@ function addTypeField(mcpServers) {
|
|
|
6449
6455
|
command = cmd;
|
|
6450
6456
|
args = cmdArgs.length > 0 ? [...cmdArgs, ...parsed.args ?? []] : parsed.args;
|
|
6451
6457
|
}
|
|
6458
|
+
const serverRecord = server;
|
|
6452
6459
|
result[name] = {
|
|
6453
|
-
|
|
6460
|
+
...serverRecord,
|
|
6461
|
+
...parsed,
|
|
6462
|
+
type: parsed.type ?? "stdio",
|
|
6454
6463
|
command,
|
|
6455
|
-
...args && { args }
|
|
6456
|
-
...parsed.env && { env: parsed.env }
|
|
6464
|
+
...args && { args }
|
|
6457
6465
|
};
|
|
6458
6466
|
}
|
|
6459
6467
|
return result;
|
|
@@ -8105,8 +8113,11 @@ var AiDir = class {
|
|
|
8105
8113
|
getOtherFiles() {
|
|
8106
8114
|
return this.otherFiles;
|
|
8107
8115
|
}
|
|
8116
|
+
/**
|
|
8117
|
+
* Returns the relative path from CWD with POSIX separators for consistent cross-platform output.
|
|
8118
|
+
*/
|
|
8108
8119
|
getRelativePathFromCwd() {
|
|
8109
|
-
return import_node_path60.default.join(this.relativeDirPath, this.dirName)
|
|
8120
|
+
return toPosixPath(import_node_path60.default.join(this.relativeDirPath, this.dirName));
|
|
8110
8121
|
}
|
|
8111
8122
|
getGlobal() {
|
|
8112
8123
|
return this.global;
|
|
@@ -16649,7 +16660,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
16649
16660
|
|
|
16650
16661
|
// src/features/rules/rovodev-rule.ts
|
|
16651
16662
|
var import_node_path124 = require("path");
|
|
16652
|
-
var DISALLOWED_ROVODEV_MODULAR_RULE_BASENAMES = /* @__PURE__ */ new Set(["
|
|
16663
|
+
var DISALLOWED_ROVODEV_MODULAR_RULE_BASENAMES = /* @__PURE__ */ new Set(["agents.md", "agents.local.md"]);
|
|
16653
16664
|
var RovodevRule = class _RovodevRule extends ToolRule {
|
|
16654
16665
|
/**
|
|
16655
16666
|
* Whether `relativePath` (posix-style path relative to modular-rules root) may be imported as a modular rule.
|
|
@@ -16663,7 +16674,7 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
16663
16674
|
if (segment === "" || segment === "." || segment === "..") {
|
|
16664
16675
|
continue;
|
|
16665
16676
|
}
|
|
16666
|
-
if (DISALLOWED_ROVODEV_MODULAR_RULE_BASENAMES.has(segment)) {
|
|
16677
|
+
if (DISALLOWED_ROVODEV_MODULAR_RULE_BASENAMES.has(segment.toLowerCase())) {
|
|
16667
16678
|
return false;
|
|
16668
16679
|
}
|
|
16669
16680
|
}
|
|
@@ -16705,22 +16716,54 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
16705
16716
|
}) {
|
|
16706
16717
|
const paths = this.getSettablePaths({ global });
|
|
16707
16718
|
if (!global && "nonRoot" in paths && paths.nonRoot && overrideDirPath === paths.nonRoot.relativeDirPath) {
|
|
16708
|
-
|
|
16709
|
-
throw new Error(
|
|
16710
|
-
`Reserved Rovodev memory basename under modular-rules (not a modular rule): ${(0, import_node_path124.join)(overrideDirPath, relativeFilePath)}`
|
|
16711
|
-
);
|
|
16712
|
-
}
|
|
16713
|
-
const fileContent2 = await readFileContent((0, import_node_path124.join)(baseDir, overrideDirPath, relativeFilePath));
|
|
16714
|
-
return new _RovodevRule({
|
|
16719
|
+
return this.fromModularFile({
|
|
16715
16720
|
baseDir,
|
|
16716
|
-
relativeDirPath: overrideDirPath,
|
|
16717
16721
|
relativeFilePath,
|
|
16718
|
-
|
|
16722
|
+
relativeDirPath: overrideDirPath,
|
|
16719
16723
|
validate,
|
|
16720
|
-
global
|
|
16721
|
-
root: false
|
|
16724
|
+
global
|
|
16722
16725
|
});
|
|
16723
16726
|
}
|
|
16727
|
+
return this.fromRootFile({
|
|
16728
|
+
baseDir,
|
|
16729
|
+
relativeFilePath,
|
|
16730
|
+
overrideDirPath,
|
|
16731
|
+
validate,
|
|
16732
|
+
global,
|
|
16733
|
+
paths
|
|
16734
|
+
});
|
|
16735
|
+
}
|
|
16736
|
+
static async fromModularFile({
|
|
16737
|
+
baseDir,
|
|
16738
|
+
relativeFilePath,
|
|
16739
|
+
relativeDirPath,
|
|
16740
|
+
validate,
|
|
16741
|
+
global
|
|
16742
|
+
}) {
|
|
16743
|
+
if (!this.isAllowedModularRulesRelativePath(relativeFilePath)) {
|
|
16744
|
+
throw new Error(
|
|
16745
|
+
`Reserved Rovodev memory basename under modular-rules (not a modular rule): ${(0, import_node_path124.join)(relativeDirPath, relativeFilePath)}`
|
|
16746
|
+
);
|
|
16747
|
+
}
|
|
16748
|
+
const fileContent = await readFileContent((0, import_node_path124.join)(baseDir, relativeDirPath, relativeFilePath));
|
|
16749
|
+
return new _RovodevRule({
|
|
16750
|
+
baseDir,
|
|
16751
|
+
relativeDirPath,
|
|
16752
|
+
relativeFilePath,
|
|
16753
|
+
fileContent,
|
|
16754
|
+
validate,
|
|
16755
|
+
global,
|
|
16756
|
+
root: false
|
|
16757
|
+
});
|
|
16758
|
+
}
|
|
16759
|
+
static async fromRootFile({
|
|
16760
|
+
baseDir,
|
|
16761
|
+
relativeFilePath,
|
|
16762
|
+
overrideDirPath,
|
|
16763
|
+
validate,
|
|
16764
|
+
global,
|
|
16765
|
+
paths
|
|
16766
|
+
}) {
|
|
16724
16767
|
const relativeDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
16725
16768
|
const agentsMdExpectedLocationsDescription = "alternativeRoots" in paths && paths.alternativeRoots && paths.alternativeRoots.length > 0 ? `${(0, import_node_path124.join)(paths.root.relativeDirPath, paths.root.relativeFilePath)} or project root` : (0, import_node_path124.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
16726
16769
|
if (relativeFilePath !== "AGENTS.md") {
|
|
@@ -17651,6 +17694,24 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
17651
17694
|
const dirName = (0, import_node_path127.dirname)((0, import_node_path127.relative)(this.baseDir, filePath));
|
|
17652
17695
|
return dirName === "" ? "." : dirName;
|
|
17653
17696
|
};
|
|
17697
|
+
const buildDeletionRulesFromPaths = (filePaths, opts) => {
|
|
17698
|
+
const isNonRoot = opts !== void 0;
|
|
17699
|
+
const effectiveBaseDir = isNonRoot ? opts.baseDirOverride : this.baseDir;
|
|
17700
|
+
return filePaths.map((filePath) => {
|
|
17701
|
+
const relativeDirPath = isNonRoot ? opts.relativeDirPathOverride : resolveRelativeDirPath(filePath);
|
|
17702
|
+
const relativeFilePath = isNonRoot ? (0, import_node_path127.relative)(effectiveBaseDir, filePath) : (0, import_node_path127.basename)(filePath);
|
|
17703
|
+
checkPathTraversal({
|
|
17704
|
+
relativePath: isNonRoot ? relativeFilePath : relativeDirPath,
|
|
17705
|
+
intendedRootDir: effectiveBaseDir
|
|
17706
|
+
});
|
|
17707
|
+
return factory.class.forDeletion({
|
|
17708
|
+
baseDir: this.baseDir,
|
|
17709
|
+
relativeDirPath,
|
|
17710
|
+
relativeFilePath,
|
|
17711
|
+
global: this.global
|
|
17712
|
+
});
|
|
17713
|
+
}).filter((rule) => rule.isDeletable());
|
|
17714
|
+
};
|
|
17654
17715
|
const findFilesWithFallback = async (primaryGlob, alternativeRoots, buildAltGlob) => {
|
|
17655
17716
|
const primaryFilePaths = await findFilesByGlobs(primaryGlob);
|
|
17656
17717
|
if (primaryFilePaths.length > 0) {
|
|
@@ -17675,19 +17736,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
17675
17736
|
(alt) => (0, import_node_path127.join)(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
|
|
17676
17737
|
);
|
|
17677
17738
|
if (forDeletion) {
|
|
17678
|
-
return uniqueRootFilePaths
|
|
17679
|
-
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
17680
|
-
checkPathTraversal({
|
|
17681
|
-
relativePath: relativeDirPath,
|
|
17682
|
-
intendedRootDir: this.baseDir
|
|
17683
|
-
});
|
|
17684
|
-
return factory.class.forDeletion({
|
|
17685
|
-
baseDir: this.baseDir,
|
|
17686
|
-
relativeDirPath,
|
|
17687
|
-
relativeFilePath: (0, import_node_path127.basename)(filePath),
|
|
17688
|
-
global: this.global
|
|
17689
|
-
});
|
|
17690
|
-
}).filter((rule) => rule.isDeletable());
|
|
17739
|
+
return buildDeletionRulesFromPaths(uniqueRootFilePaths);
|
|
17691
17740
|
}
|
|
17692
17741
|
return await Promise.all(
|
|
17693
17742
|
uniqueRootFilePaths.map((filePath) => {
|
|
@@ -17717,19 +17766,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
17717
17766
|
const uniqueLocalRootFilePaths2 = await findFilesByGlobs(
|
|
17718
17767
|
(0, import_node_path127.join)(this.baseDir, "AGENTS.local.md")
|
|
17719
17768
|
);
|
|
17720
|
-
return uniqueLocalRootFilePaths2
|
|
17721
|
-
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
17722
|
-
checkPathTraversal({
|
|
17723
|
-
relativePath: relativeDirPath,
|
|
17724
|
-
intendedRootDir: this.baseDir
|
|
17725
|
-
});
|
|
17726
|
-
return factory.class.forDeletion({
|
|
17727
|
-
baseDir: this.baseDir,
|
|
17728
|
-
relativeDirPath,
|
|
17729
|
-
relativeFilePath: (0, import_node_path127.basename)(filePath),
|
|
17730
|
-
global: this.global
|
|
17731
|
-
});
|
|
17732
|
-
}).filter((rule) => rule.isDeletable());
|
|
17769
|
+
return buildDeletionRulesFromPaths(uniqueLocalRootFilePaths2);
|
|
17733
17770
|
}
|
|
17734
17771
|
if (this.toolTarget !== "claudecode" && this.toolTarget !== "claudecode-legacy") {
|
|
17735
17772
|
return [];
|
|
@@ -17742,19 +17779,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
17742
17779
|
settablePaths.alternativeRoots,
|
|
17743
17780
|
(alt) => (0, import_node_path127.join)(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
|
|
17744
17781
|
);
|
|
17745
|
-
return uniqueLocalRootFilePaths
|
|
17746
|
-
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
17747
|
-
checkPathTraversal({
|
|
17748
|
-
relativePath: relativeDirPath,
|
|
17749
|
-
intendedRootDir: this.baseDir
|
|
17750
|
-
});
|
|
17751
|
-
return factory.class.forDeletion({
|
|
17752
|
-
baseDir: this.baseDir,
|
|
17753
|
-
relativeDirPath,
|
|
17754
|
-
relativeFilePath: (0, import_node_path127.basename)(filePath),
|
|
17755
|
-
global: this.global
|
|
17756
|
-
});
|
|
17757
|
-
}).filter((rule) => rule.isDeletable());
|
|
17782
|
+
return buildDeletionRulesFromPaths(uniqueLocalRootFilePaths);
|
|
17758
17783
|
})();
|
|
17759
17784
|
this.logger.debug(
|
|
17760
17785
|
`Found ${localRootToolRules.length} local root tool rule files for deletion`
|
|
@@ -17768,19 +17793,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
17768
17793
|
return [];
|
|
17769
17794
|
}
|
|
17770
17795
|
const mirrorPaths = await findFilesByGlobs((0, import_node_path127.join)(this.baseDir, "AGENTS.md"));
|
|
17771
|
-
return mirrorPaths
|
|
17772
|
-
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
17773
|
-
checkPathTraversal({
|
|
17774
|
-
relativePath: relativeDirPath,
|
|
17775
|
-
intendedRootDir: this.baseDir
|
|
17776
|
-
});
|
|
17777
|
-
return factory.class.forDeletion({
|
|
17778
|
-
baseDir: this.baseDir,
|
|
17779
|
-
relativeDirPath,
|
|
17780
|
-
relativeFilePath: (0, import_node_path127.basename)(filePath),
|
|
17781
|
-
global: this.global
|
|
17782
|
-
});
|
|
17783
|
-
}).filter((rule) => rule.isDeletable());
|
|
17796
|
+
return buildDeletionRulesFromPaths(mirrorPaths);
|
|
17784
17797
|
})();
|
|
17785
17798
|
const nonRootToolRules = await (async () => {
|
|
17786
17799
|
if (!settablePaths.nonRoot) {
|
|
@@ -17790,8 +17803,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
17790
17803
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
17791
17804
|
(0, import_node_path127.join)(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
17792
17805
|
);
|
|
17806
|
+
if (forDeletion) {
|
|
17807
|
+
return buildDeletionRulesFromPaths(nonRootFilePaths, {
|
|
17808
|
+
baseDirOverride: nonRootBaseDir,
|
|
17809
|
+
relativeDirPathOverride: settablePaths.nonRoot.relativeDirPath
|
|
17810
|
+
});
|
|
17811
|
+
}
|
|
17793
17812
|
const modularRootRelative = settablePaths.nonRoot.relativeDirPath;
|
|
17794
|
-
const nonRootPathsForImport =
|
|
17813
|
+
const nonRootPathsForImport = this.toolTarget === "rovodev" ? nonRootFilePaths.filter((filePath) => {
|
|
17795
17814
|
const relativeFilePath = (0, import_node_path127.relative)(nonRootBaseDir, filePath);
|
|
17796
17815
|
const ok = RovodevRule.isAllowedModularRulesRelativePath(relativeFilePath);
|
|
17797
17816
|
if (!ok) {
|
|
@@ -17801,21 +17820,6 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
17801
17820
|
}
|
|
17802
17821
|
return ok;
|
|
17803
17822
|
}) : nonRootFilePaths;
|
|
17804
|
-
if (forDeletion) {
|
|
17805
|
-
return nonRootFilePaths.map((filePath) => {
|
|
17806
|
-
const relativeFilePath = (0, import_node_path127.relative)(nonRootBaseDir, filePath);
|
|
17807
|
-
checkPathTraversal({
|
|
17808
|
-
relativePath: relativeFilePath,
|
|
17809
|
-
intendedRootDir: nonRootBaseDir
|
|
17810
|
-
});
|
|
17811
|
-
return factory.class.forDeletion({
|
|
17812
|
-
baseDir: this.baseDir,
|
|
17813
|
-
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
17814
|
-
relativeFilePath,
|
|
17815
|
-
global: this.global
|
|
17816
|
-
});
|
|
17817
|
-
}).filter((rule) => rule.isDeletable());
|
|
17818
|
-
}
|
|
17819
17823
|
return await Promise.all(
|
|
17820
17824
|
nonRootPathsForImport.map((filePath) => {
|
|
17821
17825
|
const relativeFilePath = (0, import_node_path127.relative)(nonRootBaseDir, filePath);
|
|
@@ -18541,7 +18545,7 @@ async function fetchFiles(params) {
|
|
|
18541
18545
|
);
|
|
18542
18546
|
}
|
|
18543
18547
|
const resolvedRef = options.ref ?? parsed.ref;
|
|
18544
|
-
const resolvedPath = options.path ?? parsed.path ?? ".";
|
|
18548
|
+
const resolvedPath = toPosixPath(options.path ?? parsed.path ?? ".");
|
|
18545
18549
|
const outputDir = options.output ?? RULESYNC_RELATIVE_DIR_PATH;
|
|
18546
18550
|
const conflictStrategy = options.conflict ?? "overwrite";
|
|
18547
18551
|
const enabledFeatures = resolveFeatures(options.features);
|
|
@@ -19808,6 +19812,9 @@ var GITIGNORE_ENTRY_REGISTRY = [
|
|
|
19808
19812
|
{ target: "common", feature: "general", entry: ".rulesync/rules/*.local.md" },
|
|
19809
19813
|
{ target: "common", feature: "general", entry: "rulesync.local.jsonc" },
|
|
19810
19814
|
{ target: "common", feature: "general", entry: "!.rulesync/.aiignore" },
|
|
19815
|
+
// AGENTS.local.md is placed in common scope (not rovodev-only) so that
|
|
19816
|
+
// local rule files are always gitignored regardless of which targets are enabled.
|
|
19817
|
+
// This prevents accidental commits when a user disables the rovodev target.
|
|
19811
19818
|
{ target: "common", feature: "general", entry: "**/AGENTS.local.md" },
|
|
19812
19819
|
// AGENTS.md
|
|
19813
19820
|
{ target: "agentsmd", feature: "rules", entry: "**/AGENTS.md" },
|
|
@@ -19956,6 +19963,11 @@ var GITIGNORE_ENTRY_REGISTRY = [
|
|
|
19956
19963
|
},
|
|
19957
19964
|
{ target: "rovodev", feature: "subagents", entry: "**/.rovodev/subagents/" },
|
|
19958
19965
|
{ target: "rovodev", feature: "skills", entry: "**/.rovodev/skills/" },
|
|
19966
|
+
{
|
|
19967
|
+
target: "rovodev",
|
|
19968
|
+
feature: "general",
|
|
19969
|
+
entry: "**/.rovodev/.rulesync/"
|
|
19970
|
+
},
|
|
19959
19971
|
{ target: "rovodev", feature: "skills", entry: "**/.agents/skills/" },
|
|
19960
19972
|
// Warp
|
|
19961
19973
|
{ target: "warp", feature: "rules", entry: "**/.warp/" },
|
|
@@ -23451,7 +23463,7 @@ function wrapCommand({
|
|
|
23451
23463
|
}
|
|
23452
23464
|
|
|
23453
23465
|
// src/cli/index.ts
|
|
23454
|
-
var getVersion = () => "7.
|
|
23466
|
+
var getVersion = () => "7.25.0";
|
|
23455
23467
|
function wrapCommand2(name, errorCode, handler) {
|
|
23456
23468
|
return wrapCommand({ name, errorCode, handler, getVersion });
|
|
23457
23469
|
}
|
package/dist/cli/index.js
CHANGED
|
@@ -69,8 +69,9 @@ import {
|
|
|
69
69
|
removeFile,
|
|
70
70
|
removeTempDirectory,
|
|
71
71
|
stringifyFrontmatter,
|
|
72
|
+
toPosixPath,
|
|
72
73
|
writeFileContent
|
|
73
|
-
} from "../chunk-
|
|
74
|
+
} from "../chunk-XGT6BGPR.js";
|
|
74
75
|
|
|
75
76
|
// src/cli/index.ts
|
|
76
77
|
import { Command } from "commander";
|
|
@@ -652,7 +653,7 @@ async function fetchFiles(params) {
|
|
|
652
653
|
);
|
|
653
654
|
}
|
|
654
655
|
const resolvedRef = options.ref ?? parsed.ref;
|
|
655
|
-
const resolvedPath = options.path ?? parsed.path ?? ".";
|
|
656
|
+
const resolvedPath = toPosixPath(options.path ?? parsed.path ?? ".");
|
|
656
657
|
const outputDir = options.output ?? RULESYNC_RELATIVE_DIR_PATH;
|
|
657
658
|
const conflictStrategy = options.conflict ?? "overwrite";
|
|
658
659
|
const enabledFeatures = resolveFeatures(options.features);
|
|
@@ -1158,6 +1159,9 @@ var GITIGNORE_ENTRY_REGISTRY = [
|
|
|
1158
1159
|
{ target: "common", feature: "general", entry: ".rulesync/rules/*.local.md" },
|
|
1159
1160
|
{ target: "common", feature: "general", entry: "rulesync.local.jsonc" },
|
|
1160
1161
|
{ target: "common", feature: "general", entry: "!.rulesync/.aiignore" },
|
|
1162
|
+
// AGENTS.local.md is placed in common scope (not rovodev-only) so that
|
|
1163
|
+
// local rule files are always gitignored regardless of which targets are enabled.
|
|
1164
|
+
// This prevents accidental commits when a user disables the rovodev target.
|
|
1161
1165
|
{ target: "common", feature: "general", entry: "**/AGENTS.local.md" },
|
|
1162
1166
|
// AGENTS.md
|
|
1163
1167
|
{ target: "agentsmd", feature: "rules", entry: "**/AGENTS.md" },
|
|
@@ -1306,6 +1310,11 @@ var GITIGNORE_ENTRY_REGISTRY = [
|
|
|
1306
1310
|
},
|
|
1307
1311
|
{ target: "rovodev", feature: "subagents", entry: "**/.rovodev/subagents/" },
|
|
1308
1312
|
{ target: "rovodev", feature: "skills", entry: "**/.rovodev/skills/" },
|
|
1313
|
+
{
|
|
1314
|
+
target: "rovodev",
|
|
1315
|
+
feature: "general",
|
|
1316
|
+
entry: "**/.rovodev/.rulesync/"
|
|
1317
|
+
},
|
|
1309
1318
|
{ target: "rovodev", feature: "skills", entry: "**/.agents/skills/" },
|
|
1310
1319
|
// Warp
|
|
1311
1320
|
{ target: "warp", feature: "rules", entry: "**/.warp/" },
|
|
@@ -4429,7 +4438,7 @@ function wrapCommand({
|
|
|
4429
4438
|
}
|
|
4430
4439
|
|
|
4431
4440
|
// src/cli/index.ts
|
|
4432
|
-
var getVersion = () => "7.
|
|
4441
|
+
var getVersion = () => "7.25.0";
|
|
4433
4442
|
function wrapCommand2(name, errorCode, handler) {
|
|
4434
4443
|
return wrapCommand({ name, errorCode, handler, getVersion });
|
|
4435
4444
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -115,6 +115,9 @@ async function readOrInitializeFileContent(filePath, initialContent = "") {
|
|
|
115
115
|
return initialContent;
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
+
function toPosixPath(p) {
|
|
119
|
+
return p.replace(/\\/g, "/");
|
|
120
|
+
}
|
|
118
121
|
function checkPathTraversal({
|
|
119
122
|
relativePath,
|
|
120
123
|
intendedRootDir
|
|
@@ -951,8 +954,11 @@ var AiFile = class {
|
|
|
951
954
|
getFileContent() {
|
|
952
955
|
return this.fileContent;
|
|
953
956
|
}
|
|
957
|
+
/**
|
|
958
|
+
* Returns the relative path from CWD with POSIX separators for consistent cross-platform output.
|
|
959
|
+
*/
|
|
954
960
|
getRelativePathFromCwd() {
|
|
955
|
-
return import_node_path6.default.join(this.relativeDirPath, this.relativeFilePath)
|
|
961
|
+
return toPosixPath(import_node_path6.default.join(this.relativeDirPath, this.relativeFilePath));
|
|
956
962
|
}
|
|
957
963
|
setFileContent(newFileContent) {
|
|
958
964
|
this.fileContent = newFileContent;
|
|
@@ -6747,11 +6753,13 @@ function addTypeField(mcpServers) {
|
|
|
6747
6753
|
command = cmd;
|
|
6748
6754
|
args = cmdArgs.length > 0 ? [...cmdArgs, ...parsed.args ?? []] : parsed.args;
|
|
6749
6755
|
}
|
|
6756
|
+
const serverRecord = server;
|
|
6750
6757
|
result[name] = {
|
|
6751
|
-
|
|
6758
|
+
...serverRecord,
|
|
6759
|
+
...parsed,
|
|
6760
|
+
type: parsed.type ?? "stdio",
|
|
6752
6761
|
command,
|
|
6753
|
-
...args && { args }
|
|
6754
|
-
...parsed.env && { env: parsed.env }
|
|
6762
|
+
...args && { args }
|
|
6755
6763
|
};
|
|
6756
6764
|
}
|
|
6757
6765
|
return result;
|
|
@@ -8403,8 +8411,11 @@ var AiDir = class {
|
|
|
8403
8411
|
getOtherFiles() {
|
|
8404
8412
|
return this.otherFiles;
|
|
8405
8413
|
}
|
|
8414
|
+
/**
|
|
8415
|
+
* Returns the relative path from CWD with POSIX separators for consistent cross-platform output.
|
|
8416
|
+
*/
|
|
8406
8417
|
getRelativePathFromCwd() {
|
|
8407
|
-
return import_node_path62.default.join(this.relativeDirPath, this.dirName)
|
|
8418
|
+
return toPosixPath(import_node_path62.default.join(this.relativeDirPath, this.dirName));
|
|
8408
8419
|
}
|
|
8409
8420
|
getGlobal() {
|
|
8410
8421
|
return this.global;
|
|
@@ -16947,7 +16958,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
16947
16958
|
|
|
16948
16959
|
// src/features/rules/rovodev-rule.ts
|
|
16949
16960
|
var import_node_path126 = require("path");
|
|
16950
|
-
var DISALLOWED_ROVODEV_MODULAR_RULE_BASENAMES = /* @__PURE__ */ new Set(["
|
|
16961
|
+
var DISALLOWED_ROVODEV_MODULAR_RULE_BASENAMES = /* @__PURE__ */ new Set(["agents.md", "agents.local.md"]);
|
|
16951
16962
|
var RovodevRule = class _RovodevRule extends ToolRule {
|
|
16952
16963
|
/**
|
|
16953
16964
|
* Whether `relativePath` (posix-style path relative to modular-rules root) may be imported as a modular rule.
|
|
@@ -16961,7 +16972,7 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
16961
16972
|
if (segment === "" || segment === "." || segment === "..") {
|
|
16962
16973
|
continue;
|
|
16963
16974
|
}
|
|
16964
|
-
if (DISALLOWED_ROVODEV_MODULAR_RULE_BASENAMES.has(segment)) {
|
|
16975
|
+
if (DISALLOWED_ROVODEV_MODULAR_RULE_BASENAMES.has(segment.toLowerCase())) {
|
|
16965
16976
|
return false;
|
|
16966
16977
|
}
|
|
16967
16978
|
}
|
|
@@ -17003,22 +17014,54 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
17003
17014
|
}) {
|
|
17004
17015
|
const paths = this.getSettablePaths({ global });
|
|
17005
17016
|
if (!global && "nonRoot" in paths && paths.nonRoot && overrideDirPath === paths.nonRoot.relativeDirPath) {
|
|
17006
|
-
|
|
17007
|
-
throw new Error(
|
|
17008
|
-
`Reserved Rovodev memory basename under modular-rules (not a modular rule): ${(0, import_node_path126.join)(overrideDirPath, relativeFilePath)}`
|
|
17009
|
-
);
|
|
17010
|
-
}
|
|
17011
|
-
const fileContent2 = await readFileContent((0, import_node_path126.join)(baseDir, overrideDirPath, relativeFilePath));
|
|
17012
|
-
return new _RovodevRule({
|
|
17017
|
+
return this.fromModularFile({
|
|
17013
17018
|
baseDir,
|
|
17014
|
-
relativeDirPath: overrideDirPath,
|
|
17015
17019
|
relativeFilePath,
|
|
17016
|
-
|
|
17020
|
+
relativeDirPath: overrideDirPath,
|
|
17017
17021
|
validate,
|
|
17018
|
-
global
|
|
17019
|
-
root: false
|
|
17022
|
+
global
|
|
17020
17023
|
});
|
|
17021
17024
|
}
|
|
17025
|
+
return this.fromRootFile({
|
|
17026
|
+
baseDir,
|
|
17027
|
+
relativeFilePath,
|
|
17028
|
+
overrideDirPath,
|
|
17029
|
+
validate,
|
|
17030
|
+
global,
|
|
17031
|
+
paths
|
|
17032
|
+
});
|
|
17033
|
+
}
|
|
17034
|
+
static async fromModularFile({
|
|
17035
|
+
baseDir,
|
|
17036
|
+
relativeFilePath,
|
|
17037
|
+
relativeDirPath,
|
|
17038
|
+
validate,
|
|
17039
|
+
global
|
|
17040
|
+
}) {
|
|
17041
|
+
if (!this.isAllowedModularRulesRelativePath(relativeFilePath)) {
|
|
17042
|
+
throw new Error(
|
|
17043
|
+
`Reserved Rovodev memory basename under modular-rules (not a modular rule): ${(0, import_node_path126.join)(relativeDirPath, relativeFilePath)}`
|
|
17044
|
+
);
|
|
17045
|
+
}
|
|
17046
|
+
const fileContent = await readFileContent((0, import_node_path126.join)(baseDir, relativeDirPath, relativeFilePath));
|
|
17047
|
+
return new _RovodevRule({
|
|
17048
|
+
baseDir,
|
|
17049
|
+
relativeDirPath,
|
|
17050
|
+
relativeFilePath,
|
|
17051
|
+
fileContent,
|
|
17052
|
+
validate,
|
|
17053
|
+
global,
|
|
17054
|
+
root: false
|
|
17055
|
+
});
|
|
17056
|
+
}
|
|
17057
|
+
static async fromRootFile({
|
|
17058
|
+
baseDir,
|
|
17059
|
+
relativeFilePath,
|
|
17060
|
+
overrideDirPath,
|
|
17061
|
+
validate,
|
|
17062
|
+
global,
|
|
17063
|
+
paths
|
|
17064
|
+
}) {
|
|
17022
17065
|
const relativeDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
17023
17066
|
const agentsMdExpectedLocationsDescription = "alternativeRoots" in paths && paths.alternativeRoots && paths.alternativeRoots.length > 0 ? `${(0, import_node_path126.join)(paths.root.relativeDirPath, paths.root.relativeFilePath)} or project root` : (0, import_node_path126.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
17024
17067
|
if (relativeFilePath !== "AGENTS.md") {
|
|
@@ -17949,6 +17992,24 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
17949
17992
|
const dirName = (0, import_node_path129.dirname)((0, import_node_path129.relative)(this.baseDir, filePath));
|
|
17950
17993
|
return dirName === "" ? "." : dirName;
|
|
17951
17994
|
};
|
|
17995
|
+
const buildDeletionRulesFromPaths = (filePaths, opts) => {
|
|
17996
|
+
const isNonRoot = opts !== void 0;
|
|
17997
|
+
const effectiveBaseDir = isNonRoot ? opts.baseDirOverride : this.baseDir;
|
|
17998
|
+
return filePaths.map((filePath) => {
|
|
17999
|
+
const relativeDirPath = isNonRoot ? opts.relativeDirPathOverride : resolveRelativeDirPath(filePath);
|
|
18000
|
+
const relativeFilePath = isNonRoot ? (0, import_node_path129.relative)(effectiveBaseDir, filePath) : (0, import_node_path129.basename)(filePath);
|
|
18001
|
+
checkPathTraversal({
|
|
18002
|
+
relativePath: isNonRoot ? relativeFilePath : relativeDirPath,
|
|
18003
|
+
intendedRootDir: effectiveBaseDir
|
|
18004
|
+
});
|
|
18005
|
+
return factory.class.forDeletion({
|
|
18006
|
+
baseDir: this.baseDir,
|
|
18007
|
+
relativeDirPath,
|
|
18008
|
+
relativeFilePath,
|
|
18009
|
+
global: this.global
|
|
18010
|
+
});
|
|
18011
|
+
}).filter((rule) => rule.isDeletable());
|
|
18012
|
+
};
|
|
17952
18013
|
const findFilesWithFallback = async (primaryGlob, alternativeRoots, buildAltGlob) => {
|
|
17953
18014
|
const primaryFilePaths = await findFilesByGlobs(primaryGlob);
|
|
17954
18015
|
if (primaryFilePaths.length > 0) {
|
|
@@ -17973,19 +18034,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
17973
18034
|
(alt) => (0, import_node_path129.join)(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
|
|
17974
18035
|
);
|
|
17975
18036
|
if (forDeletion) {
|
|
17976
|
-
return uniqueRootFilePaths
|
|
17977
|
-
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
17978
|
-
checkPathTraversal({
|
|
17979
|
-
relativePath: relativeDirPath,
|
|
17980
|
-
intendedRootDir: this.baseDir
|
|
17981
|
-
});
|
|
17982
|
-
return factory.class.forDeletion({
|
|
17983
|
-
baseDir: this.baseDir,
|
|
17984
|
-
relativeDirPath,
|
|
17985
|
-
relativeFilePath: (0, import_node_path129.basename)(filePath),
|
|
17986
|
-
global: this.global
|
|
17987
|
-
});
|
|
17988
|
-
}).filter((rule) => rule.isDeletable());
|
|
18037
|
+
return buildDeletionRulesFromPaths(uniqueRootFilePaths);
|
|
17989
18038
|
}
|
|
17990
18039
|
return await Promise.all(
|
|
17991
18040
|
uniqueRootFilePaths.map((filePath) => {
|
|
@@ -18015,19 +18064,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18015
18064
|
const uniqueLocalRootFilePaths2 = await findFilesByGlobs(
|
|
18016
18065
|
(0, import_node_path129.join)(this.baseDir, "AGENTS.local.md")
|
|
18017
18066
|
);
|
|
18018
|
-
return uniqueLocalRootFilePaths2
|
|
18019
|
-
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
18020
|
-
checkPathTraversal({
|
|
18021
|
-
relativePath: relativeDirPath,
|
|
18022
|
-
intendedRootDir: this.baseDir
|
|
18023
|
-
});
|
|
18024
|
-
return factory.class.forDeletion({
|
|
18025
|
-
baseDir: this.baseDir,
|
|
18026
|
-
relativeDirPath,
|
|
18027
|
-
relativeFilePath: (0, import_node_path129.basename)(filePath),
|
|
18028
|
-
global: this.global
|
|
18029
|
-
});
|
|
18030
|
-
}).filter((rule) => rule.isDeletable());
|
|
18067
|
+
return buildDeletionRulesFromPaths(uniqueLocalRootFilePaths2);
|
|
18031
18068
|
}
|
|
18032
18069
|
if (this.toolTarget !== "claudecode" && this.toolTarget !== "claudecode-legacy") {
|
|
18033
18070
|
return [];
|
|
@@ -18040,19 +18077,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18040
18077
|
settablePaths.alternativeRoots,
|
|
18041
18078
|
(alt) => (0, import_node_path129.join)(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
|
|
18042
18079
|
);
|
|
18043
|
-
return uniqueLocalRootFilePaths
|
|
18044
|
-
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
18045
|
-
checkPathTraversal({
|
|
18046
|
-
relativePath: relativeDirPath,
|
|
18047
|
-
intendedRootDir: this.baseDir
|
|
18048
|
-
});
|
|
18049
|
-
return factory.class.forDeletion({
|
|
18050
|
-
baseDir: this.baseDir,
|
|
18051
|
-
relativeDirPath,
|
|
18052
|
-
relativeFilePath: (0, import_node_path129.basename)(filePath),
|
|
18053
|
-
global: this.global
|
|
18054
|
-
});
|
|
18055
|
-
}).filter((rule) => rule.isDeletable());
|
|
18080
|
+
return buildDeletionRulesFromPaths(uniqueLocalRootFilePaths);
|
|
18056
18081
|
})();
|
|
18057
18082
|
this.logger.debug(
|
|
18058
18083
|
`Found ${localRootToolRules.length} local root tool rule files for deletion`
|
|
@@ -18066,19 +18091,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18066
18091
|
return [];
|
|
18067
18092
|
}
|
|
18068
18093
|
const mirrorPaths = await findFilesByGlobs((0, import_node_path129.join)(this.baseDir, "AGENTS.md"));
|
|
18069
|
-
return mirrorPaths
|
|
18070
|
-
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
18071
|
-
checkPathTraversal({
|
|
18072
|
-
relativePath: relativeDirPath,
|
|
18073
|
-
intendedRootDir: this.baseDir
|
|
18074
|
-
});
|
|
18075
|
-
return factory.class.forDeletion({
|
|
18076
|
-
baseDir: this.baseDir,
|
|
18077
|
-
relativeDirPath,
|
|
18078
|
-
relativeFilePath: (0, import_node_path129.basename)(filePath),
|
|
18079
|
-
global: this.global
|
|
18080
|
-
});
|
|
18081
|
-
}).filter((rule) => rule.isDeletable());
|
|
18094
|
+
return buildDeletionRulesFromPaths(mirrorPaths);
|
|
18082
18095
|
})();
|
|
18083
18096
|
const nonRootToolRules = await (async () => {
|
|
18084
18097
|
if (!settablePaths.nonRoot) {
|
|
@@ -18088,8 +18101,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18088
18101
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
18089
18102
|
(0, import_node_path129.join)(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
18090
18103
|
);
|
|
18104
|
+
if (forDeletion) {
|
|
18105
|
+
return buildDeletionRulesFromPaths(nonRootFilePaths, {
|
|
18106
|
+
baseDirOverride: nonRootBaseDir,
|
|
18107
|
+
relativeDirPathOverride: settablePaths.nonRoot.relativeDirPath
|
|
18108
|
+
});
|
|
18109
|
+
}
|
|
18091
18110
|
const modularRootRelative = settablePaths.nonRoot.relativeDirPath;
|
|
18092
|
-
const nonRootPathsForImport =
|
|
18111
|
+
const nonRootPathsForImport = this.toolTarget === "rovodev" ? nonRootFilePaths.filter((filePath) => {
|
|
18093
18112
|
const relativeFilePath = (0, import_node_path129.relative)(nonRootBaseDir, filePath);
|
|
18094
18113
|
const ok = RovodevRule.isAllowedModularRulesRelativePath(relativeFilePath);
|
|
18095
18114
|
if (!ok) {
|
|
@@ -18099,21 +18118,6 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18099
18118
|
}
|
|
18100
18119
|
return ok;
|
|
18101
18120
|
}) : nonRootFilePaths;
|
|
18102
|
-
if (forDeletion) {
|
|
18103
|
-
return nonRootFilePaths.map((filePath) => {
|
|
18104
|
-
const relativeFilePath = (0, import_node_path129.relative)(nonRootBaseDir, filePath);
|
|
18105
|
-
checkPathTraversal({
|
|
18106
|
-
relativePath: relativeFilePath,
|
|
18107
|
-
intendedRootDir: nonRootBaseDir
|
|
18108
|
-
});
|
|
18109
|
-
return factory.class.forDeletion({
|
|
18110
|
-
baseDir: this.baseDir,
|
|
18111
|
-
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
18112
|
-
relativeFilePath,
|
|
18113
|
-
global: this.global
|
|
18114
|
-
});
|
|
18115
|
-
}).filter((rule) => rule.isDeletable());
|
|
18116
|
-
}
|
|
18117
18121
|
return await Promise.all(
|
|
18118
18122
|
nonRootPathsForImport.map((filePath) => {
|
|
18119
18123
|
const relativeFilePath = (0, import_node_path129.relative)(nonRootBaseDir, filePath);
|
package/dist/index.d.cts
CHANGED
|
@@ -120,6 +120,9 @@ declare abstract class AiDir {
|
|
|
120
120
|
frontmatter?: Record<string, unknown>;
|
|
121
121
|
} | undefined;
|
|
122
122
|
getOtherFiles(): AiDirFile[];
|
|
123
|
+
/**
|
|
124
|
+
* Returns the relative path from CWD with POSIX separators for consistent cross-platform output.
|
|
125
|
+
*/
|
|
123
126
|
getRelativePathFromCwd(): string;
|
|
124
127
|
getGlobal(): boolean;
|
|
125
128
|
setMainFile(name: string, body: string, frontmatter?: Record<string, unknown>): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -120,6 +120,9 @@ declare abstract class AiDir {
|
|
|
120
120
|
frontmatter?: Record<string, unknown>;
|
|
121
121
|
} | undefined;
|
|
122
122
|
getOtherFiles(): AiDirFile[];
|
|
123
|
+
/**
|
|
124
|
+
* Returns the relative path from CWD with POSIX separators for consistent cross-platform output.
|
|
125
|
+
*/
|
|
123
126
|
getRelativePathFromCwd(): string;
|
|
124
127
|
getGlobal(): boolean;
|
|
125
128
|
setMainFile(name: string, body: string, frontmatter?: Record<string, unknown>): void;
|
package/dist/index.js
CHANGED