rulesync 8.10.0 → 8.12.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-RMITDFVW.js → chunk-643VJ2QM.js} +245 -15
- package/dist/cli/index.cjs +208 -95
- package/dist/cli/index.js +198 -317
- package/dist/index.cjs +270 -14
- package/dist/index.d.cts +19 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.js +27 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
JsonLogger,
|
|
17
17
|
MAX_FILE_SIZE,
|
|
18
18
|
McpProcessor,
|
|
19
|
-
PermissionsProcessor,
|
|
20
19
|
RULESYNC_AIIGNORE_FILE_NAME,
|
|
21
20
|
RULESYNC_AIIGNORE_RELATIVE_FILE_PATH,
|
|
22
21
|
RULESYNC_COMMANDS_RELATIVE_DIR_PATH,
|
|
@@ -57,6 +56,7 @@ import {
|
|
|
57
56
|
ToolTargetSchema,
|
|
58
57
|
checkPathTraversal,
|
|
59
58
|
checkRulesyncDirExists,
|
|
59
|
+
convertFromTool,
|
|
60
60
|
createTempDirectory,
|
|
61
61
|
directoryExists,
|
|
62
62
|
ensureDir,
|
|
@@ -79,7 +79,7 @@ import {
|
|
|
79
79
|
stringifyFrontmatter,
|
|
80
80
|
toPosixPath,
|
|
81
81
|
writeFileContent
|
|
82
|
-
} from "../chunk-
|
|
82
|
+
} from "../chunk-643VJ2QM.js";
|
|
83
83
|
|
|
84
84
|
// src/cli/index.ts
|
|
85
85
|
import { Command } from "commander";
|
|
@@ -87,236 +87,6 @@ import { Command } from "commander";
|
|
|
87
87
|
// src/utils/parse-comma-separated-list.ts
|
|
88
88
|
var parseCommaSeparatedList = (value) => value.split(",").map((s) => s.trim()).filter(Boolean);
|
|
89
89
|
|
|
90
|
-
// src/lib/convert.ts
|
|
91
|
-
async function convertFromTool(params) {
|
|
92
|
-
const ctx = params;
|
|
93
|
-
const [
|
|
94
|
-
rulesCount,
|
|
95
|
-
ignoreCount,
|
|
96
|
-
mcpCount,
|
|
97
|
-
commandsCount,
|
|
98
|
-
subagentsCount,
|
|
99
|
-
skillsCount,
|
|
100
|
-
hooksCount,
|
|
101
|
-
permissionsCount
|
|
102
|
-
] = [
|
|
103
|
-
await runFeatureConvert(ctx, buildRulesStrategy(ctx)),
|
|
104
|
-
await runFeatureConvert(ctx, buildIgnoreStrategy(ctx)),
|
|
105
|
-
await runFeatureConvert(ctx, buildMcpStrategy(ctx)),
|
|
106
|
-
await runFeatureConvert(ctx, buildCommandsStrategy(ctx)),
|
|
107
|
-
await runFeatureConvert(ctx, buildSubagentsStrategy(ctx)),
|
|
108
|
-
await runFeatureConvert(ctx, buildSkillsStrategy(ctx)),
|
|
109
|
-
await runFeatureConvert(ctx, buildHooksStrategy(ctx)),
|
|
110
|
-
await runFeatureConvert(ctx, buildPermissionsStrategy(ctx))
|
|
111
|
-
];
|
|
112
|
-
return {
|
|
113
|
-
rulesCount,
|
|
114
|
-
ignoreCount,
|
|
115
|
-
mcpCount,
|
|
116
|
-
commandsCount,
|
|
117
|
-
subagentsCount,
|
|
118
|
-
skillsCount,
|
|
119
|
-
hooksCount,
|
|
120
|
-
permissionsCount
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
async function runFeatureConvert(ctx, strategy) {
|
|
124
|
-
if (!strategy) return 0;
|
|
125
|
-
const { config, fromTool, toTools, logger: logger5 } = ctx;
|
|
126
|
-
const {
|
|
127
|
-
feature,
|
|
128
|
-
itemLabel,
|
|
129
|
-
allTargets,
|
|
130
|
-
importableTargets = allTargets,
|
|
131
|
-
createProcessor,
|
|
132
|
-
loadSource,
|
|
133
|
-
toRulesync,
|
|
134
|
-
fromRulesync,
|
|
135
|
-
write
|
|
136
|
-
} = strategy;
|
|
137
|
-
if (!config.getFeatures(fromTool).includes(feature)) {
|
|
138
|
-
return 0;
|
|
139
|
-
}
|
|
140
|
-
if (!allTargets.includes(fromTool)) {
|
|
141
|
-
logger5.warn(`Source tool '${fromTool}' does not support feature '${feature}'. Skipping.`);
|
|
142
|
-
return 0;
|
|
143
|
-
}
|
|
144
|
-
if (!importableTargets.includes(fromTool)) {
|
|
145
|
-
logger5.warn(`Conversion from ${fromTool} ${feature} is not supported. Skipping.`);
|
|
146
|
-
return 0;
|
|
147
|
-
}
|
|
148
|
-
const sourceProcessor = createProcessor({ toolTarget: fromTool, dryRun: false });
|
|
149
|
-
const sourceItems = await loadSource(sourceProcessor);
|
|
150
|
-
if (sourceItems.length === 0) {
|
|
151
|
-
logger5.warn(`No ${feature} files found for ${fromTool}. Skipping ${feature} conversion.`);
|
|
152
|
-
return 0;
|
|
153
|
-
}
|
|
154
|
-
const rulesyncItems = await toRulesync(sourceProcessor, sourceItems);
|
|
155
|
-
let totalCount = 0;
|
|
156
|
-
for (const toTool of toTools) {
|
|
157
|
-
if (!allTargets.includes(toTool)) {
|
|
158
|
-
logger5.warn(`Destination tool '${toTool}' does not support feature '${feature}'. Skipping.`);
|
|
159
|
-
continue;
|
|
160
|
-
}
|
|
161
|
-
const destProcessor = createProcessor({
|
|
162
|
-
toolTarget: toTool,
|
|
163
|
-
dryRun: config.isPreviewMode()
|
|
164
|
-
});
|
|
165
|
-
const destItems = await fromRulesync(destProcessor, rulesyncItems);
|
|
166
|
-
const { count } = await write(destProcessor, destItems);
|
|
167
|
-
totalCount += count;
|
|
168
|
-
if (config.getVerbose() && count > 0) {
|
|
169
|
-
const verb = config.isPreviewMode() ? "Would convert" : "Converted";
|
|
170
|
-
logger5.success(`${verb} ${count} ${itemLabel} for ${toTool}`);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return totalCount;
|
|
174
|
-
}
|
|
175
|
-
function getBaseDir(config) {
|
|
176
|
-
return config.getBaseDirs()[0] ?? ".";
|
|
177
|
-
}
|
|
178
|
-
function buildRulesStrategy(ctx) {
|
|
179
|
-
const { config, logger: logger5 } = ctx;
|
|
180
|
-
const global = config.getGlobal();
|
|
181
|
-
const baseDir = getBaseDir(config);
|
|
182
|
-
const allTargets = RulesProcessor.getToolTargets({ global });
|
|
183
|
-
return {
|
|
184
|
-
feature: "rules",
|
|
185
|
-
itemLabel: "rule file(s)",
|
|
186
|
-
allTargets,
|
|
187
|
-
createProcessor: ({ toolTarget, dryRun }) => new RulesProcessor({ baseDir, toolTarget, global, dryRun, logger: logger5 }),
|
|
188
|
-
loadSource: (p) => p.loadToolFiles(),
|
|
189
|
-
toRulesync: (p, files) => p.convertToolFilesToRulesyncFiles(files),
|
|
190
|
-
fromRulesync: (p, files) => p.convertRulesyncFilesToToolFiles(files),
|
|
191
|
-
write: (p, files) => p.writeAiFiles(files)
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
function buildIgnoreStrategy(ctx) {
|
|
195
|
-
const { config, logger: logger5 } = ctx;
|
|
196
|
-
if (config.getGlobal()) {
|
|
197
|
-
logger5.debug("Skipping ignore conversion (not supported in global mode)");
|
|
198
|
-
return null;
|
|
199
|
-
}
|
|
200
|
-
const baseDir = getBaseDir(config);
|
|
201
|
-
const allTargets = IgnoreProcessor.getToolTargets();
|
|
202
|
-
return {
|
|
203
|
-
feature: "ignore",
|
|
204
|
-
itemLabel: "ignore file(s)",
|
|
205
|
-
allTargets,
|
|
206
|
-
createProcessor: ({ toolTarget, dryRun }) => new IgnoreProcessor({
|
|
207
|
-
baseDir,
|
|
208
|
-
toolTarget,
|
|
209
|
-
dryRun,
|
|
210
|
-
logger: logger5,
|
|
211
|
-
featureOptions: config.getFeatureOptions(toolTarget, "ignore")
|
|
212
|
-
}),
|
|
213
|
-
loadSource: (p) => p.loadToolFiles(),
|
|
214
|
-
toRulesync: (p, files) => p.convertToolFilesToRulesyncFiles(files),
|
|
215
|
-
fromRulesync: (p, files) => p.convertRulesyncFilesToToolFiles(files),
|
|
216
|
-
write: (p, files) => p.writeAiFiles(files)
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
function buildMcpStrategy(ctx) {
|
|
220
|
-
const { config, logger: logger5 } = ctx;
|
|
221
|
-
const global = config.getGlobal();
|
|
222
|
-
const baseDir = getBaseDir(config);
|
|
223
|
-
const allTargets = McpProcessor.getToolTargets({ global });
|
|
224
|
-
return {
|
|
225
|
-
feature: "mcp",
|
|
226
|
-
itemLabel: "MCP file(s)",
|
|
227
|
-
allTargets,
|
|
228
|
-
createProcessor: ({ toolTarget, dryRun }) => new McpProcessor({ baseDir, toolTarget, global, dryRun, logger: logger5 }),
|
|
229
|
-
loadSource: (p) => p.loadToolFiles(),
|
|
230
|
-
toRulesync: (p, files) => p.convertToolFilesToRulesyncFiles(files),
|
|
231
|
-
fromRulesync: (p, files) => p.convertRulesyncFilesToToolFiles(files),
|
|
232
|
-
write: (p, files) => p.writeAiFiles(files)
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
function buildCommandsStrategy(ctx) {
|
|
236
|
-
const { config, logger: logger5 } = ctx;
|
|
237
|
-
const global = config.getGlobal();
|
|
238
|
-
const baseDir = getBaseDir(config);
|
|
239
|
-
const allTargets = CommandsProcessor.getToolTargets({ global, includeSimulated: false });
|
|
240
|
-
return {
|
|
241
|
-
feature: "commands",
|
|
242
|
-
itemLabel: "command file(s)",
|
|
243
|
-
allTargets,
|
|
244
|
-
createProcessor: ({ toolTarget, dryRun }) => new CommandsProcessor({ baseDir, toolTarget, global, dryRun, logger: logger5 }),
|
|
245
|
-
loadSource: (p) => p.loadToolFiles(),
|
|
246
|
-
toRulesync: (p, files) => p.convertToolFilesToRulesyncFiles(files),
|
|
247
|
-
fromRulesync: (p, files) => p.convertRulesyncFilesToToolFiles(files),
|
|
248
|
-
write: (p, files) => p.writeAiFiles(files)
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
function buildSubagentsStrategy(ctx) {
|
|
252
|
-
const { config, logger: logger5 } = ctx;
|
|
253
|
-
const global = config.getGlobal();
|
|
254
|
-
const baseDir = getBaseDir(config);
|
|
255
|
-
const allTargets = SubagentsProcessor.getToolTargets({ global, includeSimulated: false });
|
|
256
|
-
return {
|
|
257
|
-
feature: "subagents",
|
|
258
|
-
itemLabel: "subagent file(s)",
|
|
259
|
-
allTargets,
|
|
260
|
-
createProcessor: ({ toolTarget, dryRun }) => new SubagentsProcessor({ baseDir, toolTarget, global, dryRun, logger: logger5 }),
|
|
261
|
-
loadSource: (p) => p.loadToolFiles(),
|
|
262
|
-
toRulesync: (p, files) => p.convertToolFilesToRulesyncFiles(files),
|
|
263
|
-
fromRulesync: (p, files) => p.convertRulesyncFilesToToolFiles(files),
|
|
264
|
-
write: (p, files) => p.writeAiFiles(files)
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
function buildSkillsStrategy(ctx) {
|
|
268
|
-
const { config, logger: logger5 } = ctx;
|
|
269
|
-
const global = config.getGlobal();
|
|
270
|
-
const baseDir = getBaseDir(config);
|
|
271
|
-
const allTargets = SkillsProcessor.getToolTargets({ global });
|
|
272
|
-
return {
|
|
273
|
-
feature: "skills",
|
|
274
|
-
itemLabel: "skill(s)",
|
|
275
|
-
allTargets,
|
|
276
|
-
createProcessor: ({ toolTarget, dryRun }) => new SkillsProcessor({ baseDir, toolTarget, global, dryRun, logger: logger5 }),
|
|
277
|
-
loadSource: (p) => p.loadToolDirs(),
|
|
278
|
-
toRulesync: (p, dirs) => p.convertToolDirsToRulesyncDirs(dirs),
|
|
279
|
-
fromRulesync: (p, dirs) => p.convertRulesyncDirsToToolDirs(dirs),
|
|
280
|
-
write: (p, dirs) => p.writeAiDirs(dirs)
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
function buildHooksStrategy(ctx) {
|
|
284
|
-
const { config, logger: logger5 } = ctx;
|
|
285
|
-
const global = config.getGlobal();
|
|
286
|
-
const baseDir = getBaseDir(config);
|
|
287
|
-
const allTargets = HooksProcessor.getToolTargets({ global });
|
|
288
|
-
const importableTargets = HooksProcessor.getToolTargets({ global, importOnly: true });
|
|
289
|
-
return {
|
|
290
|
-
feature: "hooks",
|
|
291
|
-
itemLabel: "hooks file(s)",
|
|
292
|
-
allTargets,
|
|
293
|
-
importableTargets,
|
|
294
|
-
createProcessor: ({ toolTarget, dryRun }) => new HooksProcessor({ baseDir, toolTarget, global, dryRun, logger: logger5 }),
|
|
295
|
-
loadSource: (p) => p.loadToolFiles(),
|
|
296
|
-
toRulesync: (p, files) => p.convertToolFilesToRulesyncFiles(files),
|
|
297
|
-
fromRulesync: (p, files) => p.convertRulesyncFilesToToolFiles(files),
|
|
298
|
-
write: (p, files) => p.writeAiFiles(files)
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
function buildPermissionsStrategy(ctx) {
|
|
302
|
-
const { config, logger: logger5 } = ctx;
|
|
303
|
-
const global = config.getGlobal();
|
|
304
|
-
const baseDir = getBaseDir(config);
|
|
305
|
-
const allTargets = PermissionsProcessor.getToolTargets({ global });
|
|
306
|
-
const importableTargets = PermissionsProcessor.getToolTargets({ global, importOnly: true });
|
|
307
|
-
return {
|
|
308
|
-
feature: "permissions",
|
|
309
|
-
itemLabel: "permissions file(s)",
|
|
310
|
-
allTargets,
|
|
311
|
-
importableTargets,
|
|
312
|
-
createProcessor: ({ toolTarget, dryRun }) => new PermissionsProcessor({ baseDir, toolTarget, global, dryRun, logger: logger5 }),
|
|
313
|
-
loadSource: (p) => p.loadToolFiles(),
|
|
314
|
-
toRulesync: (p, files) => p.convertToolFilesToRulesyncFiles(files),
|
|
315
|
-
fromRulesync: (p, files) => p.convertRulesyncFilesToToolFiles(files),
|
|
316
|
-
write: (p, files) => p.writeAiFiles(files)
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
|
|
320
90
|
// src/utils/result.ts
|
|
321
91
|
function calculateTotalCount(result) {
|
|
322
92
|
return result.rulesCount + result.ignoreCount + result.mcpCount + result.commandsCount + result.subagentsCount + result.skillsCount + result.hooksCount + result.permissionsCount;
|
|
@@ -4412,7 +4182,7 @@ async function runGhInstall(logger5, options) {
|
|
|
4412
4182
|
import { FastMCP } from "fastmcp";
|
|
4413
4183
|
|
|
4414
4184
|
// src/mcp/tools.ts
|
|
4415
|
-
import { z as
|
|
4185
|
+
import { z as z19 } from "zod/mini";
|
|
4416
4186
|
|
|
4417
4187
|
// src/mcp/commands.ts
|
|
4418
4188
|
import { basename as basename2, join as join13 } from "path";
|
|
@@ -4601,16 +4371,118 @@ var commandTools = {
|
|
|
4601
4371
|
}
|
|
4602
4372
|
};
|
|
4603
4373
|
|
|
4604
|
-
// src/mcp/
|
|
4374
|
+
// src/mcp/convert.ts
|
|
4605
4375
|
import { z as z9 } from "zod/mini";
|
|
4606
|
-
var
|
|
4607
|
-
|
|
4376
|
+
var convertOptionsSchema = z9.object({
|
|
4377
|
+
from: z9.string(),
|
|
4378
|
+
to: z9.array(z9.string()),
|
|
4608
4379
|
features: z9.optional(z9.array(z9.string())),
|
|
4609
|
-
delete: z9.optional(z9.boolean()),
|
|
4610
4380
|
global: z9.optional(z9.boolean()),
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4381
|
+
dryRun: z9.optional(z9.boolean())
|
|
4382
|
+
});
|
|
4383
|
+
function parseToolTarget2(value, label) {
|
|
4384
|
+
const result = ToolTargetSchema.safeParse(value);
|
|
4385
|
+
if (!result.success) {
|
|
4386
|
+
throw new Error(
|
|
4387
|
+
`Invalid ${label} tool '${value}'. Must be one of: ${ALL_TOOL_TARGETS.join(", ")}`
|
|
4388
|
+
);
|
|
4389
|
+
}
|
|
4390
|
+
return result.data;
|
|
4391
|
+
}
|
|
4392
|
+
async function executeConvert(options) {
|
|
4393
|
+
try {
|
|
4394
|
+
if (!options.from) {
|
|
4395
|
+
return {
|
|
4396
|
+
success: false,
|
|
4397
|
+
error: "from is required. Please specify a source tool to convert from."
|
|
4398
|
+
};
|
|
4399
|
+
}
|
|
4400
|
+
if (!options.to || options.to.length === 0) {
|
|
4401
|
+
return {
|
|
4402
|
+
success: false,
|
|
4403
|
+
error: "to is required and must not be empty. Please specify destination tools."
|
|
4404
|
+
};
|
|
4405
|
+
}
|
|
4406
|
+
const fromTool = parseToolTarget2(options.from, "source");
|
|
4407
|
+
const toToolsRaw = options.to.map((t) => parseToolTarget2(t, "destination"));
|
|
4408
|
+
const toTools = Array.from(new Set(toToolsRaw));
|
|
4409
|
+
if (toTools.includes(fromTool)) {
|
|
4410
|
+
return {
|
|
4411
|
+
success: false,
|
|
4412
|
+
error: `Destination tools must not include the source tool '${fromTool}'. Converting a tool onto itself is likely a mistake and may cause lossy round-trips.`
|
|
4413
|
+
};
|
|
4414
|
+
}
|
|
4415
|
+
const config = await ConfigResolver.resolve({
|
|
4416
|
+
targets: [fromTool, ...toTools],
|
|
4417
|
+
// eslint-disable-next-line no-type-assertion/no-type-assertion
|
|
4418
|
+
features: options.features ?? ["*"],
|
|
4419
|
+
global: options.global,
|
|
4420
|
+
dryRun: options.dryRun,
|
|
4421
|
+
// Always use default baseDirs (process.cwd()) and configPath
|
|
4422
|
+
// verbose and silent are meaningless in MCP context
|
|
4423
|
+
verbose: false,
|
|
4424
|
+
silent: true
|
|
4425
|
+
});
|
|
4426
|
+
const logger5 = new ConsoleLogger({ verbose: false, silent: true });
|
|
4427
|
+
const convertResult = await convertFromTool({ config, fromTool, toTools, logger: logger5 });
|
|
4428
|
+
return buildSuccessResponse({ convertResult, config, fromTool, toTools });
|
|
4429
|
+
} catch (error) {
|
|
4430
|
+
return {
|
|
4431
|
+
success: false,
|
|
4432
|
+
error: formatError(error)
|
|
4433
|
+
};
|
|
4434
|
+
}
|
|
4435
|
+
}
|
|
4436
|
+
function buildSuccessResponse(params) {
|
|
4437
|
+
const { convertResult, config, fromTool, toTools } = params;
|
|
4438
|
+
const totalCount = calculateTotalCount(convertResult);
|
|
4439
|
+
return {
|
|
4440
|
+
success: true,
|
|
4441
|
+
result: {
|
|
4442
|
+
rulesCount: convertResult.rulesCount,
|
|
4443
|
+
ignoreCount: convertResult.ignoreCount,
|
|
4444
|
+
mcpCount: convertResult.mcpCount,
|
|
4445
|
+
commandsCount: convertResult.commandsCount,
|
|
4446
|
+
subagentsCount: convertResult.subagentsCount,
|
|
4447
|
+
skillsCount: convertResult.skillsCount,
|
|
4448
|
+
hooksCount: convertResult.hooksCount,
|
|
4449
|
+
permissionsCount: convertResult.permissionsCount,
|
|
4450
|
+
totalCount
|
|
4451
|
+
},
|
|
4452
|
+
config: {
|
|
4453
|
+
from: fromTool,
|
|
4454
|
+
to: toTools,
|
|
4455
|
+
features: config.getFeatures(),
|
|
4456
|
+
global: config.getGlobal(),
|
|
4457
|
+
dryRun: config.isPreviewMode()
|
|
4458
|
+
}
|
|
4459
|
+
};
|
|
4460
|
+
}
|
|
4461
|
+
var convertToolSchemas = {
|
|
4462
|
+
executeConvert: convertOptionsSchema
|
|
4463
|
+
};
|
|
4464
|
+
var convertTools = {
|
|
4465
|
+
executeConvert: {
|
|
4466
|
+
name: "executeConvert",
|
|
4467
|
+
description: "Execute the rulesync convert command to convert configuration files between AI tools without writing intermediate .rulesync/ files. Requires a source tool (from) and one or more destination tools (to).",
|
|
4468
|
+
parameters: convertToolSchemas.executeConvert,
|
|
4469
|
+
execute: async (options) => {
|
|
4470
|
+
const result = await executeConvert(options);
|
|
4471
|
+
return JSON.stringify(result, null, 2);
|
|
4472
|
+
}
|
|
4473
|
+
}
|
|
4474
|
+
};
|
|
4475
|
+
|
|
4476
|
+
// src/mcp/generate.ts
|
|
4477
|
+
import { z as z10 } from "zod/mini";
|
|
4478
|
+
var generateOptionsSchema = z10.object({
|
|
4479
|
+
targets: z10.optional(z10.array(z10.string())),
|
|
4480
|
+
features: z10.optional(z10.array(z10.string())),
|
|
4481
|
+
delete: z10.optional(z10.boolean()),
|
|
4482
|
+
global: z10.optional(z10.boolean()),
|
|
4483
|
+
simulateCommands: z10.optional(z10.boolean()),
|
|
4484
|
+
simulateSubagents: z10.optional(z10.boolean()),
|
|
4485
|
+
simulateSkills: z10.optional(z10.boolean())
|
|
4614
4486
|
});
|
|
4615
4487
|
async function executeGenerate(options = {}) {
|
|
4616
4488
|
try {
|
|
@@ -4638,7 +4510,7 @@ async function executeGenerate(options = {}) {
|
|
|
4638
4510
|
});
|
|
4639
4511
|
const logger5 = new ConsoleLogger({ verbose: false, silent: true });
|
|
4640
4512
|
const generateResult = await generate({ config, logger: logger5 });
|
|
4641
|
-
return
|
|
4513
|
+
return buildSuccessResponse2({ generateResult, config });
|
|
4642
4514
|
} catch (error) {
|
|
4643
4515
|
return {
|
|
4644
4516
|
success: false,
|
|
@@ -4646,7 +4518,7 @@ async function executeGenerate(options = {}) {
|
|
|
4646
4518
|
};
|
|
4647
4519
|
}
|
|
4648
4520
|
}
|
|
4649
|
-
function
|
|
4521
|
+
function buildSuccessResponse2(params) {
|
|
4650
4522
|
const { generateResult, config } = params;
|
|
4651
4523
|
const totalCount = calculateTotalCount(generateResult);
|
|
4652
4524
|
return {
|
|
@@ -4690,7 +4562,7 @@ var generateTools = {
|
|
|
4690
4562
|
|
|
4691
4563
|
// src/mcp/hooks.ts
|
|
4692
4564
|
import { join as join14 } from "path";
|
|
4693
|
-
import { z as
|
|
4565
|
+
import { z as z11 } from "zod/mini";
|
|
4694
4566
|
var maxHooksSizeBytes = 1024 * 1024;
|
|
4695
4567
|
async function getHooksFile() {
|
|
4696
4568
|
try {
|
|
@@ -4779,11 +4651,11 @@ async function deleteHooksFile() {
|
|
|
4779
4651
|
}
|
|
4780
4652
|
}
|
|
4781
4653
|
var hooksToolSchemas = {
|
|
4782
|
-
getHooksFile:
|
|
4783
|
-
putHooksFile:
|
|
4784
|
-
content:
|
|
4654
|
+
getHooksFile: z11.object({}),
|
|
4655
|
+
putHooksFile: z11.object({
|
|
4656
|
+
content: z11.string()
|
|
4785
4657
|
}),
|
|
4786
|
-
deleteHooksFile:
|
|
4658
|
+
deleteHooksFile: z11.object({})
|
|
4787
4659
|
};
|
|
4788
4660
|
var hooksTools = {
|
|
4789
4661
|
getHooksFile: {
|
|
@@ -4817,7 +4689,7 @@ var hooksTools = {
|
|
|
4817
4689
|
|
|
4818
4690
|
// src/mcp/ignore.ts
|
|
4819
4691
|
import { join as join15 } from "path";
|
|
4820
|
-
import { z as
|
|
4692
|
+
import { z as z12 } from "zod/mini";
|
|
4821
4693
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
4822
4694
|
async function getIgnoreFile() {
|
|
4823
4695
|
const ignoreFilePath = join15(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
@@ -4880,11 +4752,11 @@ async function deleteIgnoreFile() {
|
|
|
4880
4752
|
}
|
|
4881
4753
|
}
|
|
4882
4754
|
var ignoreToolSchemas = {
|
|
4883
|
-
getIgnoreFile:
|
|
4884
|
-
putIgnoreFile:
|
|
4885
|
-
content:
|
|
4755
|
+
getIgnoreFile: z12.object({}),
|
|
4756
|
+
putIgnoreFile: z12.object({
|
|
4757
|
+
content: z12.string()
|
|
4886
4758
|
}),
|
|
4887
|
-
deleteIgnoreFile:
|
|
4759
|
+
deleteIgnoreFile: z12.object({})
|
|
4888
4760
|
};
|
|
4889
4761
|
var ignoreTools = {
|
|
4890
4762
|
getIgnoreFile: {
|
|
@@ -4917,11 +4789,11 @@ var ignoreTools = {
|
|
|
4917
4789
|
};
|
|
4918
4790
|
|
|
4919
4791
|
// src/mcp/import.ts
|
|
4920
|
-
import { z as
|
|
4921
|
-
var importOptionsSchema =
|
|
4922
|
-
target:
|
|
4923
|
-
features:
|
|
4924
|
-
global:
|
|
4792
|
+
import { z as z13 } from "zod/mini";
|
|
4793
|
+
var importOptionsSchema = z13.object({
|
|
4794
|
+
target: z13.string(),
|
|
4795
|
+
features: z13.optional(z13.array(z13.string())),
|
|
4796
|
+
global: z13.optional(z13.boolean())
|
|
4925
4797
|
});
|
|
4926
4798
|
async function executeImport(options) {
|
|
4927
4799
|
try {
|
|
@@ -4945,7 +4817,7 @@ async function executeImport(options) {
|
|
|
4945
4817
|
const tool = config.getTargets()[0];
|
|
4946
4818
|
const logger5 = new ConsoleLogger({ verbose: false, silent: true });
|
|
4947
4819
|
const importResult = await importFromTool({ config, tool, logger: logger5 });
|
|
4948
|
-
return
|
|
4820
|
+
return buildSuccessResponse3({ importResult, config, tool });
|
|
4949
4821
|
} catch (error) {
|
|
4950
4822
|
return {
|
|
4951
4823
|
success: false,
|
|
@@ -4953,7 +4825,7 @@ async function executeImport(options) {
|
|
|
4953
4825
|
};
|
|
4954
4826
|
}
|
|
4955
4827
|
}
|
|
4956
|
-
function
|
|
4828
|
+
function buildSuccessResponse3(params) {
|
|
4957
4829
|
const { importResult, config, tool } = params;
|
|
4958
4830
|
const totalCount = calculateTotalCount(importResult);
|
|
4959
4831
|
return {
|
|
@@ -4993,7 +4865,7 @@ var importTools = {
|
|
|
4993
4865
|
|
|
4994
4866
|
// src/mcp/mcp.ts
|
|
4995
4867
|
import { join as join16 } from "path";
|
|
4996
|
-
import { z as
|
|
4868
|
+
import { z as z14 } from "zod/mini";
|
|
4997
4869
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
4998
4870
|
async function getMcpFile() {
|
|
4999
4871
|
try {
|
|
@@ -5091,11 +4963,11 @@ async function deleteMcpFile() {
|
|
|
5091
4963
|
}
|
|
5092
4964
|
}
|
|
5093
4965
|
var mcpToolSchemas = {
|
|
5094
|
-
getMcpFile:
|
|
5095
|
-
putMcpFile:
|
|
5096
|
-
content:
|
|
4966
|
+
getMcpFile: z14.object({}),
|
|
4967
|
+
putMcpFile: z14.object({
|
|
4968
|
+
content: z14.string()
|
|
5097
4969
|
}),
|
|
5098
|
-
deleteMcpFile:
|
|
4970
|
+
deleteMcpFile: z14.object({})
|
|
5099
4971
|
};
|
|
5100
4972
|
var mcpTools = {
|
|
5101
4973
|
getMcpFile: {
|
|
@@ -5129,7 +5001,7 @@ var mcpTools = {
|
|
|
5129
5001
|
|
|
5130
5002
|
// src/mcp/permissions.ts
|
|
5131
5003
|
import { join as join17 } from "path";
|
|
5132
|
-
import { z as
|
|
5004
|
+
import { z as z15 } from "zod/mini";
|
|
5133
5005
|
var maxPermissionsSizeBytes = 1024 * 1024;
|
|
5134
5006
|
async function getPermissionsFile() {
|
|
5135
5007
|
try {
|
|
@@ -5218,11 +5090,11 @@ async function deletePermissionsFile() {
|
|
|
5218
5090
|
}
|
|
5219
5091
|
}
|
|
5220
5092
|
var permissionsToolSchemas = {
|
|
5221
|
-
getPermissionsFile:
|
|
5222
|
-
putPermissionsFile:
|
|
5223
|
-
content:
|
|
5093
|
+
getPermissionsFile: z15.object({}),
|
|
5094
|
+
putPermissionsFile: z15.object({
|
|
5095
|
+
content: z15.string()
|
|
5224
5096
|
}),
|
|
5225
|
-
deletePermissionsFile:
|
|
5097
|
+
deletePermissionsFile: z15.object({})
|
|
5226
5098
|
};
|
|
5227
5099
|
var permissionsTools = {
|
|
5228
5100
|
getPermissionsFile: {
|
|
@@ -5256,7 +5128,7 @@ var permissionsTools = {
|
|
|
5256
5128
|
|
|
5257
5129
|
// src/mcp/rules.ts
|
|
5258
5130
|
import { basename as basename3, join as join18 } from "path";
|
|
5259
|
-
import { z as
|
|
5131
|
+
import { z as z16 } from "zod/mini";
|
|
5260
5132
|
var logger2 = new ConsoleLogger({ verbose: false, silent: true });
|
|
5261
5133
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
5262
5134
|
var maxRulesCount = 1e3;
|
|
@@ -5380,17 +5252,17 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
5380
5252
|
}
|
|
5381
5253
|
}
|
|
5382
5254
|
var ruleToolSchemas = {
|
|
5383
|
-
listRules:
|
|
5384
|
-
getRule:
|
|
5385
|
-
relativePathFromCwd:
|
|
5255
|
+
listRules: z16.object({}),
|
|
5256
|
+
getRule: z16.object({
|
|
5257
|
+
relativePathFromCwd: z16.string()
|
|
5386
5258
|
}),
|
|
5387
|
-
putRule:
|
|
5388
|
-
relativePathFromCwd:
|
|
5259
|
+
putRule: z16.object({
|
|
5260
|
+
relativePathFromCwd: z16.string(),
|
|
5389
5261
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
5390
|
-
body:
|
|
5262
|
+
body: z16.string()
|
|
5391
5263
|
}),
|
|
5392
|
-
deleteRule:
|
|
5393
|
-
relativePathFromCwd:
|
|
5264
|
+
deleteRule: z16.object({
|
|
5265
|
+
relativePathFromCwd: z16.string()
|
|
5394
5266
|
})
|
|
5395
5267
|
};
|
|
5396
5268
|
var ruleTools = {
|
|
@@ -5439,7 +5311,7 @@ var ruleTools = {
|
|
|
5439
5311
|
|
|
5440
5312
|
// src/mcp/skills.ts
|
|
5441
5313
|
import { basename as basename4, dirname, join as join19 } from "path";
|
|
5442
|
-
import { z as
|
|
5314
|
+
import { z as z17 } from "zod/mini";
|
|
5443
5315
|
var logger3 = new ConsoleLogger({ verbose: false, silent: true });
|
|
5444
5316
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
5445
5317
|
var maxSkillsCount = 1e3;
|
|
@@ -5612,23 +5484,23 @@ async function deleteSkill({
|
|
|
5612
5484
|
);
|
|
5613
5485
|
}
|
|
5614
5486
|
}
|
|
5615
|
-
var McpSkillFileSchema =
|
|
5616
|
-
name:
|
|
5617
|
-
body:
|
|
5487
|
+
var McpSkillFileSchema = z17.object({
|
|
5488
|
+
name: z17.string(),
|
|
5489
|
+
body: z17.string()
|
|
5618
5490
|
});
|
|
5619
5491
|
var skillToolSchemas = {
|
|
5620
|
-
listSkills:
|
|
5621
|
-
getSkill:
|
|
5622
|
-
relativeDirPathFromCwd:
|
|
5492
|
+
listSkills: z17.object({}),
|
|
5493
|
+
getSkill: z17.object({
|
|
5494
|
+
relativeDirPathFromCwd: z17.string()
|
|
5623
5495
|
}),
|
|
5624
|
-
putSkill:
|
|
5625
|
-
relativeDirPathFromCwd:
|
|
5496
|
+
putSkill: z17.object({
|
|
5497
|
+
relativeDirPathFromCwd: z17.string(),
|
|
5626
5498
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
5627
|
-
body:
|
|
5628
|
-
otherFiles:
|
|
5499
|
+
body: z17.string(),
|
|
5500
|
+
otherFiles: z17.optional(z17.array(McpSkillFileSchema))
|
|
5629
5501
|
}),
|
|
5630
|
-
deleteSkill:
|
|
5631
|
-
relativeDirPathFromCwd:
|
|
5502
|
+
deleteSkill: z17.object({
|
|
5503
|
+
relativeDirPathFromCwd: z17.string()
|
|
5632
5504
|
})
|
|
5633
5505
|
};
|
|
5634
5506
|
var skillTools = {
|
|
@@ -5678,7 +5550,7 @@ var skillTools = {
|
|
|
5678
5550
|
|
|
5679
5551
|
// src/mcp/subagents.ts
|
|
5680
5552
|
import { basename as basename5, join as join20 } from "path";
|
|
5681
|
-
import { z as
|
|
5553
|
+
import { z as z18 } from "zod/mini";
|
|
5682
5554
|
var logger4 = new ConsoleLogger({ verbose: false, silent: true });
|
|
5683
5555
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
5684
5556
|
var maxSubagentsCount = 1e3;
|
|
@@ -5807,17 +5679,17 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
5807
5679
|
}
|
|
5808
5680
|
}
|
|
5809
5681
|
var subagentToolSchemas = {
|
|
5810
|
-
listSubagents:
|
|
5811
|
-
getSubagent:
|
|
5812
|
-
relativePathFromCwd:
|
|
5682
|
+
listSubagents: z18.object({}),
|
|
5683
|
+
getSubagent: z18.object({
|
|
5684
|
+
relativePathFromCwd: z18.string()
|
|
5813
5685
|
}),
|
|
5814
|
-
putSubagent:
|
|
5815
|
-
relativePathFromCwd:
|
|
5686
|
+
putSubagent: z18.object({
|
|
5687
|
+
relativePathFromCwd: z18.string(),
|
|
5816
5688
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
5817
|
-
body:
|
|
5689
|
+
body: z18.string()
|
|
5818
5690
|
}),
|
|
5819
|
-
deleteSubagent:
|
|
5820
|
-
relativePathFromCwd:
|
|
5691
|
+
deleteSubagent: z18.object({
|
|
5692
|
+
relativePathFromCwd: z18.string()
|
|
5821
5693
|
})
|
|
5822
5694
|
};
|
|
5823
5695
|
var subagentTools = {
|
|
@@ -5865,7 +5737,7 @@ var subagentTools = {
|
|
|
5865
5737
|
};
|
|
5866
5738
|
|
|
5867
5739
|
// src/mcp/tools.ts
|
|
5868
|
-
var rulesyncFeatureSchema =
|
|
5740
|
+
var rulesyncFeatureSchema = z19.enum([
|
|
5869
5741
|
"rule",
|
|
5870
5742
|
"command",
|
|
5871
5743
|
"subagent",
|
|
@@ -5875,23 +5747,25 @@ var rulesyncFeatureSchema = z18.enum([
|
|
|
5875
5747
|
"permissions",
|
|
5876
5748
|
"hooks",
|
|
5877
5749
|
"generate",
|
|
5878
|
-
"import"
|
|
5750
|
+
"import",
|
|
5751
|
+
"convert"
|
|
5879
5752
|
]);
|
|
5880
|
-
var rulesyncOperationSchema =
|
|
5881
|
-
var skillFileSchema =
|
|
5882
|
-
name:
|
|
5883
|
-
body:
|
|
5753
|
+
var rulesyncOperationSchema = z19.enum(["list", "get", "put", "delete", "run"]);
|
|
5754
|
+
var skillFileSchema = z19.object({
|
|
5755
|
+
name: z19.string(),
|
|
5756
|
+
body: z19.string()
|
|
5884
5757
|
});
|
|
5885
|
-
var rulesyncToolSchema =
|
|
5758
|
+
var rulesyncToolSchema = z19.object({
|
|
5886
5759
|
feature: rulesyncFeatureSchema,
|
|
5887
5760
|
operation: rulesyncOperationSchema,
|
|
5888
|
-
targetPathFromCwd:
|
|
5889
|
-
frontmatter:
|
|
5890
|
-
body:
|
|
5891
|
-
otherFiles:
|
|
5892
|
-
content:
|
|
5893
|
-
generateOptions:
|
|
5894
|
-
importOptions:
|
|
5761
|
+
targetPathFromCwd: z19.optional(z19.string()),
|
|
5762
|
+
frontmatter: z19.optional(z19.unknown()),
|
|
5763
|
+
body: z19.optional(z19.string()),
|
|
5764
|
+
otherFiles: z19.optional(z19.array(skillFileSchema)),
|
|
5765
|
+
content: z19.optional(z19.string()),
|
|
5766
|
+
generateOptions: z19.optional(generateOptionsSchema),
|
|
5767
|
+
importOptions: z19.optional(importOptionsSchema),
|
|
5768
|
+
convertOptions: z19.optional(convertOptionsSchema)
|
|
5895
5769
|
});
|
|
5896
5770
|
var supportedOperationsByFeature = {
|
|
5897
5771
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -5903,7 +5777,8 @@ var supportedOperationsByFeature = {
|
|
|
5903
5777
|
permissions: ["get", "put", "delete"],
|
|
5904
5778
|
hooks: ["get", "put", "delete"],
|
|
5905
5779
|
generate: ["run"],
|
|
5906
|
-
import: ["run"]
|
|
5780
|
+
import: ["run"],
|
|
5781
|
+
convert: ["run"]
|
|
5907
5782
|
};
|
|
5908
5783
|
function assertSupported({
|
|
5909
5784
|
feature,
|
|
@@ -5951,7 +5826,7 @@ function ensureBody({ body, feature, operation }) {
|
|
|
5951
5826
|
}
|
|
5952
5827
|
var rulesyncTool = {
|
|
5953
5828
|
name: "rulesyncTool",
|
|
5954
|
-
description: "Manage Rulesync files through a single MCP tool. Features: rule/command/subagent/skill support list/get/put/delete; ignore/mcp/permissions/hooks support get/put/delete only; generate supports run only; import supports run only. Parameters: list requires no targetPathFromCwd (lists all items); get/delete require targetPathFromCwd; put requires targetPathFromCwd, frontmatter, and body (or content for ignore/mcp/permissions/hooks); generate/run uses generateOptions to configure generation; import/run uses importOptions to configure import.",
|
|
5829
|
+
description: "Manage Rulesync files through a single MCP tool. Features: rule/command/subagent/skill support list/get/put/delete; ignore/mcp/permissions/hooks support get/put/delete only; generate supports run only; import supports run only; convert supports run only. Parameters: list requires no targetPathFromCwd (lists all items); get/delete require targetPathFromCwd; put requires targetPathFromCwd, frontmatter, and body (or content for ignore/mcp/permissions/hooks); generate/run uses generateOptions to configure generation; import/run uses importOptions to configure import; convert/run uses convertOptions to configure conversion.",
|
|
5955
5830
|
parameters: rulesyncToolSchema,
|
|
5956
5831
|
execute: async (args) => {
|
|
5957
5832
|
const parsed = rulesyncToolSchema.parse(args);
|
|
@@ -6101,6 +5976,12 @@ var rulesyncTool = {
|
|
|
6101
5976
|
}
|
|
6102
5977
|
return importTools.executeImport.execute(parsed.importOptions);
|
|
6103
5978
|
}
|
|
5979
|
+
case "convert": {
|
|
5980
|
+
if (!parsed.convertOptions) {
|
|
5981
|
+
throw new Error("convertOptions is required for convert feature");
|
|
5982
|
+
}
|
|
5983
|
+
return convertTools.executeConvert.execute(parsed.convertOptions);
|
|
5984
|
+
}
|
|
6104
5985
|
default: {
|
|
6105
5986
|
throw new Error(`Unknown feature: ${parsed.feature}`);
|
|
6106
5987
|
}
|
|
@@ -6554,7 +6435,7 @@ function wrapCommand({
|
|
|
6554
6435
|
}
|
|
6555
6436
|
|
|
6556
6437
|
// src/cli/index.ts
|
|
6557
|
-
var getVersion = () => "8.
|
|
6438
|
+
var getVersion = () => "8.12.0";
|
|
6558
6439
|
function wrapCommand2(name, errorCode, handler) {
|
|
6559
6440
|
return wrapCommand({ name, errorCode, handler, getVersion });
|
|
6560
6441
|
}
|