rulesync 9.4.0 → 9.5.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/cli/index.cjs +2 -2
- package/dist/cli/index.js +2 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/{import-BxqZVTKb.js → import-BdJG1fyb.js} +44 -16
- package/dist/import-BdJG1fyb.js.map +1 -0
- package/dist/{import-DVGMvuhx.cjs → import-DngV1i49.cjs} +43 -15
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/import-BxqZVTKb.js.map +0 -1
|
@@ -878,7 +878,7 @@ const SourceEntrySchema = zod_mini.z.object({
|
|
|
878
878
|
scope: (0, zod_mini.optional)(zod_mini.z.enum(["project", "user"]))
|
|
879
879
|
});
|
|
880
880
|
const ConfigParamsSchema = zod_mini.z.object({
|
|
881
|
-
outputRoots: zod_mini.z.array(zod_mini.z.string()),
|
|
881
|
+
outputRoots: zod_mini.z.union([zod_mini.z.array(zod_mini.z.string()), zod_mini.z.record(zod_mini.z.string(), zod_mini.z.union([zod_mini.z.string(), zod_mini.z.array(zod_mini.z.string())]))]),
|
|
882
882
|
targets: RulesyncConfigTargetsSchema,
|
|
883
883
|
features: RulesyncFeaturesSchema,
|
|
884
884
|
verbose: zod_mini.z.boolean(),
|
|
@@ -983,6 +983,7 @@ var Config = class Config {
|
|
|
983
983
|
const resolvedTargets = targets ?? [];
|
|
984
984
|
const resolvedFeatures = features ?? [];
|
|
985
985
|
this.validateObjectFormTargetKeys(resolvedTargets);
|
|
986
|
+
this.validateObjectFormOutputRootKeys(outputRoots);
|
|
986
987
|
this.validateConflictingTargets(resolvedTargets);
|
|
987
988
|
if (dryRun && check) throw new Error("--dry-run and --check cannot be used together");
|
|
988
989
|
this.outputRoots = outputRoots;
|
|
@@ -1020,6 +1021,11 @@ var Config = class Config {
|
|
|
1020
1021
|
if (!validTargets.has(key)) throw new Error(`Unknown target '${key}'. Valid targets: ${ALL_TOOL_TARGETS.join(", ")}.`);
|
|
1021
1022
|
}
|
|
1022
1023
|
}
|
|
1024
|
+
validateObjectFormOutputRootKeys(outputRoots) {
|
|
1025
|
+
if (Array.isArray(outputRoots)) return;
|
|
1026
|
+
const validTargets = new Set(ALL_TOOL_TARGETS);
|
|
1027
|
+
for (const key of Object.keys(outputRoots)) if (!validTargets.has(key)) throw new Error(`Unknown outputRoots target '${key}'. Valid targets: ${ALL_TOOL_TARGETS.join(", ")}.`);
|
|
1028
|
+
}
|
|
1023
1029
|
validateConflictingTargets(targets) {
|
|
1024
1030
|
const has = (target) => {
|
|
1025
1031
|
if (Array.isArray(targets)) return targets.includes(target);
|
|
@@ -1027,8 +1033,19 @@ var Config = class Config {
|
|
|
1027
1033
|
};
|
|
1028
1034
|
for (const [target1, target2] of CONFLICTING_TARGET_PAIRS) if (has(target1) && has(target2)) throw new Error(`Conflicting targets: '${target1}' and '${target2}' cannot be used together. Please choose one.`);
|
|
1029
1035
|
}
|
|
1030
|
-
getOutputRoots() {
|
|
1031
|
-
return this.outputRoots;
|
|
1036
|
+
getOutputRoots(target) {
|
|
1037
|
+
if (Array.isArray(this.outputRoots)) return this.outputRoots;
|
|
1038
|
+
if (target) {
|
|
1039
|
+
const targetOutputRoots = this.outputRoots[target];
|
|
1040
|
+
if (targetOutputRoots === void 0) return [];
|
|
1041
|
+
return Array.isArray(targetOutputRoots) ? targetOutputRoots : [targetOutputRoots];
|
|
1042
|
+
}
|
|
1043
|
+
const allRoots = [];
|
|
1044
|
+
for (const value of Object.values(this.outputRoots)) {
|
|
1045
|
+
if (value === void 0) continue;
|
|
1046
|
+
allRoots.push(...Array.isArray(value) ? value : [value]);
|
|
1047
|
+
}
|
|
1048
|
+
return [...new Set(allRoots)];
|
|
1032
1049
|
}
|
|
1033
1050
|
/**
|
|
1034
1051
|
* Filter an arbitrary string-key list down to the known `ToolTarget` set,
|
|
@@ -1390,10 +1407,21 @@ var ConfigResolver = class {
|
|
|
1390
1407
|
};
|
|
1391
1408
|
function getOutputRootsInLightOfGlobal({ outputRoots, global }) {
|
|
1392
1409
|
if (global) return [getHomeDirectory()];
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1410
|
+
if (Array.isArray(outputRoots)) {
|
|
1411
|
+
outputRoots.forEach((outputRoot) => {
|
|
1412
|
+
validateOutputRoot(outputRoot);
|
|
1413
|
+
});
|
|
1414
|
+
return outputRoots.map((outputRoot) => (0, node_path.resolve)(outputRoot));
|
|
1415
|
+
}
|
|
1416
|
+
const resolvedOutputRoots = {};
|
|
1417
|
+
for (const [target, targetOutputRoots] of Object.entries(outputRoots)) {
|
|
1418
|
+
const roots = Array.isArray(targetOutputRoots) ? targetOutputRoots : [targetOutputRoots];
|
|
1419
|
+
roots.forEach((outputRoot) => {
|
|
1420
|
+
validateOutputRoot(outputRoot);
|
|
1421
|
+
});
|
|
1422
|
+
resolvedOutputRoots[target] = Array.isArray(targetOutputRoots) ? roots.map((outputRoot) => (0, node_path.resolve)(outputRoot)) : (0, node_path.resolve)(targetOutputRoots);
|
|
1423
|
+
}
|
|
1424
|
+
return resolvedOutputRoots;
|
|
1397
1425
|
}
|
|
1398
1426
|
function extractConfigFileTargets(targets) {
|
|
1399
1427
|
if (targets === void 0) return void 0;
|
|
@@ -37845,7 +37873,7 @@ async function generateRulesCore(params) {
|
|
|
37845
37873
|
targets: config.getConfigFileTargets(),
|
|
37846
37874
|
global: config.getGlobal()
|
|
37847
37875
|
}) : /* @__PURE__ */ new Map();
|
|
37848
|
-
for (const
|
|
37876
|
+
for (const toolTarget of toolTargets) for (const outputRoot of config.getOutputRoots(toolTarget)) {
|
|
37849
37877
|
if (!config.getFeatures(toolTarget).includes("rules")) continue;
|
|
37850
37878
|
const processor = new RulesProcessor({
|
|
37851
37879
|
outputRoot,
|
|
@@ -37900,7 +37928,7 @@ async function generateIgnoreCore(params) {
|
|
|
37900
37928
|
let hasDiff = false;
|
|
37901
37929
|
for (const toolTarget of (0, es_toolkit.intersection)(config.getTargets(), supportedIgnoreTargets)) {
|
|
37902
37930
|
if (!config.getFeatures(toolTarget).includes("ignore")) continue;
|
|
37903
|
-
for (const outputRoot of config.getOutputRoots()) try {
|
|
37931
|
+
for (const outputRoot of config.getOutputRoots(toolTarget)) try {
|
|
37904
37932
|
const processor = new IgnoreProcessor({
|
|
37905
37933
|
outputRoot,
|
|
37906
37934
|
inputRoot: config.getInputRoot(),
|
|
@@ -37941,7 +37969,7 @@ async function generateMcpCore(params) {
|
|
|
37941
37969
|
featureName: "mcp",
|
|
37942
37970
|
logger
|
|
37943
37971
|
});
|
|
37944
|
-
for (const
|
|
37972
|
+
for (const toolTarget of toolTargets) for (const outputRoot of config.getOutputRoots(toolTarget)) {
|
|
37945
37973
|
if (!config.getFeatures(toolTarget).includes("mcp")) continue;
|
|
37946
37974
|
const processor = new McpProcessor({
|
|
37947
37975
|
outputRoot,
|
|
@@ -37983,7 +38011,7 @@ async function generateCommandsCore(params) {
|
|
|
37983
38011
|
featureName: "commands",
|
|
37984
38012
|
logger
|
|
37985
38013
|
});
|
|
37986
|
-
for (const
|
|
38014
|
+
for (const toolTarget of toolTargets) for (const outputRoot of config.getOutputRoots(toolTarget)) {
|
|
37987
38015
|
if (!config.getFeatures(toolTarget).includes("commands")) continue;
|
|
37988
38016
|
const processor = new CommandsProcessor({
|
|
37989
38017
|
outputRoot,
|
|
@@ -38025,7 +38053,7 @@ async function generateSubagentsCore(params) {
|
|
|
38025
38053
|
featureName: "subagents",
|
|
38026
38054
|
logger
|
|
38027
38055
|
});
|
|
38028
|
-
for (const
|
|
38056
|
+
for (const toolTarget of toolTargets) for (const outputRoot of config.getOutputRoots(toolTarget)) {
|
|
38029
38057
|
if (!config.getFeatures(toolTarget).includes("subagents")) continue;
|
|
38030
38058
|
const processor = new SubagentsProcessor({
|
|
38031
38059
|
outputRoot,
|
|
@@ -38068,7 +38096,7 @@ async function generateSkillsCore(params) {
|
|
|
38068
38096
|
featureName: "skills",
|
|
38069
38097
|
logger
|
|
38070
38098
|
});
|
|
38071
|
-
for (const
|
|
38099
|
+
for (const toolTarget of toolTargets) for (const outputRoot of config.getOutputRoots(toolTarget)) {
|
|
38072
38100
|
if (!config.getFeatures(toolTarget).includes("skills")) continue;
|
|
38073
38101
|
const processor = new SkillsProcessor({
|
|
38074
38102
|
outputRoot,
|
|
@@ -38109,7 +38137,7 @@ async function generateHooksCore(params) {
|
|
|
38109
38137
|
featureName: "hooks",
|
|
38110
38138
|
logger
|
|
38111
38139
|
});
|
|
38112
|
-
for (const
|
|
38140
|
+
for (const toolTarget of toolTargets) for (const outputRoot of config.getOutputRoots(toolTarget)) {
|
|
38113
38141
|
if (!config.getFeatures(toolTarget).includes("hooks")) continue;
|
|
38114
38142
|
const processor = new HooksProcessor({
|
|
38115
38143
|
outputRoot,
|
|
@@ -38146,7 +38174,7 @@ async function generatePermissionsCore(params) {
|
|
|
38146
38174
|
let totalCount = 0;
|
|
38147
38175
|
const allPaths = [];
|
|
38148
38176
|
let hasDiff = false;
|
|
38149
|
-
for (const
|
|
38177
|
+
for (const toolTarget of (0, es_toolkit.intersection)(config.getTargets(), supportedPermissionsTargets)) for (const outputRoot of config.getOutputRoots(toolTarget)) {
|
|
38150
38178
|
if (!config.getFeatures(toolTarget).includes("permissions")) continue;
|
|
38151
38179
|
try {
|
|
38152
38180
|
const processor = new PermissionsProcessor({
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_import = require("./import-
|
|
2
|
+
const require_import = require("./import-DngV1i49.cjs");
|
|
3
3
|
//#region src/index.ts
|
|
4
4
|
async function generate(options = {}) {
|
|
5
5
|
const { silent = true, verbose = false, ...rest } = options;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dt as ALL_FEATURES, F as ConsoleLogger, N as ConfigResolver, a as convertFromTool$1, n as checkRulesyncDirExists, r as generate$1, t as importFromTool$1, tt as ALL_TOOL_TARGETS } from "./import-
|
|
1
|
+
import { Dt as ALL_FEATURES, F as ConsoleLogger, N as ConfigResolver, a as convertFromTool$1, n as checkRulesyncDirExists, r as generate$1, t as importFromTool$1, tt as ALL_TOOL_TARGETS } from "./import-BdJG1fyb.js";
|
|
2
2
|
//#region src/index.ts
|
|
3
3
|
async function generate(options = {}) {
|
|
4
4
|
const { silent = true, verbose = false, ...rest } = options;
|