rulesync 7.8.1 → 7.10.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 +1 -1
- package/dist/{chunk-PEMFIVEG.js → chunk-57CDMFYZ.js} +877 -601
- package/dist/cli/index.cjs +1168 -889
- package/dist/cli/index.js +7 -4
- package/dist/index.cjs +902 -626
- package/dist/index.js +1 -1
- package/package.json +13 -13
package/dist/cli/index.cjs
CHANGED
|
@@ -128,7 +128,7 @@ var Logger = class {
|
|
|
128
128
|
var logger = new Logger();
|
|
129
129
|
|
|
130
130
|
// src/lib/fetch.ts
|
|
131
|
-
var
|
|
131
|
+
var import_node_path113 = require("path");
|
|
132
132
|
var import_promise = require("es-toolkit/promise");
|
|
133
133
|
|
|
134
134
|
// src/constants/rulesync-paths.ts
|
|
@@ -2726,7 +2726,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2726
2726
|
};
|
|
2727
2727
|
|
|
2728
2728
|
// src/features/hooks/hooks-processor.ts
|
|
2729
|
-
var
|
|
2729
|
+
var import_mini15 = require("zod/mini");
|
|
2730
2730
|
|
|
2731
2731
|
// src/types/hooks.ts
|
|
2732
2732
|
var import_mini13 = require("zod/mini");
|
|
@@ -2791,6 +2791,14 @@ var OPENCODE_HOOK_EVENTS = [
|
|
|
2791
2791
|
"afterShellExecution",
|
|
2792
2792
|
"permissionRequest"
|
|
2793
2793
|
];
|
|
2794
|
+
var COPILOT_HOOK_EVENTS = [
|
|
2795
|
+
"sessionStart",
|
|
2796
|
+
"sessionEnd",
|
|
2797
|
+
"afterSubmitPrompt",
|
|
2798
|
+
"preToolUse",
|
|
2799
|
+
"postToolUse",
|
|
2800
|
+
"afterError"
|
|
2801
|
+
];
|
|
2794
2802
|
var FACTORYDROID_HOOK_EVENTS = [
|
|
2795
2803
|
"sessionStart",
|
|
2796
2804
|
"sessionEnd",
|
|
@@ -2810,6 +2818,7 @@ var HooksConfigSchema = import_mini13.z.looseObject({
|
|
|
2810
2818
|
hooks: hooksRecordSchema,
|
|
2811
2819
|
cursor: import_mini13.z.optional(import_mini13.z.looseObject({ hooks: import_mini13.z.optional(hooksRecordSchema) })),
|
|
2812
2820
|
claudecode: import_mini13.z.optional(import_mini13.z.looseObject({ hooks: import_mini13.z.optional(hooksRecordSchema) })),
|
|
2821
|
+
copilot: import_mini13.z.optional(import_mini13.z.looseObject({ hooks: import_mini13.z.optional(hooksRecordSchema) })),
|
|
2813
2822
|
opencode: import_mini13.z.optional(import_mini13.z.looseObject({ hooks: import_mini13.z.optional(hooksRecordSchema) })),
|
|
2814
2823
|
factorydroid: import_mini13.z.optional(import_mini13.z.looseObject({ hooks: import_mini13.z.optional(hooksRecordSchema) }))
|
|
2815
2824
|
});
|
|
@@ -2879,6 +2888,17 @@ var CANONICAL_TO_OPENCODE_EVENT_NAMES = {
|
|
|
2879
2888
|
afterShellExecution: "command.executed",
|
|
2880
2889
|
permissionRequest: "permission.asked"
|
|
2881
2890
|
};
|
|
2891
|
+
var CANONICAL_TO_COPILOT_EVENT_NAMES = {
|
|
2892
|
+
sessionStart: "sessionStart",
|
|
2893
|
+
sessionEnd: "sessionEnd",
|
|
2894
|
+
afterSubmitPrompt: "userPromptSubmitted",
|
|
2895
|
+
preToolUse: "preToolUse",
|
|
2896
|
+
postToolUse: "postToolUse",
|
|
2897
|
+
afterError: "errorOccurred"
|
|
2898
|
+
};
|
|
2899
|
+
var COPILOT_TO_CANONICAL_EVENT_NAMES = Object.fromEntries(
|
|
2900
|
+
Object.entries(CANONICAL_TO_COPILOT_EVENT_NAMES).map(([k, v]) => [v, k])
|
|
2901
|
+
);
|
|
2882
2902
|
|
|
2883
2903
|
// src/features/hooks/claudecode-hooks.ts
|
|
2884
2904
|
var import_node_path21 = require("path");
|
|
@@ -3155,8 +3175,185 @@ var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
|
3155
3175
|
}
|
|
3156
3176
|
};
|
|
3157
3177
|
|
|
3158
|
-
// src/features/hooks/
|
|
3178
|
+
// src/features/hooks/copilot-hooks.ts
|
|
3159
3179
|
var import_node_path22 = require("path");
|
|
3180
|
+
var import_mini14 = require("zod/mini");
|
|
3181
|
+
var CopilotHookEntrySchema = import_mini14.z.looseObject({
|
|
3182
|
+
type: import_mini14.z.string(),
|
|
3183
|
+
bash: import_mini14.z.optional(import_mini14.z.string()),
|
|
3184
|
+
powershell: import_mini14.z.optional(import_mini14.z.string()),
|
|
3185
|
+
timeoutSec: import_mini14.z.optional(import_mini14.z.number())
|
|
3186
|
+
});
|
|
3187
|
+
function canonicalToCopilotHooks(config) {
|
|
3188
|
+
const isWindows = process.platform === "win32";
|
|
3189
|
+
const commandField = isWindows ? "powershell" : "bash";
|
|
3190
|
+
const supported = new Set(COPILOT_HOOK_EVENTS);
|
|
3191
|
+
const sharedConfigHooks = {};
|
|
3192
|
+
for (const [event, defs] of Object.entries(config.hooks)) {
|
|
3193
|
+
if (supported.has(event)) {
|
|
3194
|
+
sharedConfigHooks[event] = defs;
|
|
3195
|
+
}
|
|
3196
|
+
}
|
|
3197
|
+
const effectiveHooks = {
|
|
3198
|
+
...sharedConfigHooks,
|
|
3199
|
+
...config.copilot?.hooks
|
|
3200
|
+
};
|
|
3201
|
+
const copilot = {};
|
|
3202
|
+
for (const [eventName, definitions] of Object.entries(effectiveHooks)) {
|
|
3203
|
+
const copilotEventName = CANONICAL_TO_COPILOT_EVENT_NAMES[eventName] ?? eventName;
|
|
3204
|
+
const entries = [];
|
|
3205
|
+
for (const def of definitions) {
|
|
3206
|
+
const hookType = def.type ?? "command";
|
|
3207
|
+
if (def.matcher) continue;
|
|
3208
|
+
if (hookType !== "command") continue;
|
|
3209
|
+
const command = def.command;
|
|
3210
|
+
const timeout = def.timeout;
|
|
3211
|
+
const rest = Object.fromEntries(
|
|
3212
|
+
Object.entries(def).filter(
|
|
3213
|
+
([k]) => !["type", "matcher", "command", "prompt", "timeout"].includes(k)
|
|
3214
|
+
)
|
|
3215
|
+
);
|
|
3216
|
+
entries.push({
|
|
3217
|
+
type: hookType,
|
|
3218
|
+
...command !== void 0 && command !== null && { [commandField]: command },
|
|
3219
|
+
...timeout !== void 0 && timeout !== null && { timeoutSec: timeout },
|
|
3220
|
+
...rest
|
|
3221
|
+
});
|
|
3222
|
+
}
|
|
3223
|
+
if (entries.length > 0) {
|
|
3224
|
+
copilot[copilotEventName] = entries;
|
|
3225
|
+
}
|
|
3226
|
+
}
|
|
3227
|
+
return copilot;
|
|
3228
|
+
}
|
|
3229
|
+
function resolveImportCommand(entry) {
|
|
3230
|
+
const hasBash = typeof entry.bash === "string";
|
|
3231
|
+
const hasPowershell = typeof entry.powershell === "string";
|
|
3232
|
+
if (hasBash && hasPowershell) {
|
|
3233
|
+
const isWindows = process.platform === "win32";
|
|
3234
|
+
const chosen = isWindows ? "powershell" : "bash";
|
|
3235
|
+
const ignored = isWindows ? "bash" : "powershell";
|
|
3236
|
+
logger.warn(
|
|
3237
|
+
`Copilot hook has both bash and powershell commands; using ${chosen} and ignoring ${ignored} on this platform.`
|
|
3238
|
+
);
|
|
3239
|
+
return isWindows ? entry.powershell : entry.bash;
|
|
3240
|
+
} else if (hasBash) {
|
|
3241
|
+
return entry.bash;
|
|
3242
|
+
} else if (hasPowershell) {
|
|
3243
|
+
return entry.powershell;
|
|
3244
|
+
}
|
|
3245
|
+
return void 0;
|
|
3246
|
+
}
|
|
3247
|
+
function copilotHooksToCanonical(copilotHooks) {
|
|
3248
|
+
if (copilotHooks === null || copilotHooks === void 0 || typeof copilotHooks !== "object") {
|
|
3249
|
+
return {};
|
|
3250
|
+
}
|
|
3251
|
+
const canonical = {};
|
|
3252
|
+
for (const [copilotEventName, hookEntries] of Object.entries(copilotHooks)) {
|
|
3253
|
+
const eventName = COPILOT_TO_CANONICAL_EVENT_NAMES[copilotEventName] ?? copilotEventName;
|
|
3254
|
+
if (!Array.isArray(hookEntries)) continue;
|
|
3255
|
+
const defs = [];
|
|
3256
|
+
for (const rawEntry of hookEntries) {
|
|
3257
|
+
const parseResult = CopilotHookEntrySchema.safeParse(rawEntry);
|
|
3258
|
+
if (!parseResult.success) continue;
|
|
3259
|
+
const entry = parseResult.data;
|
|
3260
|
+
const command = resolveImportCommand(entry);
|
|
3261
|
+
const timeout = entry.timeoutSec;
|
|
3262
|
+
defs.push({
|
|
3263
|
+
type: "command",
|
|
3264
|
+
...command !== void 0 && { command },
|
|
3265
|
+
...timeout !== void 0 && { timeout }
|
|
3266
|
+
});
|
|
3267
|
+
}
|
|
3268
|
+
if (defs.length > 0) {
|
|
3269
|
+
canonical[eventName] = defs;
|
|
3270
|
+
}
|
|
3271
|
+
}
|
|
3272
|
+
return canonical;
|
|
3273
|
+
}
|
|
3274
|
+
var CopilotHooks = class _CopilotHooks extends ToolHooks {
|
|
3275
|
+
constructor(params) {
|
|
3276
|
+
super({
|
|
3277
|
+
...params,
|
|
3278
|
+
fileContent: params.fileContent ?? "{}"
|
|
3279
|
+
});
|
|
3280
|
+
}
|
|
3281
|
+
static getSettablePaths(_options = {}) {
|
|
3282
|
+
return {
|
|
3283
|
+
relativeDirPath: (0, import_node_path22.join)(".github", "hooks"),
|
|
3284
|
+
relativeFilePath: "copilot-hooks.json"
|
|
3285
|
+
};
|
|
3286
|
+
}
|
|
3287
|
+
static async fromFile({
|
|
3288
|
+
baseDir = process.cwd(),
|
|
3289
|
+
validate = true,
|
|
3290
|
+
global = false
|
|
3291
|
+
}) {
|
|
3292
|
+
const paths = _CopilotHooks.getSettablePaths({ global });
|
|
3293
|
+
const filePath = (0, import_node_path22.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3294
|
+
const fileContent = await readFileContentOrNull(filePath) ?? '{"hooks":{}}';
|
|
3295
|
+
return new _CopilotHooks({
|
|
3296
|
+
baseDir,
|
|
3297
|
+
relativeDirPath: paths.relativeDirPath,
|
|
3298
|
+
relativeFilePath: paths.relativeFilePath,
|
|
3299
|
+
fileContent,
|
|
3300
|
+
validate
|
|
3301
|
+
});
|
|
3302
|
+
}
|
|
3303
|
+
static async fromRulesyncHooks({
|
|
3304
|
+
baseDir = process.cwd(),
|
|
3305
|
+
rulesyncHooks,
|
|
3306
|
+
validate = true
|
|
3307
|
+
}) {
|
|
3308
|
+
const paths = _CopilotHooks.getSettablePaths();
|
|
3309
|
+
const config = rulesyncHooks.getJson();
|
|
3310
|
+
const copilotHooks = canonicalToCopilotHooks(config);
|
|
3311
|
+
const fileContent = JSON.stringify({ version: 1, hooks: copilotHooks }, null, 2);
|
|
3312
|
+
return new _CopilotHooks({
|
|
3313
|
+
baseDir,
|
|
3314
|
+
relativeDirPath: paths.relativeDirPath,
|
|
3315
|
+
relativeFilePath: paths.relativeFilePath,
|
|
3316
|
+
fileContent,
|
|
3317
|
+
validate
|
|
3318
|
+
});
|
|
3319
|
+
}
|
|
3320
|
+
toRulesyncHooks() {
|
|
3321
|
+
let parsed;
|
|
3322
|
+
try {
|
|
3323
|
+
parsed = JSON.parse(this.getFileContent());
|
|
3324
|
+
} catch (error) {
|
|
3325
|
+
throw new Error(
|
|
3326
|
+
`Failed to parse Copilot hooks content in ${(0, import_node_path22.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
3327
|
+
{
|
|
3328
|
+
cause: error
|
|
3329
|
+
}
|
|
3330
|
+
);
|
|
3331
|
+
}
|
|
3332
|
+
const hooks = copilotHooksToCanonical(parsed.hooks);
|
|
3333
|
+
return this.toRulesyncHooksDefault({
|
|
3334
|
+
fileContent: JSON.stringify({ version: 1, hooks }, null, 2)
|
|
3335
|
+
});
|
|
3336
|
+
}
|
|
3337
|
+
validate() {
|
|
3338
|
+
return { success: true, error: null };
|
|
3339
|
+
}
|
|
3340
|
+
static forDeletion({
|
|
3341
|
+
baseDir = process.cwd(),
|
|
3342
|
+
relativeDirPath,
|
|
3343
|
+
relativeFilePath
|
|
3344
|
+
}) {
|
|
3345
|
+
return new _CopilotHooks({
|
|
3346
|
+
baseDir,
|
|
3347
|
+
relativeDirPath,
|
|
3348
|
+
relativeFilePath,
|
|
3349
|
+
fileContent: JSON.stringify({ hooks: {} }, null, 2),
|
|
3350
|
+
validate: false
|
|
3351
|
+
});
|
|
3352
|
+
}
|
|
3353
|
+
};
|
|
3354
|
+
|
|
3355
|
+
// src/features/hooks/cursor-hooks.ts
|
|
3356
|
+
var import_node_path23 = require("path");
|
|
3160
3357
|
var CursorHooks = class _CursorHooks extends ToolHooks {
|
|
3161
3358
|
constructor(params) {
|
|
3162
3359
|
const { rulesyncHooks: _r, ...rest } = params;
|
|
@@ -3177,7 +3374,7 @@ var CursorHooks = class _CursorHooks extends ToolHooks {
|
|
|
3177
3374
|
}) {
|
|
3178
3375
|
const paths = _CursorHooks.getSettablePaths();
|
|
3179
3376
|
const fileContent = await readFileContent(
|
|
3180
|
-
(0,
|
|
3377
|
+
(0, import_node_path23.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3181
3378
|
);
|
|
3182
3379
|
return new _CursorHooks({
|
|
3183
3380
|
baseDir,
|
|
@@ -3257,7 +3454,7 @@ var CursorHooks = class _CursorHooks extends ToolHooks {
|
|
|
3257
3454
|
};
|
|
3258
3455
|
|
|
3259
3456
|
// src/features/hooks/factorydroid-hooks.ts
|
|
3260
|
-
var
|
|
3457
|
+
var import_node_path24 = require("path");
|
|
3261
3458
|
function canonicalToFactorydroidHooks(config) {
|
|
3262
3459
|
const supported = new Set(FACTORYDROID_HOOK_EVENTS);
|
|
3263
3460
|
const sharedHooks = {};
|
|
@@ -3362,7 +3559,7 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
3362
3559
|
global = false
|
|
3363
3560
|
}) {
|
|
3364
3561
|
const paths = _FactorydroidHooks.getSettablePaths({ global });
|
|
3365
|
-
const filePath = (0,
|
|
3562
|
+
const filePath = (0, import_node_path24.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3366
3563
|
const fileContent = await readFileContentOrNull(filePath) ?? '{"hooks":{}}';
|
|
3367
3564
|
return new _FactorydroidHooks({
|
|
3368
3565
|
baseDir,
|
|
@@ -3379,7 +3576,7 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
3379
3576
|
global = false
|
|
3380
3577
|
}) {
|
|
3381
3578
|
const paths = _FactorydroidHooks.getSettablePaths({ global });
|
|
3382
|
-
const filePath = (0,
|
|
3579
|
+
const filePath = (0, import_node_path24.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3383
3580
|
const existingContent = await readOrInitializeFileContent(
|
|
3384
3581
|
filePath,
|
|
3385
3582
|
JSON.stringify({}, null, 2)
|
|
@@ -3411,7 +3608,7 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
3411
3608
|
settings = JSON.parse(this.getFileContent());
|
|
3412
3609
|
} catch (error) {
|
|
3413
3610
|
throw new Error(
|
|
3414
|
-
`Failed to parse Factory Droid hooks content in ${(0,
|
|
3611
|
+
`Failed to parse Factory Droid hooks content in ${(0, import_node_path24.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
3415
3612
|
{
|
|
3416
3613
|
cause: error
|
|
3417
3614
|
}
|
|
@@ -3441,7 +3638,7 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
3441
3638
|
};
|
|
3442
3639
|
|
|
3443
3640
|
// src/features/hooks/opencode-hooks.ts
|
|
3444
|
-
var
|
|
3641
|
+
var import_node_path25 = require("path");
|
|
3445
3642
|
var NAMED_HOOKS = /* @__PURE__ */ new Set(["tool.execute.before", "tool.execute.after"]);
|
|
3446
3643
|
function escapeForTemplateLiteral(command) {
|
|
3447
3644
|
return command.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${");
|
|
@@ -3539,7 +3736,7 @@ var OpencodeHooks = class _OpencodeHooks extends ToolHooks {
|
|
|
3539
3736
|
}
|
|
3540
3737
|
static getSettablePaths(options) {
|
|
3541
3738
|
return {
|
|
3542
|
-
relativeDirPath: options?.global ? (0,
|
|
3739
|
+
relativeDirPath: options?.global ? (0, import_node_path25.join)(".config", "opencode", "plugins") : (0, import_node_path25.join)(".opencode", "plugins"),
|
|
3543
3740
|
relativeFilePath: "rulesync-hooks.js"
|
|
3544
3741
|
};
|
|
3545
3742
|
}
|
|
@@ -3550,7 +3747,7 @@ var OpencodeHooks = class _OpencodeHooks extends ToolHooks {
|
|
|
3550
3747
|
}) {
|
|
3551
3748
|
const paths = _OpencodeHooks.getSettablePaths({ global });
|
|
3552
3749
|
const fileContent = await readFileContent(
|
|
3553
|
-
(0,
|
|
3750
|
+
(0, import_node_path25.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3554
3751
|
);
|
|
3555
3752
|
return new _OpencodeHooks({
|
|
3556
3753
|
baseDir,
|
|
@@ -3599,43 +3796,83 @@ var OpencodeHooks = class _OpencodeHooks extends ToolHooks {
|
|
|
3599
3796
|
};
|
|
3600
3797
|
|
|
3601
3798
|
// src/features/hooks/hooks-processor.ts
|
|
3602
|
-
var hooksProcessorToolTargetTuple = [
|
|
3603
|
-
|
|
3799
|
+
var hooksProcessorToolTargetTuple = [
|
|
3800
|
+
"cursor",
|
|
3801
|
+
"claudecode",
|
|
3802
|
+
"copilot",
|
|
3803
|
+
"opencode",
|
|
3804
|
+
"factorydroid"
|
|
3805
|
+
];
|
|
3806
|
+
var HooksProcessorToolTargetSchema = import_mini15.z.enum(hooksProcessorToolTargetTuple);
|
|
3604
3807
|
var toolHooksFactories = /* @__PURE__ */ new Map([
|
|
3605
3808
|
[
|
|
3606
3809
|
"cursor",
|
|
3607
3810
|
{
|
|
3608
3811
|
class: CursorHooks,
|
|
3609
|
-
meta: {
|
|
3812
|
+
meta: {
|
|
3813
|
+
supportsProject: true,
|
|
3814
|
+
supportsGlobal: false,
|
|
3815
|
+
supportsImport: true
|
|
3816
|
+
},
|
|
3610
3817
|
supportedEvents: CURSOR_HOOK_EVENTS,
|
|
3611
|
-
supportedHookTypes: ["command", "prompt"]
|
|
3818
|
+
supportedHookTypes: ["command", "prompt"],
|
|
3819
|
+
supportsMatcher: true
|
|
3612
3820
|
}
|
|
3613
3821
|
],
|
|
3614
3822
|
[
|
|
3615
3823
|
"claudecode",
|
|
3616
3824
|
{
|
|
3617
3825
|
class: ClaudecodeHooks,
|
|
3618
|
-
meta: {
|
|
3826
|
+
meta: {
|
|
3827
|
+
supportsProject: true,
|
|
3828
|
+
supportsGlobal: true,
|
|
3829
|
+
supportsImport: true
|
|
3830
|
+
},
|
|
3619
3831
|
supportedEvents: CLAUDE_HOOK_EVENTS,
|
|
3620
|
-
supportedHookTypes: ["command", "prompt"]
|
|
3832
|
+
supportedHookTypes: ["command", "prompt"],
|
|
3833
|
+
supportsMatcher: true
|
|
3834
|
+
}
|
|
3835
|
+
],
|
|
3836
|
+
[
|
|
3837
|
+
"copilot",
|
|
3838
|
+
{
|
|
3839
|
+
class: CopilotHooks,
|
|
3840
|
+
meta: {
|
|
3841
|
+
supportsProject: true,
|
|
3842
|
+
supportsGlobal: false,
|
|
3843
|
+
supportsImport: true
|
|
3844
|
+
},
|
|
3845
|
+
supportedEvents: COPILOT_HOOK_EVENTS,
|
|
3846
|
+
supportedHookTypes: ["command"],
|
|
3847
|
+
supportsMatcher: false
|
|
3621
3848
|
}
|
|
3622
3849
|
],
|
|
3623
3850
|
[
|
|
3624
3851
|
"opencode",
|
|
3625
3852
|
{
|
|
3626
3853
|
class: OpencodeHooks,
|
|
3627
|
-
meta: {
|
|
3854
|
+
meta: {
|
|
3855
|
+
supportsProject: true,
|
|
3856
|
+
supportsGlobal: true,
|
|
3857
|
+
supportsImport: false
|
|
3858
|
+
},
|
|
3628
3859
|
supportedEvents: OPENCODE_HOOK_EVENTS,
|
|
3629
|
-
supportedHookTypes: ["command"]
|
|
3860
|
+
supportedHookTypes: ["command"],
|
|
3861
|
+
supportsMatcher: true
|
|
3630
3862
|
}
|
|
3631
3863
|
],
|
|
3632
3864
|
[
|
|
3633
3865
|
"factorydroid",
|
|
3634
3866
|
{
|
|
3635
3867
|
class: FactorydroidHooks,
|
|
3636
|
-
meta: {
|
|
3868
|
+
meta: {
|
|
3869
|
+
supportsProject: true,
|
|
3870
|
+
supportsGlobal: true,
|
|
3871
|
+
supportsImport: true
|
|
3872
|
+
},
|
|
3637
3873
|
supportedEvents: FACTORYDROID_HOOK_EVENTS,
|
|
3638
|
-
supportedHookTypes: ["command", "prompt"]
|
|
3874
|
+
supportedHookTypes: ["command", "prompt"],
|
|
3875
|
+
supportsMatcher: true
|
|
3639
3876
|
}
|
|
3640
3877
|
]
|
|
3641
3878
|
]);
|
|
@@ -3752,6 +3989,21 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
3752
3989
|
);
|
|
3753
3990
|
}
|
|
3754
3991
|
}
|
|
3992
|
+
if (!factory.supportsMatcher) {
|
|
3993
|
+
const eventsWithMatcher = /* @__PURE__ */ new Set();
|
|
3994
|
+
for (const [event, defs] of Object.entries(effectiveHooks)) {
|
|
3995
|
+
for (const def of defs) {
|
|
3996
|
+
if (def.matcher) {
|
|
3997
|
+
eventsWithMatcher.add(event);
|
|
3998
|
+
}
|
|
3999
|
+
}
|
|
4000
|
+
}
|
|
4001
|
+
if (eventsWithMatcher.size > 0) {
|
|
4002
|
+
logger.warn(
|
|
4003
|
+
`Skipped matcher hook(s) for ${this.toolTarget} (not supported): ${Array.from(eventsWithMatcher).join(", ")}`
|
|
4004
|
+
);
|
|
4005
|
+
}
|
|
4006
|
+
}
|
|
3755
4007
|
const toolHooks = await factory.class.fromRulesyncHooks({
|
|
3756
4008
|
baseDir: this.baseDir,
|
|
3757
4009
|
rulesyncHooks,
|
|
@@ -3776,13 +4028,13 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
3776
4028
|
};
|
|
3777
4029
|
|
|
3778
4030
|
// src/features/ignore/ignore-processor.ts
|
|
3779
|
-
var
|
|
4031
|
+
var import_mini16 = require("zod/mini");
|
|
3780
4032
|
|
|
3781
4033
|
// src/features/ignore/augmentcode-ignore.ts
|
|
3782
|
-
var
|
|
4034
|
+
var import_node_path27 = require("path");
|
|
3783
4035
|
|
|
3784
4036
|
// src/features/ignore/rulesync-ignore.ts
|
|
3785
|
-
var
|
|
4037
|
+
var import_node_path26 = require("path");
|
|
3786
4038
|
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
3787
4039
|
validate() {
|
|
3788
4040
|
return { success: true, error: null };
|
|
@@ -3802,12 +4054,12 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
3802
4054
|
static async fromFile() {
|
|
3803
4055
|
const baseDir = process.cwd();
|
|
3804
4056
|
const paths = this.getSettablePaths();
|
|
3805
|
-
const recommendedPath = (0,
|
|
4057
|
+
const recommendedPath = (0, import_node_path26.join)(
|
|
3806
4058
|
baseDir,
|
|
3807
4059
|
paths.recommended.relativeDirPath,
|
|
3808
4060
|
paths.recommended.relativeFilePath
|
|
3809
4061
|
);
|
|
3810
|
-
const legacyPath = (0,
|
|
4062
|
+
const legacyPath = (0, import_node_path26.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
3811
4063
|
if (await fileExists(recommendedPath)) {
|
|
3812
4064
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
3813
4065
|
return new _RulesyncIgnore({
|
|
@@ -3923,7 +4175,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
3923
4175
|
validate = true
|
|
3924
4176
|
}) {
|
|
3925
4177
|
const fileContent = await readFileContent(
|
|
3926
|
-
(0,
|
|
4178
|
+
(0, import_node_path27.join)(
|
|
3927
4179
|
baseDir,
|
|
3928
4180
|
this.getSettablePaths().relativeDirPath,
|
|
3929
4181
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3953,7 +4205,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
3953
4205
|
};
|
|
3954
4206
|
|
|
3955
4207
|
// src/features/ignore/claudecode-ignore.ts
|
|
3956
|
-
var
|
|
4208
|
+
var import_node_path28 = require("path");
|
|
3957
4209
|
var import_es_toolkit2 = require("es-toolkit");
|
|
3958
4210
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
3959
4211
|
constructor(params) {
|
|
@@ -3996,7 +4248,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
3996
4248
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
3997
4249
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
3998
4250
|
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
3999
|
-
const filePath = (0,
|
|
4251
|
+
const filePath = (0, import_node_path28.join)(
|
|
4000
4252
|
baseDir,
|
|
4001
4253
|
this.getSettablePaths().relativeDirPath,
|
|
4002
4254
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4032,7 +4284,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
4032
4284
|
validate = true
|
|
4033
4285
|
}) {
|
|
4034
4286
|
const fileContent = await readFileContent(
|
|
4035
|
-
(0,
|
|
4287
|
+
(0, import_node_path28.join)(
|
|
4036
4288
|
baseDir,
|
|
4037
4289
|
this.getSettablePaths().relativeDirPath,
|
|
4038
4290
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4062,7 +4314,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
4062
4314
|
};
|
|
4063
4315
|
|
|
4064
4316
|
// src/features/ignore/cline-ignore.ts
|
|
4065
|
-
var
|
|
4317
|
+
var import_node_path29 = require("path");
|
|
4066
4318
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
4067
4319
|
static getSettablePaths() {
|
|
4068
4320
|
return {
|
|
@@ -4099,7 +4351,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
4099
4351
|
validate = true
|
|
4100
4352
|
}) {
|
|
4101
4353
|
const fileContent = await readFileContent(
|
|
4102
|
-
(0,
|
|
4354
|
+
(0, import_node_path29.join)(
|
|
4103
4355
|
baseDir,
|
|
4104
4356
|
this.getSettablePaths().relativeDirPath,
|
|
4105
4357
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4129,7 +4381,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
4129
4381
|
};
|
|
4130
4382
|
|
|
4131
4383
|
// src/features/ignore/cursor-ignore.ts
|
|
4132
|
-
var
|
|
4384
|
+
var import_node_path30 = require("path");
|
|
4133
4385
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
4134
4386
|
static getSettablePaths() {
|
|
4135
4387
|
return {
|
|
@@ -4162,7 +4414,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
4162
4414
|
validate = true
|
|
4163
4415
|
}) {
|
|
4164
4416
|
const fileContent = await readFileContent(
|
|
4165
|
-
(0,
|
|
4417
|
+
(0, import_node_path30.join)(
|
|
4166
4418
|
baseDir,
|
|
4167
4419
|
this.getSettablePaths().relativeDirPath,
|
|
4168
4420
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4192,7 +4444,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
4192
4444
|
};
|
|
4193
4445
|
|
|
4194
4446
|
// src/features/ignore/geminicli-ignore.ts
|
|
4195
|
-
var
|
|
4447
|
+
var import_node_path31 = require("path");
|
|
4196
4448
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
4197
4449
|
static getSettablePaths() {
|
|
4198
4450
|
return {
|
|
@@ -4219,7 +4471,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
4219
4471
|
validate = true
|
|
4220
4472
|
}) {
|
|
4221
4473
|
const fileContent = await readFileContent(
|
|
4222
|
-
(0,
|
|
4474
|
+
(0, import_node_path31.join)(
|
|
4223
4475
|
baseDir,
|
|
4224
4476
|
this.getSettablePaths().relativeDirPath,
|
|
4225
4477
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4249,7 +4501,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
4249
4501
|
};
|
|
4250
4502
|
|
|
4251
4503
|
// src/features/ignore/goose-ignore.ts
|
|
4252
|
-
var
|
|
4504
|
+
var import_node_path32 = require("path");
|
|
4253
4505
|
var GooseIgnore = class _GooseIgnore extends ToolIgnore {
|
|
4254
4506
|
static getSettablePaths() {
|
|
4255
4507
|
return {
|
|
@@ -4286,7 +4538,7 @@ var GooseIgnore = class _GooseIgnore extends ToolIgnore {
|
|
|
4286
4538
|
validate = true
|
|
4287
4539
|
}) {
|
|
4288
4540
|
const fileContent = await readFileContent(
|
|
4289
|
-
(0,
|
|
4541
|
+
(0, import_node_path32.join)(
|
|
4290
4542
|
baseDir,
|
|
4291
4543
|
this.getSettablePaths().relativeDirPath,
|
|
4292
4544
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4316,7 +4568,7 @@ var GooseIgnore = class _GooseIgnore extends ToolIgnore {
|
|
|
4316
4568
|
};
|
|
4317
4569
|
|
|
4318
4570
|
// src/features/ignore/junie-ignore.ts
|
|
4319
|
-
var
|
|
4571
|
+
var import_node_path33 = require("path");
|
|
4320
4572
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
4321
4573
|
static getSettablePaths() {
|
|
4322
4574
|
return {
|
|
@@ -4343,7 +4595,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
4343
4595
|
validate = true
|
|
4344
4596
|
}) {
|
|
4345
4597
|
const fileContent = await readFileContent(
|
|
4346
|
-
(0,
|
|
4598
|
+
(0, import_node_path33.join)(
|
|
4347
4599
|
baseDir,
|
|
4348
4600
|
this.getSettablePaths().relativeDirPath,
|
|
4349
4601
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4373,7 +4625,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
4373
4625
|
};
|
|
4374
4626
|
|
|
4375
4627
|
// src/features/ignore/kilo-ignore.ts
|
|
4376
|
-
var
|
|
4628
|
+
var import_node_path34 = require("path");
|
|
4377
4629
|
var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
4378
4630
|
static getSettablePaths() {
|
|
4379
4631
|
return {
|
|
@@ -4410,7 +4662,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
4410
4662
|
validate = true
|
|
4411
4663
|
}) {
|
|
4412
4664
|
const fileContent = await readFileContent(
|
|
4413
|
-
(0,
|
|
4665
|
+
(0, import_node_path34.join)(
|
|
4414
4666
|
baseDir,
|
|
4415
4667
|
this.getSettablePaths().relativeDirPath,
|
|
4416
4668
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4440,7 +4692,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
4440
4692
|
};
|
|
4441
4693
|
|
|
4442
4694
|
// src/features/ignore/kiro-ignore.ts
|
|
4443
|
-
var
|
|
4695
|
+
var import_node_path35 = require("path");
|
|
4444
4696
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
4445
4697
|
static getSettablePaths() {
|
|
4446
4698
|
return {
|
|
@@ -4467,7 +4719,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
4467
4719
|
validate = true
|
|
4468
4720
|
}) {
|
|
4469
4721
|
const fileContent = await readFileContent(
|
|
4470
|
-
(0,
|
|
4722
|
+
(0, import_node_path35.join)(
|
|
4471
4723
|
baseDir,
|
|
4472
4724
|
this.getSettablePaths().relativeDirPath,
|
|
4473
4725
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4497,7 +4749,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
4497
4749
|
};
|
|
4498
4750
|
|
|
4499
4751
|
// src/features/ignore/qwencode-ignore.ts
|
|
4500
|
-
var
|
|
4752
|
+
var import_node_path36 = require("path");
|
|
4501
4753
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
4502
4754
|
static getSettablePaths() {
|
|
4503
4755
|
return {
|
|
@@ -4524,7 +4776,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
4524
4776
|
validate = true
|
|
4525
4777
|
}) {
|
|
4526
4778
|
const fileContent = await readFileContent(
|
|
4527
|
-
(0,
|
|
4779
|
+
(0, import_node_path36.join)(
|
|
4528
4780
|
baseDir,
|
|
4529
4781
|
this.getSettablePaths().relativeDirPath,
|
|
4530
4782
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4554,7 +4806,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
4554
4806
|
};
|
|
4555
4807
|
|
|
4556
4808
|
// src/features/ignore/roo-ignore.ts
|
|
4557
|
-
var
|
|
4809
|
+
var import_node_path37 = require("path");
|
|
4558
4810
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
4559
4811
|
static getSettablePaths() {
|
|
4560
4812
|
return {
|
|
@@ -4581,7 +4833,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
4581
4833
|
validate = true
|
|
4582
4834
|
}) {
|
|
4583
4835
|
const fileContent = await readFileContent(
|
|
4584
|
-
(0,
|
|
4836
|
+
(0, import_node_path37.join)(
|
|
4585
4837
|
baseDir,
|
|
4586
4838
|
this.getSettablePaths().relativeDirPath,
|
|
4587
4839
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4611,7 +4863,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
4611
4863
|
};
|
|
4612
4864
|
|
|
4613
4865
|
// src/features/ignore/windsurf-ignore.ts
|
|
4614
|
-
var
|
|
4866
|
+
var import_node_path38 = require("path");
|
|
4615
4867
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
4616
4868
|
static getSettablePaths() {
|
|
4617
4869
|
return {
|
|
@@ -4638,7 +4890,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
4638
4890
|
validate = true
|
|
4639
4891
|
}) {
|
|
4640
4892
|
const fileContent = await readFileContent(
|
|
4641
|
-
(0,
|
|
4893
|
+
(0, import_node_path38.join)(
|
|
4642
4894
|
baseDir,
|
|
4643
4895
|
this.getSettablePaths().relativeDirPath,
|
|
4644
4896
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4668,7 +4920,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
4668
4920
|
};
|
|
4669
4921
|
|
|
4670
4922
|
// src/features/ignore/zed-ignore.ts
|
|
4671
|
-
var
|
|
4923
|
+
var import_node_path39 = require("path");
|
|
4672
4924
|
var import_es_toolkit3 = require("es-toolkit");
|
|
4673
4925
|
var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
4674
4926
|
constructor(params) {
|
|
@@ -4705,7 +4957,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
4705
4957
|
}) {
|
|
4706
4958
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
4707
4959
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
4708
|
-
const filePath = (0,
|
|
4960
|
+
const filePath = (0, import_node_path39.join)(
|
|
4709
4961
|
baseDir,
|
|
4710
4962
|
this.getSettablePaths().relativeDirPath,
|
|
4711
4963
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4732,7 +4984,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
4732
4984
|
validate = true
|
|
4733
4985
|
}) {
|
|
4734
4986
|
const fileContent = await readFileContent(
|
|
4735
|
-
(0,
|
|
4987
|
+
(0, import_node_path39.join)(
|
|
4736
4988
|
baseDir,
|
|
4737
4989
|
this.getSettablePaths().relativeDirPath,
|
|
4738
4990
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4778,7 +5030,7 @@ var ignoreProcessorToolTargets = [
|
|
|
4778
5030
|
"windsurf",
|
|
4779
5031
|
"zed"
|
|
4780
5032
|
];
|
|
4781
|
-
var IgnoreProcessorToolTargetSchema =
|
|
5033
|
+
var IgnoreProcessorToolTargetSchema = import_mini16.z.enum(ignoreProcessorToolTargets);
|
|
4782
5034
|
var toolIgnoreFactories = /* @__PURE__ */ new Map([
|
|
4783
5035
|
["augmentcode", { class: AugmentcodeIgnore }],
|
|
4784
5036
|
["claudecode", { class: ClaudecodeIgnore }],
|
|
@@ -4916,49 +5168,49 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
4916
5168
|
};
|
|
4917
5169
|
|
|
4918
5170
|
// src/features/mcp/mcp-processor.ts
|
|
4919
|
-
var
|
|
5171
|
+
var import_mini20 = require("zod/mini");
|
|
4920
5172
|
|
|
4921
5173
|
// src/features/mcp/claudecode-mcp.ts
|
|
4922
|
-
var
|
|
5174
|
+
var import_node_path41 = require("path");
|
|
4923
5175
|
|
|
4924
5176
|
// src/features/mcp/rulesync-mcp.ts
|
|
4925
|
-
var
|
|
5177
|
+
var import_node_path40 = require("path");
|
|
4926
5178
|
var import_object = require("es-toolkit/object");
|
|
4927
|
-
var
|
|
5179
|
+
var import_mini18 = require("zod/mini");
|
|
4928
5180
|
|
|
4929
5181
|
// src/types/mcp.ts
|
|
4930
|
-
var
|
|
4931
|
-
var McpServerSchema =
|
|
4932
|
-
type:
|
|
4933
|
-
command:
|
|
4934
|
-
args:
|
|
4935
|
-
url:
|
|
4936
|
-
httpUrl:
|
|
4937
|
-
env:
|
|
4938
|
-
disabled:
|
|
4939
|
-
networkTimeout:
|
|
4940
|
-
timeout:
|
|
4941
|
-
trust:
|
|
4942
|
-
cwd:
|
|
4943
|
-
transport:
|
|
4944
|
-
alwaysAllow:
|
|
4945
|
-
tools:
|
|
4946
|
-
kiroAutoApprove:
|
|
4947
|
-
kiroAutoBlock:
|
|
4948
|
-
headers:
|
|
4949
|
-
enabledTools:
|
|
4950
|
-
disabledTools:
|
|
5182
|
+
var import_mini17 = require("zod/mini");
|
|
5183
|
+
var McpServerSchema = import_mini17.z.object({
|
|
5184
|
+
type: import_mini17.z.optional(import_mini17.z.enum(["stdio", "sse", "http"])),
|
|
5185
|
+
command: import_mini17.z.optional(import_mini17.z.union([import_mini17.z.string(), import_mini17.z.array(import_mini17.z.string())])),
|
|
5186
|
+
args: import_mini17.z.optional(import_mini17.z.array(import_mini17.z.string())),
|
|
5187
|
+
url: import_mini17.z.optional(import_mini17.z.string()),
|
|
5188
|
+
httpUrl: import_mini17.z.optional(import_mini17.z.string()),
|
|
5189
|
+
env: import_mini17.z.optional(import_mini17.z.record(import_mini17.z.string(), import_mini17.z.string())),
|
|
5190
|
+
disabled: import_mini17.z.optional(import_mini17.z.boolean()),
|
|
5191
|
+
networkTimeout: import_mini17.z.optional(import_mini17.z.number()),
|
|
5192
|
+
timeout: import_mini17.z.optional(import_mini17.z.number()),
|
|
5193
|
+
trust: import_mini17.z.optional(import_mini17.z.boolean()),
|
|
5194
|
+
cwd: import_mini17.z.optional(import_mini17.z.string()),
|
|
5195
|
+
transport: import_mini17.z.optional(import_mini17.z.enum(["stdio", "sse", "http"])),
|
|
5196
|
+
alwaysAllow: import_mini17.z.optional(import_mini17.z.array(import_mini17.z.string())),
|
|
5197
|
+
tools: import_mini17.z.optional(import_mini17.z.array(import_mini17.z.string())),
|
|
5198
|
+
kiroAutoApprove: import_mini17.z.optional(import_mini17.z.array(import_mini17.z.string())),
|
|
5199
|
+
kiroAutoBlock: import_mini17.z.optional(import_mini17.z.array(import_mini17.z.string())),
|
|
5200
|
+
headers: import_mini17.z.optional(import_mini17.z.record(import_mini17.z.string(), import_mini17.z.string())),
|
|
5201
|
+
enabledTools: import_mini17.z.optional(import_mini17.z.array(import_mini17.z.string())),
|
|
5202
|
+
disabledTools: import_mini17.z.optional(import_mini17.z.array(import_mini17.z.string()))
|
|
4951
5203
|
});
|
|
4952
|
-
var McpServersSchema =
|
|
5204
|
+
var McpServersSchema = import_mini17.z.record(import_mini17.z.string(), McpServerSchema);
|
|
4953
5205
|
|
|
4954
5206
|
// src/features/mcp/rulesync-mcp.ts
|
|
4955
|
-
var RulesyncMcpServerSchema =
|
|
4956
|
-
targets:
|
|
4957
|
-
description:
|
|
4958
|
-
exposed:
|
|
5207
|
+
var RulesyncMcpServerSchema = import_mini18.z.extend(McpServerSchema, {
|
|
5208
|
+
targets: import_mini18.z.optional(RulesyncTargetsSchema),
|
|
5209
|
+
description: import_mini18.z.optional(import_mini18.z.string()),
|
|
5210
|
+
exposed: import_mini18.z.optional(import_mini18.z.boolean())
|
|
4959
5211
|
});
|
|
4960
|
-
var RulesyncMcpConfigSchema =
|
|
4961
|
-
mcpServers:
|
|
5212
|
+
var RulesyncMcpConfigSchema = import_mini18.z.object({
|
|
5213
|
+
mcpServers: import_mini18.z.record(import_mini18.z.string(), RulesyncMcpServerSchema)
|
|
4962
5214
|
});
|
|
4963
5215
|
var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
4964
5216
|
json;
|
|
@@ -4994,12 +5246,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
4994
5246
|
static async fromFile({ validate = true }) {
|
|
4995
5247
|
const baseDir = process.cwd();
|
|
4996
5248
|
const paths = this.getSettablePaths();
|
|
4997
|
-
const recommendedPath = (0,
|
|
5249
|
+
const recommendedPath = (0, import_node_path40.join)(
|
|
4998
5250
|
baseDir,
|
|
4999
5251
|
paths.recommended.relativeDirPath,
|
|
5000
5252
|
paths.recommended.relativeFilePath
|
|
5001
5253
|
);
|
|
5002
|
-
const legacyPath = (0,
|
|
5254
|
+
const legacyPath = (0, import_node_path40.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
5003
5255
|
if (await fileExists(recommendedPath)) {
|
|
5004
5256
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
5005
5257
|
return new _RulesyncMcp({
|
|
@@ -5144,7 +5396,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
5144
5396
|
global = false
|
|
5145
5397
|
}) {
|
|
5146
5398
|
const paths = this.getSettablePaths({ global });
|
|
5147
|
-
const fileContent = await readFileContentOrNull((0,
|
|
5399
|
+
const fileContent = await readFileContentOrNull((0, import_node_path41.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
5148
5400
|
const json = JSON.parse(fileContent);
|
|
5149
5401
|
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
5150
5402
|
return new _ClaudecodeMcp({
|
|
@@ -5163,7 +5415,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
5163
5415
|
}) {
|
|
5164
5416
|
const paths = this.getSettablePaths({ global });
|
|
5165
5417
|
const fileContent = await readOrInitializeFileContent(
|
|
5166
|
-
(0,
|
|
5418
|
+
(0, import_node_path41.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
5167
5419
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
5168
5420
|
);
|
|
5169
5421
|
const json = JSON.parse(fileContent);
|
|
@@ -5202,7 +5454,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
5202
5454
|
};
|
|
5203
5455
|
|
|
5204
5456
|
// src/features/mcp/cline-mcp.ts
|
|
5205
|
-
var
|
|
5457
|
+
var import_node_path42 = require("path");
|
|
5206
5458
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
5207
5459
|
json;
|
|
5208
5460
|
constructor(params) {
|
|
@@ -5223,7 +5475,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
5223
5475
|
validate = true
|
|
5224
5476
|
}) {
|
|
5225
5477
|
const fileContent = await readFileContent(
|
|
5226
|
-
(0,
|
|
5478
|
+
(0, import_node_path42.join)(
|
|
5227
5479
|
baseDir,
|
|
5228
5480
|
this.getSettablePaths().relativeDirPath,
|
|
5229
5481
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5272,7 +5524,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
5272
5524
|
};
|
|
5273
5525
|
|
|
5274
5526
|
// src/features/mcp/codexcli-mcp.ts
|
|
5275
|
-
var
|
|
5527
|
+
var import_node_path43 = require("path");
|
|
5276
5528
|
var smolToml = __toESM(require("smol-toml"), 1);
|
|
5277
5529
|
function convertFromCodexFormat(codexMcp) {
|
|
5278
5530
|
const result = {};
|
|
@@ -5355,7 +5607,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
5355
5607
|
global = false
|
|
5356
5608
|
}) {
|
|
5357
5609
|
const paths = this.getSettablePaths({ global });
|
|
5358
|
-
const fileContent = await readFileContentOrNull((0,
|
|
5610
|
+
const fileContent = await readFileContentOrNull((0, import_node_path43.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? smolToml.stringify({});
|
|
5359
5611
|
return new _CodexcliMcp({
|
|
5360
5612
|
baseDir,
|
|
5361
5613
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -5371,7 +5623,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
5371
5623
|
global = false
|
|
5372
5624
|
}) {
|
|
5373
5625
|
const paths = this.getSettablePaths({ global });
|
|
5374
|
-
const configTomlFilePath = (0,
|
|
5626
|
+
const configTomlFilePath = (0, import_node_path43.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
5375
5627
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
5376
5628
|
configTomlFilePath,
|
|
5377
5629
|
smolToml.stringify({})
|
|
@@ -5428,7 +5680,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
5428
5680
|
};
|
|
5429
5681
|
|
|
5430
5682
|
// src/features/mcp/copilot-mcp.ts
|
|
5431
|
-
var
|
|
5683
|
+
var import_node_path44 = require("path");
|
|
5432
5684
|
function convertToCopilotFormat(mcpServers) {
|
|
5433
5685
|
return { servers: mcpServers };
|
|
5434
5686
|
}
|
|
@@ -5455,7 +5707,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
5455
5707
|
validate = true
|
|
5456
5708
|
}) {
|
|
5457
5709
|
const fileContent = await readFileContent(
|
|
5458
|
-
(0,
|
|
5710
|
+
(0, import_node_path44.join)(
|
|
5459
5711
|
baseDir,
|
|
5460
5712
|
this.getSettablePaths().relativeDirPath,
|
|
5461
5713
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5508,7 +5760,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
5508
5760
|
};
|
|
5509
5761
|
|
|
5510
5762
|
// src/features/mcp/cursor-mcp.ts
|
|
5511
|
-
var
|
|
5763
|
+
var import_node_path45 = require("path");
|
|
5512
5764
|
var CURSOR_ENV_VAR_PATTERN = /\$\{env:([^}]+)\}/g;
|
|
5513
5765
|
function isMcpServers(value) {
|
|
5514
5766
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
@@ -5569,7 +5821,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
5569
5821
|
validate = true
|
|
5570
5822
|
}) {
|
|
5571
5823
|
const fileContent = await readFileContent(
|
|
5572
|
-
(0,
|
|
5824
|
+
(0, import_node_path45.join)(
|
|
5573
5825
|
baseDir,
|
|
5574
5826
|
this.getSettablePaths().relativeDirPath,
|
|
5575
5827
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5637,7 +5889,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
5637
5889
|
};
|
|
5638
5890
|
|
|
5639
5891
|
// src/features/mcp/factorydroid-mcp.ts
|
|
5640
|
-
var
|
|
5892
|
+
var import_node_path46 = require("path");
|
|
5641
5893
|
var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
5642
5894
|
json;
|
|
5643
5895
|
constructor(params) {
|
|
@@ -5658,7 +5910,7 @@ var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
|
5658
5910
|
validate = true
|
|
5659
5911
|
}) {
|
|
5660
5912
|
const fileContent = await readFileContent(
|
|
5661
|
-
(0,
|
|
5913
|
+
(0, import_node_path46.join)(
|
|
5662
5914
|
baseDir,
|
|
5663
5915
|
this.getSettablePaths().relativeDirPath,
|
|
5664
5916
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5718,7 +5970,7 @@ var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
|
5718
5970
|
};
|
|
5719
5971
|
|
|
5720
5972
|
// src/features/mcp/geminicli-mcp.ts
|
|
5721
|
-
var
|
|
5973
|
+
var import_node_path47 = require("path");
|
|
5722
5974
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
5723
5975
|
json;
|
|
5724
5976
|
constructor(params) {
|
|
@@ -5746,7 +5998,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
5746
5998
|
global = false
|
|
5747
5999
|
}) {
|
|
5748
6000
|
const paths = this.getSettablePaths({ global });
|
|
5749
|
-
const fileContent = await readFileContentOrNull((0,
|
|
6001
|
+
const fileContent = await readFileContentOrNull((0, import_node_path47.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
5750
6002
|
const json = JSON.parse(fileContent);
|
|
5751
6003
|
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
5752
6004
|
return new _GeminiCliMcp({
|
|
@@ -5765,7 +6017,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
5765
6017
|
}) {
|
|
5766
6018
|
const paths = this.getSettablePaths({ global });
|
|
5767
6019
|
const fileContent = await readOrInitializeFileContent(
|
|
5768
|
-
(0,
|
|
6020
|
+
(0, import_node_path47.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
5769
6021
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
5770
6022
|
);
|
|
5771
6023
|
const json = JSON.parse(fileContent);
|
|
@@ -5810,7 +6062,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
5810
6062
|
};
|
|
5811
6063
|
|
|
5812
6064
|
// src/features/mcp/junie-mcp.ts
|
|
5813
|
-
var
|
|
6065
|
+
var import_node_path48 = require("path");
|
|
5814
6066
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
5815
6067
|
json;
|
|
5816
6068
|
constructor(params) {
|
|
@@ -5822,7 +6074,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
5822
6074
|
}
|
|
5823
6075
|
static getSettablePaths() {
|
|
5824
6076
|
return {
|
|
5825
|
-
relativeDirPath: (0,
|
|
6077
|
+
relativeDirPath: (0, import_node_path48.join)(".junie", "mcp"),
|
|
5826
6078
|
relativeFilePath: "mcp.json"
|
|
5827
6079
|
};
|
|
5828
6080
|
}
|
|
@@ -5831,7 +6083,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
5831
6083
|
validate = true
|
|
5832
6084
|
}) {
|
|
5833
6085
|
const fileContent = await readFileContent(
|
|
5834
|
-
(0,
|
|
6086
|
+
(0, import_node_path48.join)(
|
|
5835
6087
|
baseDir,
|
|
5836
6088
|
this.getSettablePaths().relativeDirPath,
|
|
5837
6089
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5880,7 +6132,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
5880
6132
|
};
|
|
5881
6133
|
|
|
5882
6134
|
// src/features/mcp/kilo-mcp.ts
|
|
5883
|
-
var
|
|
6135
|
+
var import_node_path49 = require("path");
|
|
5884
6136
|
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
5885
6137
|
json;
|
|
5886
6138
|
constructor(params) {
|
|
@@ -5901,7 +6153,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
5901
6153
|
validate = true
|
|
5902
6154
|
}) {
|
|
5903
6155
|
const paths = this.getSettablePaths();
|
|
5904
|
-
const fileContent = await readFileContentOrNull((0,
|
|
6156
|
+
const fileContent = await readFileContentOrNull((0, import_node_path49.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
5905
6157
|
return new _KiloMcp({
|
|
5906
6158
|
baseDir,
|
|
5907
6159
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -5949,7 +6201,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
5949
6201
|
};
|
|
5950
6202
|
|
|
5951
6203
|
// src/features/mcp/kiro-mcp.ts
|
|
5952
|
-
var
|
|
6204
|
+
var import_node_path50 = require("path");
|
|
5953
6205
|
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
5954
6206
|
json;
|
|
5955
6207
|
constructor(params) {
|
|
@@ -5961,7 +6213,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
5961
6213
|
}
|
|
5962
6214
|
static getSettablePaths() {
|
|
5963
6215
|
return {
|
|
5964
|
-
relativeDirPath: (0,
|
|
6216
|
+
relativeDirPath: (0, import_node_path50.join)(".kiro", "settings"),
|
|
5965
6217
|
relativeFilePath: "mcp.json"
|
|
5966
6218
|
};
|
|
5967
6219
|
}
|
|
@@ -5970,7 +6222,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
5970
6222
|
validate = true
|
|
5971
6223
|
}) {
|
|
5972
6224
|
const paths = this.getSettablePaths();
|
|
5973
|
-
const fileContent = await readFileContentOrNull((0,
|
|
6225
|
+
const fileContent = await readFileContentOrNull((0, import_node_path50.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
5974
6226
|
return new _KiroMcp({
|
|
5975
6227
|
baseDir,
|
|
5976
6228
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -6018,29 +6270,30 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
6018
6270
|
};
|
|
6019
6271
|
|
|
6020
6272
|
// src/features/mcp/opencode-mcp.ts
|
|
6021
|
-
var
|
|
6022
|
-
var
|
|
6023
|
-
var
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6273
|
+
var import_node_path51 = require("path");
|
|
6274
|
+
var import_jsonc_parser = require("jsonc-parser");
|
|
6275
|
+
var import_mini19 = require("zod/mini");
|
|
6276
|
+
var OpencodeMcpLocalServerSchema = import_mini19.z.object({
|
|
6277
|
+
type: import_mini19.z.literal("local"),
|
|
6278
|
+
command: import_mini19.z.array(import_mini19.z.string()),
|
|
6279
|
+
environment: import_mini19.z.optional(import_mini19.z.record(import_mini19.z.string(), import_mini19.z.string())),
|
|
6280
|
+
enabled: import_mini19.z._default(import_mini19.z.boolean(), true),
|
|
6281
|
+
cwd: import_mini19.z.optional(import_mini19.z.string())
|
|
6029
6282
|
});
|
|
6030
|
-
var OpencodeMcpRemoteServerSchema =
|
|
6031
|
-
type:
|
|
6032
|
-
url:
|
|
6033
|
-
headers:
|
|
6034
|
-
enabled:
|
|
6283
|
+
var OpencodeMcpRemoteServerSchema = import_mini19.z.object({
|
|
6284
|
+
type: import_mini19.z.literal("remote"),
|
|
6285
|
+
url: import_mini19.z.string(),
|
|
6286
|
+
headers: import_mini19.z.optional(import_mini19.z.record(import_mini19.z.string(), import_mini19.z.string())),
|
|
6287
|
+
enabled: import_mini19.z._default(import_mini19.z.boolean(), true)
|
|
6035
6288
|
});
|
|
6036
|
-
var OpencodeMcpServerSchema =
|
|
6289
|
+
var OpencodeMcpServerSchema = import_mini19.z.union([
|
|
6037
6290
|
OpencodeMcpLocalServerSchema,
|
|
6038
6291
|
OpencodeMcpRemoteServerSchema
|
|
6039
6292
|
]);
|
|
6040
|
-
var OpencodeConfigSchema =
|
|
6041
|
-
$schema:
|
|
6042
|
-
mcp:
|
|
6043
|
-
tools:
|
|
6293
|
+
var OpencodeConfigSchema = import_mini19.z.looseObject({
|
|
6294
|
+
$schema: import_mini19.z.optional(import_mini19.z.string()),
|
|
6295
|
+
mcp: import_mini19.z.optional(import_mini19.z.record(import_mini19.z.string(), OpencodeMcpServerSchema)),
|
|
6296
|
+
tools: import_mini19.z.optional(import_mini19.z.record(import_mini19.z.string(), import_mini19.z.boolean()))
|
|
6044
6297
|
});
|
|
6045
6298
|
function convertFromOpencodeFormat(opencodeMcp, tools) {
|
|
6046
6299
|
return Object.fromEntries(
|
|
@@ -6144,7 +6397,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
6144
6397
|
json;
|
|
6145
6398
|
constructor(params) {
|
|
6146
6399
|
super(params);
|
|
6147
|
-
this.json = OpencodeConfigSchema.parse(
|
|
6400
|
+
this.json = OpencodeConfigSchema.parse((0, import_jsonc_parser.parse)(this.fileContent || "{}"));
|
|
6148
6401
|
}
|
|
6149
6402
|
getJson() {
|
|
6150
6403
|
return this.json;
|
|
@@ -6158,7 +6411,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
6158
6411
|
static getSettablePaths({ global } = {}) {
|
|
6159
6412
|
if (global) {
|
|
6160
6413
|
return {
|
|
6161
|
-
relativeDirPath: (0,
|
|
6414
|
+
relativeDirPath: (0, import_node_path51.join)(".config", "opencode"),
|
|
6162
6415
|
relativeFilePath: "opencode.json"
|
|
6163
6416
|
};
|
|
6164
6417
|
}
|
|
@@ -6172,14 +6425,26 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
6172
6425
|
validate = true,
|
|
6173
6426
|
global = false
|
|
6174
6427
|
}) {
|
|
6175
|
-
const
|
|
6176
|
-
const
|
|
6177
|
-
|
|
6428
|
+
const basePaths = this.getSettablePaths({ global });
|
|
6429
|
+
const jsonDir = (0, import_node_path51.join)(baseDir, basePaths.relativeDirPath);
|
|
6430
|
+
let fileContent = null;
|
|
6431
|
+
let relativeFilePath = "opencode.jsonc";
|
|
6432
|
+
const jsoncPath = (0, import_node_path51.join)(jsonDir, "opencode.jsonc");
|
|
6433
|
+
const jsonPath = (0, import_node_path51.join)(jsonDir, "opencode.json");
|
|
6434
|
+
fileContent = await readFileContentOrNull(jsoncPath);
|
|
6435
|
+
if (!fileContent) {
|
|
6436
|
+
fileContent = await readFileContentOrNull(jsonPath);
|
|
6437
|
+
if (fileContent) {
|
|
6438
|
+
relativeFilePath = "opencode.json";
|
|
6439
|
+
}
|
|
6440
|
+
}
|
|
6441
|
+
const fileContentToUse = fileContent ?? '{"mcp":{}}';
|
|
6442
|
+
const json = (0, import_jsonc_parser.parse)(fileContentToUse);
|
|
6178
6443
|
const newJson = { ...json, mcp: json.mcp ?? {} };
|
|
6179
6444
|
return new _OpencodeMcp({
|
|
6180
6445
|
baseDir,
|
|
6181
|
-
relativeDirPath:
|
|
6182
|
-
relativeFilePath
|
|
6446
|
+
relativeDirPath: basePaths.relativeDirPath,
|
|
6447
|
+
relativeFilePath,
|
|
6183
6448
|
fileContent: JSON.stringify(newJson, null, 2),
|
|
6184
6449
|
validate
|
|
6185
6450
|
});
|
|
@@ -6190,12 +6455,23 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
6190
6455
|
validate = true,
|
|
6191
6456
|
global = false
|
|
6192
6457
|
}) {
|
|
6193
|
-
const
|
|
6194
|
-
const
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
);
|
|
6198
|
-
const
|
|
6458
|
+
const basePaths = this.getSettablePaths({ global });
|
|
6459
|
+
const jsonDir = (0, import_node_path51.join)(baseDir, basePaths.relativeDirPath);
|
|
6460
|
+
let fileContent = null;
|
|
6461
|
+
let relativeFilePath = "opencode.jsonc";
|
|
6462
|
+
const jsoncPath = (0, import_node_path51.join)(jsonDir, "opencode.jsonc");
|
|
6463
|
+
const jsonPath = (0, import_node_path51.join)(jsonDir, "opencode.json");
|
|
6464
|
+
fileContent = await readFileContentOrNull(jsoncPath);
|
|
6465
|
+
if (!fileContent) {
|
|
6466
|
+
fileContent = await readFileContentOrNull(jsonPath);
|
|
6467
|
+
if (fileContent) {
|
|
6468
|
+
relativeFilePath = "opencode.json";
|
|
6469
|
+
}
|
|
6470
|
+
}
|
|
6471
|
+
if (!fileContent) {
|
|
6472
|
+
fileContent = JSON.stringify({ mcp: {} }, null, 2);
|
|
6473
|
+
}
|
|
6474
|
+
const json = (0, import_jsonc_parser.parse)(fileContent);
|
|
6199
6475
|
const { mcp: convertedMcp, tools: mcpTools2 } = convertToOpencodeFormat(
|
|
6200
6476
|
rulesyncMcp.getMcpServers()
|
|
6201
6477
|
);
|
|
@@ -6207,8 +6483,8 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
6207
6483
|
};
|
|
6208
6484
|
return new _OpencodeMcp({
|
|
6209
6485
|
baseDir,
|
|
6210
|
-
relativeDirPath:
|
|
6211
|
-
relativeFilePath
|
|
6486
|
+
relativeDirPath: basePaths.relativeDirPath,
|
|
6487
|
+
relativeFilePath,
|
|
6212
6488
|
fileContent: JSON.stringify(newJson, null, 2),
|
|
6213
6489
|
validate
|
|
6214
6490
|
});
|
|
@@ -6245,7 +6521,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
6245
6521
|
};
|
|
6246
6522
|
|
|
6247
6523
|
// src/features/mcp/roo-mcp.ts
|
|
6248
|
-
var
|
|
6524
|
+
var import_node_path52 = require("path");
|
|
6249
6525
|
function isRooMcpServers(value) {
|
|
6250
6526
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
6251
6527
|
}
|
|
@@ -6297,7 +6573,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
6297
6573
|
validate = true
|
|
6298
6574
|
}) {
|
|
6299
6575
|
const fileContent = await readFileContent(
|
|
6300
|
-
(0,
|
|
6576
|
+
(0, import_node_path52.join)(
|
|
6301
6577
|
baseDir,
|
|
6302
6578
|
this.getSettablePaths().relativeDirPath,
|
|
6303
6579
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6368,7 +6644,7 @@ var mcpProcessorToolTargetTuple = [
|
|
|
6368
6644
|
"opencode",
|
|
6369
6645
|
"roo"
|
|
6370
6646
|
];
|
|
6371
|
-
var McpProcessorToolTargetSchema =
|
|
6647
|
+
var McpProcessorToolTargetSchema = import_mini20.z.enum(mcpProcessorToolTargetTuple);
|
|
6372
6648
|
var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
6373
6649
|
[
|
|
6374
6650
|
"claudecode",
|
|
@@ -6670,25 +6946,25 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
6670
6946
|
};
|
|
6671
6947
|
|
|
6672
6948
|
// src/features/rules/rules-processor.ts
|
|
6673
|
-
var
|
|
6949
|
+
var import_node_path112 = require("path");
|
|
6674
6950
|
var import_toon = require("@toon-format/toon");
|
|
6675
|
-
var
|
|
6951
|
+
var import_mini52 = require("zod/mini");
|
|
6676
6952
|
|
|
6677
6953
|
// src/constants/general.ts
|
|
6678
6954
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
6679
6955
|
|
|
6680
6956
|
// src/features/skills/agentsmd-skill.ts
|
|
6681
|
-
var
|
|
6957
|
+
var import_node_path56 = require("path");
|
|
6682
6958
|
|
|
6683
6959
|
// src/features/skills/simulated-skill.ts
|
|
6684
|
-
var
|
|
6685
|
-
var
|
|
6960
|
+
var import_node_path55 = require("path");
|
|
6961
|
+
var import_mini21 = require("zod/mini");
|
|
6686
6962
|
|
|
6687
6963
|
// src/features/skills/tool-skill.ts
|
|
6688
|
-
var
|
|
6964
|
+
var import_node_path54 = require("path");
|
|
6689
6965
|
|
|
6690
6966
|
// src/types/ai-dir.ts
|
|
6691
|
-
var
|
|
6967
|
+
var import_node_path53 = __toESM(require("path"), 1);
|
|
6692
6968
|
var AiDir = class {
|
|
6693
6969
|
/**
|
|
6694
6970
|
* @example "."
|
|
@@ -6722,7 +6998,7 @@ var AiDir = class {
|
|
|
6722
6998
|
otherFiles = [],
|
|
6723
6999
|
global = false
|
|
6724
7000
|
}) {
|
|
6725
|
-
if (dirName.includes(
|
|
7001
|
+
if (dirName.includes(import_node_path53.default.sep) || dirName.includes("/") || dirName.includes("\\")) {
|
|
6726
7002
|
throw new Error(`Directory name cannot contain path separators: dirName="${dirName}"`);
|
|
6727
7003
|
}
|
|
6728
7004
|
this.baseDir = baseDir;
|
|
@@ -6745,11 +7021,11 @@ var AiDir = class {
|
|
|
6745
7021
|
return this.dirName;
|
|
6746
7022
|
}
|
|
6747
7023
|
getDirPath() {
|
|
6748
|
-
const fullPath =
|
|
6749
|
-
const resolvedFull = (0,
|
|
6750
|
-
const resolvedBase = (0,
|
|
6751
|
-
const rel = (0,
|
|
6752
|
-
if (rel.startsWith("..") ||
|
|
7024
|
+
const fullPath = import_node_path53.default.join(this.baseDir, this.relativeDirPath, this.dirName);
|
|
7025
|
+
const resolvedFull = (0, import_node_path53.resolve)(fullPath);
|
|
7026
|
+
const resolvedBase = (0, import_node_path53.resolve)(this.baseDir);
|
|
7027
|
+
const rel = (0, import_node_path53.relative)(resolvedBase, resolvedFull);
|
|
7028
|
+
if (rel.startsWith("..") || import_node_path53.default.isAbsolute(rel)) {
|
|
6753
7029
|
throw new Error(
|
|
6754
7030
|
`Path traversal detected: Final path escapes baseDir. baseDir="${this.baseDir}", relativeDirPath="${this.relativeDirPath}", dirName="${this.dirName}"`
|
|
6755
7031
|
);
|
|
@@ -6763,7 +7039,7 @@ var AiDir = class {
|
|
|
6763
7039
|
return this.otherFiles;
|
|
6764
7040
|
}
|
|
6765
7041
|
getRelativePathFromCwd() {
|
|
6766
|
-
return
|
|
7042
|
+
return import_node_path53.default.join(this.relativeDirPath, this.dirName);
|
|
6767
7043
|
}
|
|
6768
7044
|
getGlobal() {
|
|
6769
7045
|
return this.global;
|
|
@@ -6782,15 +7058,15 @@ var AiDir = class {
|
|
|
6782
7058
|
* @returns Array of files with their relative paths and buffers
|
|
6783
7059
|
*/
|
|
6784
7060
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
6785
|
-
const dirPath = (0,
|
|
6786
|
-
const glob = (0,
|
|
7061
|
+
const dirPath = (0, import_node_path53.join)(baseDir, relativeDirPath, dirName);
|
|
7062
|
+
const glob = (0, import_node_path53.join)(dirPath, "**", "*");
|
|
6787
7063
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
6788
|
-
const filteredPaths = filePaths.filter((filePath) => (0,
|
|
7064
|
+
const filteredPaths = filePaths.filter((filePath) => (0, import_node_path53.basename)(filePath) !== excludeFileName);
|
|
6789
7065
|
const files = await Promise.all(
|
|
6790
7066
|
filteredPaths.map(async (filePath) => {
|
|
6791
7067
|
const fileBuffer = await readFileBuffer(filePath);
|
|
6792
7068
|
return {
|
|
6793
|
-
relativeFilePathToDirPath: (0,
|
|
7069
|
+
relativeFilePathToDirPath: (0, import_node_path53.relative)(dirPath, filePath),
|
|
6794
7070
|
fileBuffer
|
|
6795
7071
|
};
|
|
6796
7072
|
})
|
|
@@ -6881,8 +7157,8 @@ var ToolSkill = class extends AiDir {
|
|
|
6881
7157
|
}) {
|
|
6882
7158
|
const settablePaths = getSettablePaths({ global });
|
|
6883
7159
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
6884
|
-
const skillDirPath = (0,
|
|
6885
|
-
const skillFilePath = (0,
|
|
7160
|
+
const skillDirPath = (0, import_node_path54.join)(baseDir, actualRelativeDirPath, dirName);
|
|
7161
|
+
const skillFilePath = (0, import_node_path54.join)(skillDirPath, SKILL_FILE_NAME);
|
|
6886
7162
|
if (!await fileExists(skillFilePath)) {
|
|
6887
7163
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
6888
7164
|
}
|
|
@@ -6906,16 +7182,16 @@ var ToolSkill = class extends AiDir {
|
|
|
6906
7182
|
}
|
|
6907
7183
|
requireMainFileFrontmatter() {
|
|
6908
7184
|
if (!this.mainFile?.frontmatter) {
|
|
6909
|
-
throw new Error(`Frontmatter is not defined in ${(0,
|
|
7185
|
+
throw new Error(`Frontmatter is not defined in ${(0, import_node_path54.join)(this.relativeDirPath, this.dirName)}`);
|
|
6910
7186
|
}
|
|
6911
7187
|
return this.mainFile.frontmatter;
|
|
6912
7188
|
}
|
|
6913
7189
|
};
|
|
6914
7190
|
|
|
6915
7191
|
// src/features/skills/simulated-skill.ts
|
|
6916
|
-
var SimulatedSkillFrontmatterSchema =
|
|
6917
|
-
name:
|
|
6918
|
-
description:
|
|
7192
|
+
var SimulatedSkillFrontmatterSchema = import_mini21.z.looseObject({
|
|
7193
|
+
name: import_mini21.z.string(),
|
|
7194
|
+
description: import_mini21.z.string()
|
|
6919
7195
|
});
|
|
6920
7196
|
var SimulatedSkill = class extends ToolSkill {
|
|
6921
7197
|
frontmatter;
|
|
@@ -6946,7 +7222,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
6946
7222
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
6947
7223
|
if (!result.success) {
|
|
6948
7224
|
throw new Error(
|
|
6949
|
-
`Invalid frontmatter in ${(0,
|
|
7225
|
+
`Invalid frontmatter in ${(0, import_node_path55.join)(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
6950
7226
|
);
|
|
6951
7227
|
}
|
|
6952
7228
|
}
|
|
@@ -7004,8 +7280,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
7004
7280
|
}) {
|
|
7005
7281
|
const settablePaths = this.getSettablePaths();
|
|
7006
7282
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
7007
|
-
const skillDirPath = (0,
|
|
7008
|
-
const skillFilePath = (0,
|
|
7283
|
+
const skillDirPath = (0, import_node_path55.join)(baseDir, actualRelativeDirPath, dirName);
|
|
7284
|
+
const skillFilePath = (0, import_node_path55.join)(skillDirPath, SKILL_FILE_NAME);
|
|
7009
7285
|
if (!await fileExists(skillFilePath)) {
|
|
7010
7286
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
7011
7287
|
}
|
|
@@ -7082,7 +7358,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
7082
7358
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
7083
7359
|
}
|
|
7084
7360
|
return {
|
|
7085
|
-
relativeDirPath: (0,
|
|
7361
|
+
relativeDirPath: (0, import_node_path56.join)(".agents", "skills")
|
|
7086
7362
|
};
|
|
7087
7363
|
}
|
|
7088
7364
|
static async fromDir(params) {
|
|
@@ -7109,11 +7385,11 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
7109
7385
|
};
|
|
7110
7386
|
|
|
7111
7387
|
// src/features/skills/factorydroid-skill.ts
|
|
7112
|
-
var
|
|
7388
|
+
var import_node_path57 = require("path");
|
|
7113
7389
|
var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
7114
7390
|
static getSettablePaths(_options) {
|
|
7115
7391
|
return {
|
|
7116
|
-
relativeDirPath: (0,
|
|
7392
|
+
relativeDirPath: (0, import_node_path57.join)(".factory", "skills")
|
|
7117
7393
|
};
|
|
7118
7394
|
}
|
|
7119
7395
|
static async fromDir(params) {
|
|
@@ -7140,11 +7416,11 @@ var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
|
7140
7416
|
};
|
|
7141
7417
|
|
|
7142
7418
|
// src/features/skills/skills-processor.ts
|
|
7143
|
-
var
|
|
7144
|
-
var
|
|
7419
|
+
var import_node_path74 = require("path");
|
|
7420
|
+
var import_mini36 = require("zod/mini");
|
|
7145
7421
|
|
|
7146
7422
|
// src/types/dir-feature-processor.ts
|
|
7147
|
-
var
|
|
7423
|
+
var import_node_path58 = require("path");
|
|
7148
7424
|
var DirFeatureProcessor = class {
|
|
7149
7425
|
baseDir;
|
|
7150
7426
|
dryRun;
|
|
@@ -7175,7 +7451,7 @@ var DirFeatureProcessor = class {
|
|
|
7175
7451
|
const mainFile = aiDir.getMainFile();
|
|
7176
7452
|
let mainFileContent;
|
|
7177
7453
|
if (mainFile) {
|
|
7178
|
-
const mainFilePath = (0,
|
|
7454
|
+
const mainFilePath = (0, import_node_path58.join)(dirPath, mainFile.name);
|
|
7179
7455
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
7180
7456
|
mainFileContent = addTrailingNewline(content);
|
|
7181
7457
|
const existingContent = await readFileContentOrNull(mainFilePath);
|
|
@@ -7189,7 +7465,7 @@ var DirFeatureProcessor = class {
|
|
|
7189
7465
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
7190
7466
|
otherFileContents.push(contentWithNewline);
|
|
7191
7467
|
if (!dirHasChanges) {
|
|
7192
|
-
const filePath = (0,
|
|
7468
|
+
const filePath = (0, import_node_path58.join)(dirPath, file.relativeFilePathToDirPath);
|
|
7193
7469
|
const existingContent = await readFileContentOrNull(filePath);
|
|
7194
7470
|
if (existingContent !== contentWithNewline) {
|
|
7195
7471
|
dirHasChanges = true;
|
|
@@ -7203,22 +7479,22 @@ var DirFeatureProcessor = class {
|
|
|
7203
7479
|
if (this.dryRun) {
|
|
7204
7480
|
logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
|
|
7205
7481
|
if (mainFile) {
|
|
7206
|
-
logger.info(`[DRY RUN] Would write: ${(0,
|
|
7207
|
-
changedPaths.push((0,
|
|
7482
|
+
logger.info(`[DRY RUN] Would write: ${(0, import_node_path58.join)(dirPath, mainFile.name)}`);
|
|
7483
|
+
changedPaths.push((0, import_node_path58.join)(relativeDir, mainFile.name));
|
|
7208
7484
|
}
|
|
7209
7485
|
for (const file of otherFiles) {
|
|
7210
|
-
logger.info(`[DRY RUN] Would write: ${(0,
|
|
7211
|
-
changedPaths.push((0,
|
|
7486
|
+
logger.info(`[DRY RUN] Would write: ${(0, import_node_path58.join)(dirPath, file.relativeFilePathToDirPath)}`);
|
|
7487
|
+
changedPaths.push((0, import_node_path58.join)(relativeDir, file.relativeFilePathToDirPath));
|
|
7212
7488
|
}
|
|
7213
7489
|
} else {
|
|
7214
7490
|
await ensureDir(dirPath);
|
|
7215
7491
|
if (mainFile && mainFileContent) {
|
|
7216
|
-
const mainFilePath = (0,
|
|
7492
|
+
const mainFilePath = (0, import_node_path58.join)(dirPath, mainFile.name);
|
|
7217
7493
|
await writeFileContent(mainFilePath, mainFileContent);
|
|
7218
|
-
changedPaths.push((0,
|
|
7494
|
+
changedPaths.push((0, import_node_path58.join)(relativeDir, mainFile.name));
|
|
7219
7495
|
}
|
|
7220
7496
|
for (const [i, file] of otherFiles.entries()) {
|
|
7221
|
-
const filePath = (0,
|
|
7497
|
+
const filePath = (0, import_node_path58.join)(dirPath, file.relativeFilePathToDirPath);
|
|
7222
7498
|
const content = otherFileContents[i];
|
|
7223
7499
|
if (content === void 0) {
|
|
7224
7500
|
throw new Error(
|
|
@@ -7226,7 +7502,7 @@ var DirFeatureProcessor = class {
|
|
|
7226
7502
|
);
|
|
7227
7503
|
}
|
|
7228
7504
|
await writeFileContent(filePath, content);
|
|
7229
|
-
changedPaths.push((0,
|
|
7505
|
+
changedPaths.push((0, import_node_path58.join)(relativeDir, file.relativeFilePathToDirPath));
|
|
7230
7506
|
}
|
|
7231
7507
|
}
|
|
7232
7508
|
changedCount++;
|
|
@@ -7258,38 +7534,38 @@ var DirFeatureProcessor = class {
|
|
|
7258
7534
|
};
|
|
7259
7535
|
|
|
7260
7536
|
// src/features/skills/agentsskills-skill.ts
|
|
7261
|
-
var
|
|
7262
|
-
var
|
|
7537
|
+
var import_node_path60 = require("path");
|
|
7538
|
+
var import_mini23 = require("zod/mini");
|
|
7263
7539
|
|
|
7264
7540
|
// src/features/skills/rulesync-skill.ts
|
|
7265
|
-
var
|
|
7266
|
-
var
|
|
7267
|
-
var RulesyncSkillFrontmatterSchemaInternal =
|
|
7268
|
-
name:
|
|
7269
|
-
description:
|
|
7270
|
-
targets:
|
|
7271
|
-
claudecode:
|
|
7272
|
-
|
|
7273
|
-
"allowed-tools":
|
|
7541
|
+
var import_node_path59 = require("path");
|
|
7542
|
+
var import_mini22 = require("zod/mini");
|
|
7543
|
+
var RulesyncSkillFrontmatterSchemaInternal = import_mini22.z.looseObject({
|
|
7544
|
+
name: import_mini22.z.string(),
|
|
7545
|
+
description: import_mini22.z.string(),
|
|
7546
|
+
targets: import_mini22.z._default(RulesyncTargetsSchema, ["*"]),
|
|
7547
|
+
claudecode: import_mini22.z.optional(
|
|
7548
|
+
import_mini22.z.looseObject({
|
|
7549
|
+
"allowed-tools": import_mini22.z.optional(import_mini22.z.array(import_mini22.z.string()))
|
|
7274
7550
|
})
|
|
7275
7551
|
),
|
|
7276
|
-
codexcli:
|
|
7277
|
-
|
|
7278
|
-
"short-description":
|
|
7552
|
+
codexcli: import_mini22.z.optional(
|
|
7553
|
+
import_mini22.z.looseObject({
|
|
7554
|
+
"short-description": import_mini22.z.optional(import_mini22.z.string())
|
|
7279
7555
|
})
|
|
7280
7556
|
),
|
|
7281
|
-
opencode:
|
|
7282
|
-
|
|
7283
|
-
"allowed-tools":
|
|
7557
|
+
opencode: import_mini22.z.optional(
|
|
7558
|
+
import_mini22.z.looseObject({
|
|
7559
|
+
"allowed-tools": import_mini22.z.optional(import_mini22.z.array(import_mini22.z.string()))
|
|
7284
7560
|
})
|
|
7285
7561
|
),
|
|
7286
|
-
copilot:
|
|
7287
|
-
|
|
7288
|
-
license:
|
|
7562
|
+
copilot: import_mini22.z.optional(
|
|
7563
|
+
import_mini22.z.looseObject({
|
|
7564
|
+
license: import_mini22.z.optional(import_mini22.z.string())
|
|
7289
7565
|
})
|
|
7290
7566
|
),
|
|
7291
|
-
cline:
|
|
7292
|
-
roo:
|
|
7567
|
+
cline: import_mini22.z.optional(import_mini22.z.looseObject({})),
|
|
7568
|
+
roo: import_mini22.z.optional(import_mini22.z.looseObject({}))
|
|
7293
7569
|
});
|
|
7294
7570
|
var RulesyncSkillFrontmatterSchema = RulesyncSkillFrontmatterSchemaInternal;
|
|
7295
7571
|
var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
@@ -7329,7 +7605,7 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
7329
7605
|
}
|
|
7330
7606
|
getFrontmatter() {
|
|
7331
7607
|
if (!this.mainFile?.frontmatter) {
|
|
7332
|
-
throw new Error(`Frontmatter is not defined in ${(0,
|
|
7608
|
+
throw new Error(`Frontmatter is not defined in ${(0, import_node_path59.join)(this.relativeDirPath, this.dirName)}`);
|
|
7333
7609
|
}
|
|
7334
7610
|
const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
7335
7611
|
return result;
|
|
@@ -7355,8 +7631,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
7355
7631
|
dirName,
|
|
7356
7632
|
global = false
|
|
7357
7633
|
}) {
|
|
7358
|
-
const skillDirPath = (0,
|
|
7359
|
-
const skillFilePath = (0,
|
|
7634
|
+
const skillDirPath = (0, import_node_path59.join)(baseDir, relativeDirPath, dirName);
|
|
7635
|
+
const skillFilePath = (0, import_node_path59.join)(skillDirPath, SKILL_FILE_NAME);
|
|
7360
7636
|
if (!await fileExists(skillFilePath)) {
|
|
7361
7637
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
7362
7638
|
}
|
|
@@ -7386,14 +7662,14 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
7386
7662
|
};
|
|
7387
7663
|
|
|
7388
7664
|
// src/features/skills/agentsskills-skill.ts
|
|
7389
|
-
var AgentsSkillsSkillFrontmatterSchema =
|
|
7390
|
-
name:
|
|
7391
|
-
description:
|
|
7665
|
+
var AgentsSkillsSkillFrontmatterSchema = import_mini23.z.looseObject({
|
|
7666
|
+
name: import_mini23.z.string(),
|
|
7667
|
+
description: import_mini23.z.string()
|
|
7392
7668
|
});
|
|
7393
7669
|
var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
7394
7670
|
constructor({
|
|
7395
7671
|
baseDir = process.cwd(),
|
|
7396
|
-
relativeDirPath = (0,
|
|
7672
|
+
relativeDirPath = (0, import_node_path60.join)(".agents", "skills"),
|
|
7397
7673
|
dirName,
|
|
7398
7674
|
frontmatter,
|
|
7399
7675
|
body,
|
|
@@ -7425,7 +7701,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
7425
7701
|
throw new Error("AgentsSkillsSkill does not support global mode.");
|
|
7426
7702
|
}
|
|
7427
7703
|
return {
|
|
7428
|
-
relativeDirPath: (0,
|
|
7704
|
+
relativeDirPath: (0, import_node_path60.join)(".agents", "skills")
|
|
7429
7705
|
};
|
|
7430
7706
|
}
|
|
7431
7707
|
getFrontmatter() {
|
|
@@ -7504,9 +7780,9 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
7504
7780
|
});
|
|
7505
7781
|
const result = AgentsSkillsSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7506
7782
|
if (!result.success) {
|
|
7507
|
-
const skillDirPath = (0,
|
|
7783
|
+
const skillDirPath = (0, import_node_path60.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7508
7784
|
throw new Error(
|
|
7509
|
-
`Invalid frontmatter in ${(0,
|
|
7785
|
+
`Invalid frontmatter in ${(0, import_node_path60.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7510
7786
|
);
|
|
7511
7787
|
}
|
|
7512
7788
|
return new _AgentsSkillsSkill({
|
|
@@ -7541,16 +7817,16 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
7541
7817
|
};
|
|
7542
7818
|
|
|
7543
7819
|
// src/features/skills/antigravity-skill.ts
|
|
7544
|
-
var
|
|
7545
|
-
var
|
|
7546
|
-
var AntigravitySkillFrontmatterSchema =
|
|
7547
|
-
name:
|
|
7548
|
-
description:
|
|
7820
|
+
var import_node_path61 = require("path");
|
|
7821
|
+
var import_mini24 = require("zod/mini");
|
|
7822
|
+
var AntigravitySkillFrontmatterSchema = import_mini24.z.looseObject({
|
|
7823
|
+
name: import_mini24.z.string(),
|
|
7824
|
+
description: import_mini24.z.string()
|
|
7549
7825
|
});
|
|
7550
7826
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
7551
7827
|
constructor({
|
|
7552
7828
|
baseDir = process.cwd(),
|
|
7553
|
-
relativeDirPath = (0,
|
|
7829
|
+
relativeDirPath = (0, import_node_path61.join)(".agent", "skills"),
|
|
7554
7830
|
dirName,
|
|
7555
7831
|
frontmatter,
|
|
7556
7832
|
body,
|
|
@@ -7582,11 +7858,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
7582
7858
|
} = {}) {
|
|
7583
7859
|
if (global) {
|
|
7584
7860
|
return {
|
|
7585
|
-
relativeDirPath: (0,
|
|
7861
|
+
relativeDirPath: (0, import_node_path61.join)(".gemini", "antigravity", "skills")
|
|
7586
7862
|
};
|
|
7587
7863
|
}
|
|
7588
7864
|
return {
|
|
7589
|
-
relativeDirPath: (0,
|
|
7865
|
+
relativeDirPath: (0, import_node_path61.join)(".agent", "skills")
|
|
7590
7866
|
};
|
|
7591
7867
|
}
|
|
7592
7868
|
getFrontmatter() {
|
|
@@ -7665,9 +7941,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
7665
7941
|
});
|
|
7666
7942
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7667
7943
|
if (!result.success) {
|
|
7668
|
-
const skillDirPath = (0,
|
|
7944
|
+
const skillDirPath = (0, import_node_path61.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7669
7945
|
throw new Error(
|
|
7670
|
-
`Invalid frontmatter in ${(0,
|
|
7946
|
+
`Invalid frontmatter in ${(0, import_node_path61.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7671
7947
|
);
|
|
7672
7948
|
}
|
|
7673
7949
|
return new _AntigravitySkill({
|
|
@@ -7701,17 +7977,17 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
7701
7977
|
};
|
|
7702
7978
|
|
|
7703
7979
|
// src/features/skills/claudecode-skill.ts
|
|
7704
|
-
var
|
|
7705
|
-
var
|
|
7706
|
-
var ClaudecodeSkillFrontmatterSchema =
|
|
7707
|
-
name:
|
|
7708
|
-
description:
|
|
7709
|
-
"allowed-tools":
|
|
7980
|
+
var import_node_path62 = require("path");
|
|
7981
|
+
var import_mini25 = require("zod/mini");
|
|
7982
|
+
var ClaudecodeSkillFrontmatterSchema = import_mini25.z.looseObject({
|
|
7983
|
+
name: import_mini25.z.string(),
|
|
7984
|
+
description: import_mini25.z.string(),
|
|
7985
|
+
"allowed-tools": import_mini25.z.optional(import_mini25.z.array(import_mini25.z.string()))
|
|
7710
7986
|
});
|
|
7711
7987
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
7712
7988
|
constructor({
|
|
7713
7989
|
baseDir = process.cwd(),
|
|
7714
|
-
relativeDirPath = (0,
|
|
7990
|
+
relativeDirPath = (0, import_node_path62.join)(".claude", "skills"),
|
|
7715
7991
|
dirName,
|
|
7716
7992
|
frontmatter,
|
|
7717
7993
|
body,
|
|
@@ -7742,7 +8018,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
7742
8018
|
global: _global = false
|
|
7743
8019
|
} = {}) {
|
|
7744
8020
|
return {
|
|
7745
|
-
relativeDirPath: (0,
|
|
8021
|
+
relativeDirPath: (0, import_node_path62.join)(".claude", "skills")
|
|
7746
8022
|
};
|
|
7747
8023
|
}
|
|
7748
8024
|
getFrontmatter() {
|
|
@@ -7827,9 +8103,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
7827
8103
|
});
|
|
7828
8104
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7829
8105
|
if (!result.success) {
|
|
7830
|
-
const skillDirPath = (0,
|
|
8106
|
+
const skillDirPath = (0, import_node_path62.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7831
8107
|
throw new Error(
|
|
7832
|
-
`Invalid frontmatter in ${(0,
|
|
8108
|
+
`Invalid frontmatter in ${(0, import_node_path62.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7833
8109
|
);
|
|
7834
8110
|
}
|
|
7835
8111
|
return new _ClaudecodeSkill({
|
|
@@ -7863,16 +8139,16 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
7863
8139
|
};
|
|
7864
8140
|
|
|
7865
8141
|
// src/features/skills/cline-skill.ts
|
|
7866
|
-
var
|
|
7867
|
-
var
|
|
7868
|
-
var ClineSkillFrontmatterSchema =
|
|
7869
|
-
name:
|
|
7870
|
-
description:
|
|
8142
|
+
var import_node_path63 = require("path");
|
|
8143
|
+
var import_mini26 = require("zod/mini");
|
|
8144
|
+
var ClineSkillFrontmatterSchema = import_mini26.z.looseObject({
|
|
8145
|
+
name: import_mini26.z.string(),
|
|
8146
|
+
description: import_mini26.z.string()
|
|
7871
8147
|
});
|
|
7872
8148
|
var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
7873
8149
|
constructor({
|
|
7874
8150
|
baseDir = process.cwd(),
|
|
7875
|
-
relativeDirPath = (0,
|
|
8151
|
+
relativeDirPath = (0, import_node_path63.join)(".cline", "skills"),
|
|
7876
8152
|
dirName,
|
|
7877
8153
|
frontmatter,
|
|
7878
8154
|
body,
|
|
@@ -7901,7 +8177,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
7901
8177
|
}
|
|
7902
8178
|
static getSettablePaths(_options = {}) {
|
|
7903
8179
|
return {
|
|
7904
|
-
relativeDirPath: (0,
|
|
8180
|
+
relativeDirPath: (0, import_node_path63.join)(".cline", "skills")
|
|
7905
8181
|
};
|
|
7906
8182
|
}
|
|
7907
8183
|
getFrontmatter() {
|
|
@@ -7988,13 +8264,13 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
7988
8264
|
});
|
|
7989
8265
|
const result = ClineSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7990
8266
|
if (!result.success) {
|
|
7991
|
-
const skillDirPath = (0,
|
|
8267
|
+
const skillDirPath = (0, import_node_path63.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7992
8268
|
throw new Error(
|
|
7993
|
-
`Invalid frontmatter in ${(0,
|
|
8269
|
+
`Invalid frontmatter in ${(0, import_node_path63.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7994
8270
|
);
|
|
7995
8271
|
}
|
|
7996
8272
|
if (result.data.name !== loaded.dirName) {
|
|
7997
|
-
const skillFilePath = (0,
|
|
8273
|
+
const skillFilePath = (0, import_node_path63.join)(
|
|
7998
8274
|
loaded.baseDir,
|
|
7999
8275
|
loaded.relativeDirPath,
|
|
8000
8276
|
loaded.dirName,
|
|
@@ -8035,21 +8311,21 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
8035
8311
|
};
|
|
8036
8312
|
|
|
8037
8313
|
// src/features/skills/codexcli-skill.ts
|
|
8038
|
-
var
|
|
8039
|
-
var
|
|
8040
|
-
var CodexCliSkillFrontmatterSchema =
|
|
8041
|
-
name:
|
|
8042
|
-
description:
|
|
8043
|
-
metadata:
|
|
8044
|
-
|
|
8045
|
-
"short-description":
|
|
8314
|
+
var import_node_path64 = require("path");
|
|
8315
|
+
var import_mini27 = require("zod/mini");
|
|
8316
|
+
var CodexCliSkillFrontmatterSchema = import_mini27.z.looseObject({
|
|
8317
|
+
name: import_mini27.z.string(),
|
|
8318
|
+
description: import_mini27.z.string(),
|
|
8319
|
+
metadata: import_mini27.z.optional(
|
|
8320
|
+
import_mini27.z.looseObject({
|
|
8321
|
+
"short-description": import_mini27.z.optional(import_mini27.z.string())
|
|
8046
8322
|
})
|
|
8047
8323
|
)
|
|
8048
8324
|
});
|
|
8049
8325
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
8050
8326
|
constructor({
|
|
8051
8327
|
baseDir = process.cwd(),
|
|
8052
|
-
relativeDirPath = (0,
|
|
8328
|
+
relativeDirPath = (0, import_node_path64.join)(".codex", "skills"),
|
|
8053
8329
|
dirName,
|
|
8054
8330
|
frontmatter,
|
|
8055
8331
|
body,
|
|
@@ -8080,7 +8356,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
8080
8356
|
global: _global = false
|
|
8081
8357
|
} = {}) {
|
|
8082
8358
|
return {
|
|
8083
|
-
relativeDirPath: (0,
|
|
8359
|
+
relativeDirPath: (0, import_node_path64.join)(".codex", "skills")
|
|
8084
8360
|
};
|
|
8085
8361
|
}
|
|
8086
8362
|
getFrontmatter() {
|
|
@@ -8169,9 +8445,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
8169
8445
|
});
|
|
8170
8446
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8171
8447
|
if (!result.success) {
|
|
8172
|
-
const skillDirPath = (0,
|
|
8448
|
+
const skillDirPath = (0, import_node_path64.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8173
8449
|
throw new Error(
|
|
8174
|
-
`Invalid frontmatter in ${(0,
|
|
8450
|
+
`Invalid frontmatter in ${(0, import_node_path64.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8175
8451
|
);
|
|
8176
8452
|
}
|
|
8177
8453
|
return new _CodexCliSkill({
|
|
@@ -8205,17 +8481,17 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
8205
8481
|
};
|
|
8206
8482
|
|
|
8207
8483
|
// src/features/skills/copilot-skill.ts
|
|
8208
|
-
var
|
|
8209
|
-
var
|
|
8210
|
-
var CopilotSkillFrontmatterSchema =
|
|
8211
|
-
name:
|
|
8212
|
-
description:
|
|
8213
|
-
license:
|
|
8484
|
+
var import_node_path65 = require("path");
|
|
8485
|
+
var import_mini28 = require("zod/mini");
|
|
8486
|
+
var CopilotSkillFrontmatterSchema = import_mini28.z.looseObject({
|
|
8487
|
+
name: import_mini28.z.string(),
|
|
8488
|
+
description: import_mini28.z.string(),
|
|
8489
|
+
license: import_mini28.z.optional(import_mini28.z.string())
|
|
8214
8490
|
});
|
|
8215
8491
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
8216
8492
|
constructor({
|
|
8217
8493
|
baseDir = process.cwd(),
|
|
8218
|
-
relativeDirPath = (0,
|
|
8494
|
+
relativeDirPath = (0, import_node_path65.join)(".github", "skills"),
|
|
8219
8495
|
dirName,
|
|
8220
8496
|
frontmatter,
|
|
8221
8497
|
body,
|
|
@@ -8247,7 +8523,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
8247
8523
|
throw new Error("CopilotSkill does not support global mode.");
|
|
8248
8524
|
}
|
|
8249
8525
|
return {
|
|
8250
|
-
relativeDirPath: (0,
|
|
8526
|
+
relativeDirPath: (0, import_node_path65.join)(".github", "skills")
|
|
8251
8527
|
};
|
|
8252
8528
|
}
|
|
8253
8529
|
getFrontmatter() {
|
|
@@ -8332,9 +8608,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
8332
8608
|
});
|
|
8333
8609
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8334
8610
|
if (!result.success) {
|
|
8335
|
-
const skillDirPath = (0,
|
|
8611
|
+
const skillDirPath = (0, import_node_path65.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8336
8612
|
throw new Error(
|
|
8337
|
-
`Invalid frontmatter in ${(0,
|
|
8613
|
+
`Invalid frontmatter in ${(0, import_node_path65.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8338
8614
|
);
|
|
8339
8615
|
}
|
|
8340
8616
|
return new _CopilotSkill({
|
|
@@ -8369,16 +8645,16 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
8369
8645
|
};
|
|
8370
8646
|
|
|
8371
8647
|
// src/features/skills/cursor-skill.ts
|
|
8372
|
-
var
|
|
8373
|
-
var
|
|
8374
|
-
var CursorSkillFrontmatterSchema =
|
|
8375
|
-
name:
|
|
8376
|
-
description:
|
|
8648
|
+
var import_node_path66 = require("path");
|
|
8649
|
+
var import_mini29 = require("zod/mini");
|
|
8650
|
+
var CursorSkillFrontmatterSchema = import_mini29.z.looseObject({
|
|
8651
|
+
name: import_mini29.z.string(),
|
|
8652
|
+
description: import_mini29.z.string()
|
|
8377
8653
|
});
|
|
8378
8654
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
8379
8655
|
constructor({
|
|
8380
8656
|
baseDir = process.cwd(),
|
|
8381
|
-
relativeDirPath = (0,
|
|
8657
|
+
relativeDirPath = (0, import_node_path66.join)(".cursor", "skills"),
|
|
8382
8658
|
dirName,
|
|
8383
8659
|
frontmatter,
|
|
8384
8660
|
body,
|
|
@@ -8407,7 +8683,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
8407
8683
|
}
|
|
8408
8684
|
static getSettablePaths(_options) {
|
|
8409
8685
|
return {
|
|
8410
|
-
relativeDirPath: (0,
|
|
8686
|
+
relativeDirPath: (0, import_node_path66.join)(".cursor", "skills")
|
|
8411
8687
|
};
|
|
8412
8688
|
}
|
|
8413
8689
|
getFrontmatter() {
|
|
@@ -8486,9 +8762,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
8486
8762
|
});
|
|
8487
8763
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8488
8764
|
if (!result.success) {
|
|
8489
|
-
const skillDirPath = (0,
|
|
8765
|
+
const skillDirPath = (0, import_node_path66.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8490
8766
|
throw new Error(
|
|
8491
|
-
`Invalid frontmatter in ${(0,
|
|
8767
|
+
`Invalid frontmatter in ${(0, import_node_path66.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8492
8768
|
);
|
|
8493
8769
|
}
|
|
8494
8770
|
return new _CursorSkill({
|
|
@@ -8523,11 +8799,11 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
8523
8799
|
};
|
|
8524
8800
|
|
|
8525
8801
|
// src/features/skills/geminicli-skill.ts
|
|
8526
|
-
var
|
|
8527
|
-
var
|
|
8528
|
-
var GeminiCliSkillFrontmatterSchema =
|
|
8529
|
-
name:
|
|
8530
|
-
description:
|
|
8802
|
+
var import_node_path67 = require("path");
|
|
8803
|
+
var import_mini30 = require("zod/mini");
|
|
8804
|
+
var GeminiCliSkillFrontmatterSchema = import_mini30.z.looseObject({
|
|
8805
|
+
name: import_mini30.z.string(),
|
|
8806
|
+
description: import_mini30.z.string()
|
|
8531
8807
|
});
|
|
8532
8808
|
var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
8533
8809
|
constructor({
|
|
@@ -8563,7 +8839,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
8563
8839
|
global: _global = false
|
|
8564
8840
|
} = {}) {
|
|
8565
8841
|
return {
|
|
8566
|
-
relativeDirPath: (0,
|
|
8842
|
+
relativeDirPath: (0, import_node_path67.join)(".gemini", "skills")
|
|
8567
8843
|
};
|
|
8568
8844
|
}
|
|
8569
8845
|
getFrontmatter() {
|
|
@@ -8642,9 +8918,9 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
8642
8918
|
});
|
|
8643
8919
|
const result = GeminiCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8644
8920
|
if (!result.success) {
|
|
8645
|
-
const skillDirPath = (0,
|
|
8921
|
+
const skillDirPath = (0, import_node_path67.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8646
8922
|
throw new Error(
|
|
8647
|
-
`Invalid frontmatter in ${(0,
|
|
8923
|
+
`Invalid frontmatter in ${(0, import_node_path67.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8648
8924
|
);
|
|
8649
8925
|
}
|
|
8650
8926
|
return new _GeminiCliSkill({
|
|
@@ -8679,16 +8955,16 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
8679
8955
|
};
|
|
8680
8956
|
|
|
8681
8957
|
// src/features/skills/kilo-skill.ts
|
|
8682
|
-
var
|
|
8683
|
-
var
|
|
8684
|
-
var KiloSkillFrontmatterSchema =
|
|
8685
|
-
name:
|
|
8686
|
-
description:
|
|
8958
|
+
var import_node_path68 = require("path");
|
|
8959
|
+
var import_mini31 = require("zod/mini");
|
|
8960
|
+
var KiloSkillFrontmatterSchema = import_mini31.z.looseObject({
|
|
8961
|
+
name: import_mini31.z.string(),
|
|
8962
|
+
description: import_mini31.z.string()
|
|
8687
8963
|
});
|
|
8688
8964
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
8689
8965
|
constructor({
|
|
8690
8966
|
baseDir = process.cwd(),
|
|
8691
|
-
relativeDirPath = (0,
|
|
8967
|
+
relativeDirPath = (0, import_node_path68.join)(".kilocode", "skills"),
|
|
8692
8968
|
dirName,
|
|
8693
8969
|
frontmatter,
|
|
8694
8970
|
body,
|
|
@@ -8719,7 +8995,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
8719
8995
|
global: _global = false
|
|
8720
8996
|
} = {}) {
|
|
8721
8997
|
return {
|
|
8722
|
-
relativeDirPath: (0,
|
|
8998
|
+
relativeDirPath: (0, import_node_path68.join)(".kilocode", "skills")
|
|
8723
8999
|
};
|
|
8724
9000
|
}
|
|
8725
9001
|
getFrontmatter() {
|
|
@@ -8806,13 +9082,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
8806
9082
|
});
|
|
8807
9083
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8808
9084
|
if (!result.success) {
|
|
8809
|
-
const skillDirPath = (0,
|
|
9085
|
+
const skillDirPath = (0, import_node_path68.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8810
9086
|
throw new Error(
|
|
8811
|
-
`Invalid frontmatter in ${(0,
|
|
9087
|
+
`Invalid frontmatter in ${(0, import_node_path68.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8812
9088
|
);
|
|
8813
9089
|
}
|
|
8814
9090
|
if (result.data.name !== loaded.dirName) {
|
|
8815
|
-
const skillFilePath = (0,
|
|
9091
|
+
const skillFilePath = (0, import_node_path68.join)(
|
|
8816
9092
|
loaded.baseDir,
|
|
8817
9093
|
loaded.relativeDirPath,
|
|
8818
9094
|
loaded.dirName,
|
|
@@ -8853,16 +9129,16 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
8853
9129
|
};
|
|
8854
9130
|
|
|
8855
9131
|
// src/features/skills/kiro-skill.ts
|
|
8856
|
-
var
|
|
8857
|
-
var
|
|
8858
|
-
var KiroSkillFrontmatterSchema =
|
|
8859
|
-
name:
|
|
8860
|
-
description:
|
|
9132
|
+
var import_node_path69 = require("path");
|
|
9133
|
+
var import_mini32 = require("zod/mini");
|
|
9134
|
+
var KiroSkillFrontmatterSchema = import_mini32.z.looseObject({
|
|
9135
|
+
name: import_mini32.z.string(),
|
|
9136
|
+
description: import_mini32.z.string()
|
|
8861
9137
|
});
|
|
8862
9138
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
8863
9139
|
constructor({
|
|
8864
9140
|
baseDir = process.cwd(),
|
|
8865
|
-
relativeDirPath = (0,
|
|
9141
|
+
relativeDirPath = (0, import_node_path69.join)(".kiro", "skills"),
|
|
8866
9142
|
dirName,
|
|
8867
9143
|
frontmatter,
|
|
8868
9144
|
body,
|
|
@@ -8894,7 +9170,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
8894
9170
|
throw new Error("KiroSkill does not support global mode.");
|
|
8895
9171
|
}
|
|
8896
9172
|
return {
|
|
8897
|
-
relativeDirPath: (0,
|
|
9173
|
+
relativeDirPath: (0, import_node_path69.join)(".kiro", "skills")
|
|
8898
9174
|
};
|
|
8899
9175
|
}
|
|
8900
9176
|
getFrontmatter() {
|
|
@@ -8981,13 +9257,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
8981
9257
|
});
|
|
8982
9258
|
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8983
9259
|
if (!result.success) {
|
|
8984
|
-
const skillDirPath = (0,
|
|
9260
|
+
const skillDirPath = (0, import_node_path69.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8985
9261
|
throw new Error(
|
|
8986
|
-
`Invalid frontmatter in ${(0,
|
|
9262
|
+
`Invalid frontmatter in ${(0, import_node_path69.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8987
9263
|
);
|
|
8988
9264
|
}
|
|
8989
9265
|
if (result.data.name !== loaded.dirName) {
|
|
8990
|
-
const skillFilePath = (0,
|
|
9266
|
+
const skillFilePath = (0, import_node_path69.join)(
|
|
8991
9267
|
loaded.baseDir,
|
|
8992
9268
|
loaded.relativeDirPath,
|
|
8993
9269
|
loaded.dirName,
|
|
@@ -9029,17 +9305,17 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
9029
9305
|
};
|
|
9030
9306
|
|
|
9031
9307
|
// src/features/skills/opencode-skill.ts
|
|
9032
|
-
var
|
|
9033
|
-
var
|
|
9034
|
-
var OpenCodeSkillFrontmatterSchema =
|
|
9035
|
-
name:
|
|
9036
|
-
description:
|
|
9037
|
-
"allowed-tools":
|
|
9308
|
+
var import_node_path70 = require("path");
|
|
9309
|
+
var import_mini33 = require("zod/mini");
|
|
9310
|
+
var OpenCodeSkillFrontmatterSchema = import_mini33.z.looseObject({
|
|
9311
|
+
name: import_mini33.z.string(),
|
|
9312
|
+
description: import_mini33.z.string(),
|
|
9313
|
+
"allowed-tools": import_mini33.z.optional(import_mini33.z.array(import_mini33.z.string()))
|
|
9038
9314
|
});
|
|
9039
9315
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
9040
9316
|
constructor({
|
|
9041
9317
|
baseDir = process.cwd(),
|
|
9042
|
-
relativeDirPath = (0,
|
|
9318
|
+
relativeDirPath = (0, import_node_path70.join)(".opencode", "skill"),
|
|
9043
9319
|
dirName,
|
|
9044
9320
|
frontmatter,
|
|
9045
9321
|
body,
|
|
@@ -9068,7 +9344,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9068
9344
|
}
|
|
9069
9345
|
static getSettablePaths({ global = false } = {}) {
|
|
9070
9346
|
return {
|
|
9071
|
-
relativeDirPath: global ? (0,
|
|
9347
|
+
relativeDirPath: global ? (0, import_node_path70.join)(".config", "opencode", "skill") : (0, import_node_path70.join)(".opencode", "skill")
|
|
9072
9348
|
};
|
|
9073
9349
|
}
|
|
9074
9350
|
getFrontmatter() {
|
|
@@ -9153,9 +9429,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9153
9429
|
});
|
|
9154
9430
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9155
9431
|
if (!result.success) {
|
|
9156
|
-
const skillDirPath = (0,
|
|
9432
|
+
const skillDirPath = (0, import_node_path70.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9157
9433
|
throw new Error(
|
|
9158
|
-
`Invalid frontmatter in ${(0,
|
|
9434
|
+
`Invalid frontmatter in ${(0, import_node_path70.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9159
9435
|
);
|
|
9160
9436
|
}
|
|
9161
9437
|
return new _OpenCodeSkill({
|
|
@@ -9189,16 +9465,16 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9189
9465
|
};
|
|
9190
9466
|
|
|
9191
9467
|
// src/features/skills/replit-skill.ts
|
|
9192
|
-
var
|
|
9193
|
-
var
|
|
9194
|
-
var ReplitSkillFrontmatterSchema =
|
|
9195
|
-
name:
|
|
9196
|
-
description:
|
|
9468
|
+
var import_node_path71 = require("path");
|
|
9469
|
+
var import_mini34 = require("zod/mini");
|
|
9470
|
+
var ReplitSkillFrontmatterSchema = import_mini34.z.looseObject({
|
|
9471
|
+
name: import_mini34.z.string(),
|
|
9472
|
+
description: import_mini34.z.string()
|
|
9197
9473
|
});
|
|
9198
9474
|
var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
9199
9475
|
constructor({
|
|
9200
9476
|
baseDir = process.cwd(),
|
|
9201
|
-
relativeDirPath = (0,
|
|
9477
|
+
relativeDirPath = (0, import_node_path71.join)(".agents", "skills"),
|
|
9202
9478
|
dirName,
|
|
9203
9479
|
frontmatter,
|
|
9204
9480
|
body,
|
|
@@ -9230,7 +9506,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
9230
9506
|
throw new Error("ReplitSkill does not support global mode.");
|
|
9231
9507
|
}
|
|
9232
9508
|
return {
|
|
9233
|
-
relativeDirPath: (0,
|
|
9509
|
+
relativeDirPath: (0, import_node_path71.join)(".agents", "skills")
|
|
9234
9510
|
};
|
|
9235
9511
|
}
|
|
9236
9512
|
getFrontmatter() {
|
|
@@ -9309,9 +9585,9 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
9309
9585
|
});
|
|
9310
9586
|
const result = ReplitSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9311
9587
|
if (!result.success) {
|
|
9312
|
-
const skillDirPath = (0,
|
|
9588
|
+
const skillDirPath = (0, import_node_path71.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9313
9589
|
throw new Error(
|
|
9314
|
-
`Invalid frontmatter in ${(0,
|
|
9590
|
+
`Invalid frontmatter in ${(0, import_node_path71.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9315
9591
|
);
|
|
9316
9592
|
}
|
|
9317
9593
|
return new _ReplitSkill({
|
|
@@ -9346,16 +9622,16 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
9346
9622
|
};
|
|
9347
9623
|
|
|
9348
9624
|
// src/features/skills/roo-skill.ts
|
|
9349
|
-
var
|
|
9350
|
-
var
|
|
9351
|
-
var RooSkillFrontmatterSchema =
|
|
9352
|
-
name:
|
|
9353
|
-
description:
|
|
9625
|
+
var import_node_path72 = require("path");
|
|
9626
|
+
var import_mini35 = require("zod/mini");
|
|
9627
|
+
var RooSkillFrontmatterSchema = import_mini35.z.looseObject({
|
|
9628
|
+
name: import_mini35.z.string(),
|
|
9629
|
+
description: import_mini35.z.string()
|
|
9354
9630
|
});
|
|
9355
9631
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
9356
9632
|
constructor({
|
|
9357
9633
|
baseDir = process.cwd(),
|
|
9358
|
-
relativeDirPath = (0,
|
|
9634
|
+
relativeDirPath = (0, import_node_path72.join)(".roo", "skills"),
|
|
9359
9635
|
dirName,
|
|
9360
9636
|
frontmatter,
|
|
9361
9637
|
body,
|
|
@@ -9386,7 +9662,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
9386
9662
|
global: _global = false
|
|
9387
9663
|
} = {}) {
|
|
9388
9664
|
return {
|
|
9389
|
-
relativeDirPath: (0,
|
|
9665
|
+
relativeDirPath: (0, import_node_path72.join)(".roo", "skills")
|
|
9390
9666
|
};
|
|
9391
9667
|
}
|
|
9392
9668
|
getFrontmatter() {
|
|
@@ -9473,13 +9749,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
9473
9749
|
});
|
|
9474
9750
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9475
9751
|
if (!result.success) {
|
|
9476
|
-
const skillDirPath = (0,
|
|
9752
|
+
const skillDirPath = (0, import_node_path72.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9477
9753
|
throw new Error(
|
|
9478
|
-
`Invalid frontmatter in ${(0,
|
|
9754
|
+
`Invalid frontmatter in ${(0, import_node_path72.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9479
9755
|
);
|
|
9480
9756
|
}
|
|
9481
9757
|
if (result.data.name !== loaded.dirName) {
|
|
9482
|
-
const skillFilePath = (0,
|
|
9758
|
+
const skillFilePath = (0, import_node_path72.join)(
|
|
9483
9759
|
loaded.baseDir,
|
|
9484
9760
|
loaded.relativeDirPath,
|
|
9485
9761
|
loaded.dirName,
|
|
@@ -9520,17 +9796,17 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
9520
9796
|
};
|
|
9521
9797
|
|
|
9522
9798
|
// src/features/skills/skills-utils.ts
|
|
9523
|
-
var
|
|
9799
|
+
var import_node_path73 = require("path");
|
|
9524
9800
|
async function getLocalSkillDirNames(baseDir) {
|
|
9525
|
-
const skillsDir = (0,
|
|
9801
|
+
const skillsDir = (0, import_node_path73.join)(baseDir, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
9526
9802
|
const names = /* @__PURE__ */ new Set();
|
|
9527
9803
|
if (!await directoryExists(skillsDir)) {
|
|
9528
9804
|
return names;
|
|
9529
9805
|
}
|
|
9530
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
9806
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path73.join)(skillsDir, "*"), { type: "dir" });
|
|
9531
9807
|
for (const dirPath of dirPaths) {
|
|
9532
|
-
const name = (0,
|
|
9533
|
-
if (name === (0,
|
|
9808
|
+
const name = (0, import_node_path73.basename)(dirPath);
|
|
9809
|
+
if (name === (0, import_node_path73.basename)(RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH)) continue;
|
|
9534
9810
|
names.add(name);
|
|
9535
9811
|
}
|
|
9536
9812
|
return names;
|
|
@@ -9555,7 +9831,7 @@ var skillsProcessorToolTargetTuple = [
|
|
|
9555
9831
|
"replit",
|
|
9556
9832
|
"roo"
|
|
9557
9833
|
];
|
|
9558
|
-
var SkillsProcessorToolTargetSchema =
|
|
9834
|
+
var SkillsProcessorToolTargetSchema = import_mini36.z.enum(skillsProcessorToolTargetTuple);
|
|
9559
9835
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
9560
9836
|
[
|
|
9561
9837
|
"agentsmd",
|
|
@@ -9756,11 +10032,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
9756
10032
|
)
|
|
9757
10033
|
);
|
|
9758
10034
|
const localSkillNames = new Set(localDirNames);
|
|
9759
|
-
const curatedDirPath = (0,
|
|
10035
|
+
const curatedDirPath = (0, import_node_path74.join)(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
9760
10036
|
let curatedSkills = [];
|
|
9761
10037
|
if (await directoryExists(curatedDirPath)) {
|
|
9762
|
-
const curatedDirPaths = await findFilesByGlobs((0,
|
|
9763
|
-
const curatedDirNames = curatedDirPaths.map((path4) => (0,
|
|
10038
|
+
const curatedDirPaths = await findFilesByGlobs((0, import_node_path74.join)(curatedDirPath, "*"), { type: "dir" });
|
|
10039
|
+
const curatedDirNames = curatedDirPaths.map((path4) => (0, import_node_path74.basename)(path4));
|
|
9764
10040
|
const nonConflicting = curatedDirNames.filter((name) => {
|
|
9765
10041
|
if (localSkillNames.has(name)) {
|
|
9766
10042
|
logger.debug(`Skipping curated skill "${name}": local skill takes precedence.`);
|
|
@@ -9793,9 +10069,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
9793
10069
|
async loadToolDirs() {
|
|
9794
10070
|
const factory = this.getFactory(this.toolTarget);
|
|
9795
10071
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
9796
|
-
const skillsDirPath = (0,
|
|
9797
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
9798
|
-
const dirNames = dirPaths.map((path4) => (0,
|
|
10072
|
+
const skillsDirPath = (0, import_node_path74.join)(this.baseDir, paths.relativeDirPath);
|
|
10073
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path74.join)(skillsDirPath, "*"), { type: "dir" });
|
|
10074
|
+
const dirNames = dirPaths.map((path4) => (0, import_node_path74.basename)(path4));
|
|
9799
10075
|
const toolSkills = await Promise.all(
|
|
9800
10076
|
dirNames.map(
|
|
9801
10077
|
(dirName) => factory.class.fromDir({
|
|
@@ -9811,9 +10087,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
9811
10087
|
async loadToolDirsToDelete() {
|
|
9812
10088
|
const factory = this.getFactory(this.toolTarget);
|
|
9813
10089
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
9814
|
-
const skillsDirPath = (0,
|
|
9815
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
9816
|
-
const dirNames = dirPaths.map((path4) => (0,
|
|
10090
|
+
const skillsDirPath = (0, import_node_path74.join)(this.baseDir, paths.relativeDirPath);
|
|
10091
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path74.join)(skillsDirPath, "*"), { type: "dir" });
|
|
10092
|
+
const dirNames = dirPaths.map((path4) => (0, import_node_path74.basename)(path4));
|
|
9817
10093
|
const toolSkills = dirNames.map(
|
|
9818
10094
|
(dirName) => factory.class.forDeletion({
|
|
9819
10095
|
baseDir: this.baseDir,
|
|
@@ -9874,11 +10150,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
9874
10150
|
};
|
|
9875
10151
|
|
|
9876
10152
|
// src/features/subagents/agentsmd-subagent.ts
|
|
9877
|
-
var
|
|
10153
|
+
var import_node_path76 = require("path");
|
|
9878
10154
|
|
|
9879
10155
|
// src/features/subagents/simulated-subagent.ts
|
|
9880
|
-
var
|
|
9881
|
-
var
|
|
10156
|
+
var import_node_path75 = require("path");
|
|
10157
|
+
var import_mini37 = require("zod/mini");
|
|
9882
10158
|
|
|
9883
10159
|
// src/features/subagents/tool-subagent.ts
|
|
9884
10160
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -9930,9 +10206,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
9930
10206
|
};
|
|
9931
10207
|
|
|
9932
10208
|
// src/features/subagents/simulated-subagent.ts
|
|
9933
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
9934
|
-
name:
|
|
9935
|
-
description:
|
|
10209
|
+
var SimulatedSubagentFrontmatterSchema = import_mini37.z.object({
|
|
10210
|
+
name: import_mini37.z.string(),
|
|
10211
|
+
description: import_mini37.z.string()
|
|
9936
10212
|
});
|
|
9937
10213
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
9938
10214
|
frontmatter;
|
|
@@ -9942,7 +10218,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
9942
10218
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
9943
10219
|
if (!result.success) {
|
|
9944
10220
|
throw new Error(
|
|
9945
|
-
`Invalid frontmatter in ${(0,
|
|
10221
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9946
10222
|
);
|
|
9947
10223
|
}
|
|
9948
10224
|
}
|
|
@@ -9993,7 +10269,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
9993
10269
|
return {
|
|
9994
10270
|
success: false,
|
|
9995
10271
|
error: new Error(
|
|
9996
|
-
`Invalid frontmatter in ${(0,
|
|
10272
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9997
10273
|
)
|
|
9998
10274
|
};
|
|
9999
10275
|
}
|
|
@@ -10003,7 +10279,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10003
10279
|
relativeFilePath,
|
|
10004
10280
|
validate = true
|
|
10005
10281
|
}) {
|
|
10006
|
-
const filePath = (0,
|
|
10282
|
+
const filePath = (0, import_node_path75.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
10007
10283
|
const fileContent = await readFileContent(filePath);
|
|
10008
10284
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10009
10285
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -10013,7 +10289,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10013
10289
|
return {
|
|
10014
10290
|
baseDir,
|
|
10015
10291
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
10016
|
-
relativeFilePath: (0,
|
|
10292
|
+
relativeFilePath: (0, import_node_path75.basename)(relativeFilePath),
|
|
10017
10293
|
frontmatter: result.data,
|
|
10018
10294
|
body: content.trim(),
|
|
10019
10295
|
validate
|
|
@@ -10039,7 +10315,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10039
10315
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
10040
10316
|
static getSettablePaths() {
|
|
10041
10317
|
return {
|
|
10042
|
-
relativeDirPath: (0,
|
|
10318
|
+
relativeDirPath: (0, import_node_path76.join)(".agents", "subagents")
|
|
10043
10319
|
};
|
|
10044
10320
|
}
|
|
10045
10321
|
static async fromFile(params) {
|
|
@@ -10062,11 +10338,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
10062
10338
|
};
|
|
10063
10339
|
|
|
10064
10340
|
// src/features/subagents/factorydroid-subagent.ts
|
|
10065
|
-
var
|
|
10341
|
+
var import_node_path77 = require("path");
|
|
10066
10342
|
var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
|
|
10067
10343
|
static getSettablePaths(_options) {
|
|
10068
10344
|
return {
|
|
10069
|
-
relativeDirPath: (0,
|
|
10345
|
+
relativeDirPath: (0, import_node_path77.join)(".factory", "droids")
|
|
10070
10346
|
};
|
|
10071
10347
|
}
|
|
10072
10348
|
static async fromFile(params) {
|
|
@@ -10089,11 +10365,11 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
10089
10365
|
};
|
|
10090
10366
|
|
|
10091
10367
|
// src/features/subagents/geminicli-subagent.ts
|
|
10092
|
-
var
|
|
10368
|
+
var import_node_path78 = require("path");
|
|
10093
10369
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
10094
10370
|
static getSettablePaths() {
|
|
10095
10371
|
return {
|
|
10096
|
-
relativeDirPath: (0,
|
|
10372
|
+
relativeDirPath: (0, import_node_path78.join)(".gemini", "subagents")
|
|
10097
10373
|
};
|
|
10098
10374
|
}
|
|
10099
10375
|
static async fromFile(params) {
|
|
@@ -10116,11 +10392,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
10116
10392
|
};
|
|
10117
10393
|
|
|
10118
10394
|
// src/features/subagents/roo-subagent.ts
|
|
10119
|
-
var
|
|
10395
|
+
var import_node_path79 = require("path");
|
|
10120
10396
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
10121
10397
|
static getSettablePaths() {
|
|
10122
10398
|
return {
|
|
10123
|
-
relativeDirPath: (0,
|
|
10399
|
+
relativeDirPath: (0, import_node_path79.join)(".roo", "subagents")
|
|
10124
10400
|
};
|
|
10125
10401
|
}
|
|
10126
10402
|
static async fromFile(params) {
|
|
@@ -10143,20 +10419,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
10143
10419
|
};
|
|
10144
10420
|
|
|
10145
10421
|
// src/features/subagents/subagents-processor.ts
|
|
10146
|
-
var
|
|
10147
|
-
var
|
|
10422
|
+
var import_node_path87 = require("path");
|
|
10423
|
+
var import_mini45 = require("zod/mini");
|
|
10148
10424
|
|
|
10149
10425
|
// src/features/subagents/claudecode-subagent.ts
|
|
10150
|
-
var
|
|
10151
|
-
var
|
|
10426
|
+
var import_node_path81 = require("path");
|
|
10427
|
+
var import_mini39 = require("zod/mini");
|
|
10152
10428
|
|
|
10153
10429
|
// src/features/subagents/rulesync-subagent.ts
|
|
10154
|
-
var
|
|
10155
|
-
var
|
|
10156
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
10157
|
-
targets:
|
|
10158
|
-
name:
|
|
10159
|
-
description:
|
|
10430
|
+
var import_node_path80 = require("path");
|
|
10431
|
+
var import_mini38 = require("zod/mini");
|
|
10432
|
+
var RulesyncSubagentFrontmatterSchema = import_mini38.z.looseObject({
|
|
10433
|
+
targets: import_mini38.z._default(RulesyncTargetsSchema, ["*"]),
|
|
10434
|
+
name: import_mini38.z.string(),
|
|
10435
|
+
description: import_mini38.z.string()
|
|
10160
10436
|
});
|
|
10161
10437
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
10162
10438
|
frontmatter;
|
|
@@ -10165,7 +10441,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10165
10441
|
const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10166
10442
|
if (!parseResult.success && rest.validate !== false) {
|
|
10167
10443
|
throw new Error(
|
|
10168
|
-
`Invalid frontmatter in ${(0,
|
|
10444
|
+
`Invalid frontmatter in ${(0, import_node_path80.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
10169
10445
|
);
|
|
10170
10446
|
}
|
|
10171
10447
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
|
|
@@ -10198,7 +10474,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10198
10474
|
return {
|
|
10199
10475
|
success: false,
|
|
10200
10476
|
error: new Error(
|
|
10201
|
-
`Invalid frontmatter in ${(0,
|
|
10477
|
+
`Invalid frontmatter in ${(0, import_node_path80.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10202
10478
|
)
|
|
10203
10479
|
};
|
|
10204
10480
|
}
|
|
@@ -10206,14 +10482,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10206
10482
|
static async fromFile({
|
|
10207
10483
|
relativeFilePath
|
|
10208
10484
|
}) {
|
|
10209
|
-
const filePath = (0,
|
|
10485
|
+
const filePath = (0, import_node_path80.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
|
|
10210
10486
|
const fileContent = await readFileContent(filePath);
|
|
10211
10487
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10212
10488
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10213
10489
|
if (!result.success) {
|
|
10214
10490
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
10215
10491
|
}
|
|
10216
|
-
const filename = (0,
|
|
10492
|
+
const filename = (0, import_node_path80.basename)(relativeFilePath);
|
|
10217
10493
|
return new _RulesyncSubagent({
|
|
10218
10494
|
baseDir: process.cwd(),
|
|
10219
10495
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -10225,13 +10501,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10225
10501
|
};
|
|
10226
10502
|
|
|
10227
10503
|
// src/features/subagents/claudecode-subagent.ts
|
|
10228
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
10229
|
-
name:
|
|
10230
|
-
description:
|
|
10231
|
-
model:
|
|
10232
|
-
tools:
|
|
10233
|
-
permissionMode:
|
|
10234
|
-
skills:
|
|
10504
|
+
var ClaudecodeSubagentFrontmatterSchema = import_mini39.z.looseObject({
|
|
10505
|
+
name: import_mini39.z.string(),
|
|
10506
|
+
description: import_mini39.z.string(),
|
|
10507
|
+
model: import_mini39.z.optional(import_mini39.z.string()),
|
|
10508
|
+
tools: import_mini39.z.optional(import_mini39.z.union([import_mini39.z.string(), import_mini39.z.array(import_mini39.z.string())])),
|
|
10509
|
+
permissionMode: import_mini39.z.optional(import_mini39.z.string()),
|
|
10510
|
+
skills: import_mini39.z.optional(import_mini39.z.union([import_mini39.z.string(), import_mini39.z.array(import_mini39.z.string())]))
|
|
10235
10511
|
});
|
|
10236
10512
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
10237
10513
|
frontmatter;
|
|
@@ -10241,7 +10517,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10241
10517
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10242
10518
|
if (!result.success) {
|
|
10243
10519
|
throw new Error(
|
|
10244
|
-
`Invalid frontmatter in ${(0,
|
|
10520
|
+
`Invalid frontmatter in ${(0, import_node_path81.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10245
10521
|
);
|
|
10246
10522
|
}
|
|
10247
10523
|
}
|
|
@@ -10253,7 +10529,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10253
10529
|
}
|
|
10254
10530
|
static getSettablePaths(_options = {}) {
|
|
10255
10531
|
return {
|
|
10256
|
-
relativeDirPath: (0,
|
|
10532
|
+
relativeDirPath: (0, import_node_path81.join)(".claude", "agents")
|
|
10257
10533
|
};
|
|
10258
10534
|
}
|
|
10259
10535
|
getFrontmatter() {
|
|
@@ -10329,7 +10605,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10329
10605
|
return {
|
|
10330
10606
|
success: false,
|
|
10331
10607
|
error: new Error(
|
|
10332
|
-
`Invalid frontmatter in ${(0,
|
|
10608
|
+
`Invalid frontmatter in ${(0, import_node_path81.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10333
10609
|
)
|
|
10334
10610
|
};
|
|
10335
10611
|
}
|
|
@@ -10347,7 +10623,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10347
10623
|
global = false
|
|
10348
10624
|
}) {
|
|
10349
10625
|
const paths = this.getSettablePaths({ global });
|
|
10350
|
-
const filePath = (0,
|
|
10626
|
+
const filePath = (0, import_node_path81.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10351
10627
|
const fileContent = await readFileContent(filePath);
|
|
10352
10628
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10353
10629
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -10382,16 +10658,16 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10382
10658
|
};
|
|
10383
10659
|
|
|
10384
10660
|
// src/features/subagents/codexcli-subagent.ts
|
|
10385
|
-
var
|
|
10661
|
+
var import_node_path82 = require("path");
|
|
10386
10662
|
var smolToml2 = __toESM(require("smol-toml"), 1);
|
|
10387
|
-
var
|
|
10388
|
-
var CodexCliSubagentTomlSchema =
|
|
10389
|
-
name:
|
|
10390
|
-
description:
|
|
10391
|
-
developer_instructions:
|
|
10392
|
-
model:
|
|
10393
|
-
model_reasoning_effort:
|
|
10394
|
-
sandbox_mode:
|
|
10663
|
+
var import_mini40 = require("zod/mini");
|
|
10664
|
+
var CodexCliSubagentTomlSchema = import_mini40.z.looseObject({
|
|
10665
|
+
name: import_mini40.z.string(),
|
|
10666
|
+
description: import_mini40.z.optional(import_mini40.z.string()),
|
|
10667
|
+
developer_instructions: import_mini40.z.optional(import_mini40.z.string()),
|
|
10668
|
+
model: import_mini40.z.optional(import_mini40.z.string()),
|
|
10669
|
+
model_reasoning_effort: import_mini40.z.optional(import_mini40.z.string()),
|
|
10670
|
+
sandbox_mode: import_mini40.z.optional(import_mini40.z.string())
|
|
10395
10671
|
});
|
|
10396
10672
|
var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
10397
10673
|
body;
|
|
@@ -10402,7 +10678,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
10402
10678
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
10403
10679
|
} catch (error) {
|
|
10404
10680
|
throw new Error(
|
|
10405
|
-
`Invalid TOML in ${(0,
|
|
10681
|
+
`Invalid TOML in ${(0, import_node_path82.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
10406
10682
|
{ cause: error }
|
|
10407
10683
|
);
|
|
10408
10684
|
}
|
|
@@ -10414,7 +10690,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
10414
10690
|
}
|
|
10415
10691
|
static getSettablePaths(_options = {}) {
|
|
10416
10692
|
return {
|
|
10417
|
-
relativeDirPath: (0,
|
|
10693
|
+
relativeDirPath: (0, import_node_path82.join)(".codex", "agents")
|
|
10418
10694
|
};
|
|
10419
10695
|
}
|
|
10420
10696
|
getBody() {
|
|
@@ -10426,7 +10702,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
10426
10702
|
parsed = CodexCliSubagentTomlSchema.parse(smolToml2.parse(this.body));
|
|
10427
10703
|
} catch (error) {
|
|
10428
10704
|
throw new Error(
|
|
10429
|
-
`Failed to parse TOML in ${(0,
|
|
10705
|
+
`Failed to parse TOML in ${(0, import_node_path82.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
10430
10706
|
{ cause: error }
|
|
10431
10707
|
);
|
|
10432
10708
|
}
|
|
@@ -10507,7 +10783,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
10507
10783
|
global = false
|
|
10508
10784
|
}) {
|
|
10509
10785
|
const paths = this.getSettablePaths({ global });
|
|
10510
|
-
const filePath = (0,
|
|
10786
|
+
const filePath = (0, import_node_path82.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10511
10787
|
const fileContent = await readFileContent(filePath);
|
|
10512
10788
|
const subagent = new _CodexCliSubagent({
|
|
10513
10789
|
baseDir,
|
|
@@ -10545,13 +10821,13 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
10545
10821
|
};
|
|
10546
10822
|
|
|
10547
10823
|
// src/features/subagents/copilot-subagent.ts
|
|
10548
|
-
var
|
|
10549
|
-
var
|
|
10824
|
+
var import_node_path83 = require("path");
|
|
10825
|
+
var import_mini41 = require("zod/mini");
|
|
10550
10826
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
10551
|
-
var CopilotSubagentFrontmatterSchema =
|
|
10552
|
-
name:
|
|
10553
|
-
description:
|
|
10554
|
-
tools:
|
|
10827
|
+
var CopilotSubagentFrontmatterSchema = import_mini41.z.looseObject({
|
|
10828
|
+
name: import_mini41.z.string(),
|
|
10829
|
+
description: import_mini41.z.string(),
|
|
10830
|
+
tools: import_mini41.z.optional(import_mini41.z.union([import_mini41.z.string(), import_mini41.z.array(import_mini41.z.string())]))
|
|
10555
10831
|
});
|
|
10556
10832
|
var normalizeTools = (tools) => {
|
|
10557
10833
|
if (!tools) {
|
|
@@ -10571,7 +10847,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
10571
10847
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10572
10848
|
if (!result.success) {
|
|
10573
10849
|
throw new Error(
|
|
10574
|
-
`Invalid frontmatter in ${(0,
|
|
10850
|
+
`Invalid frontmatter in ${(0, import_node_path83.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10575
10851
|
);
|
|
10576
10852
|
}
|
|
10577
10853
|
}
|
|
@@ -10583,7 +10859,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
10583
10859
|
}
|
|
10584
10860
|
static getSettablePaths(_options = {}) {
|
|
10585
10861
|
return {
|
|
10586
|
-
relativeDirPath: (0,
|
|
10862
|
+
relativeDirPath: (0, import_node_path83.join)(".github", "agents")
|
|
10587
10863
|
};
|
|
10588
10864
|
}
|
|
10589
10865
|
getFrontmatter() {
|
|
@@ -10657,7 +10933,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
10657
10933
|
return {
|
|
10658
10934
|
success: false,
|
|
10659
10935
|
error: new Error(
|
|
10660
|
-
`Invalid frontmatter in ${(0,
|
|
10936
|
+
`Invalid frontmatter in ${(0, import_node_path83.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10661
10937
|
)
|
|
10662
10938
|
};
|
|
10663
10939
|
}
|
|
@@ -10675,7 +10951,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
10675
10951
|
global = false
|
|
10676
10952
|
}) {
|
|
10677
10953
|
const paths = this.getSettablePaths({ global });
|
|
10678
|
-
const filePath = (0,
|
|
10954
|
+
const filePath = (0, import_node_path83.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10679
10955
|
const fileContent = await readFileContent(filePath);
|
|
10680
10956
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10681
10957
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -10711,11 +10987,11 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
10711
10987
|
};
|
|
10712
10988
|
|
|
10713
10989
|
// src/features/subagents/cursor-subagent.ts
|
|
10714
|
-
var
|
|
10715
|
-
var
|
|
10716
|
-
var CursorSubagentFrontmatterSchema =
|
|
10717
|
-
name:
|
|
10718
|
-
description:
|
|
10990
|
+
var import_node_path84 = require("path");
|
|
10991
|
+
var import_mini42 = require("zod/mini");
|
|
10992
|
+
var CursorSubagentFrontmatterSchema = import_mini42.z.looseObject({
|
|
10993
|
+
name: import_mini42.z.string(),
|
|
10994
|
+
description: import_mini42.z.string()
|
|
10719
10995
|
});
|
|
10720
10996
|
var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
10721
10997
|
frontmatter;
|
|
@@ -10725,7 +11001,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
10725
11001
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10726
11002
|
if (!result.success) {
|
|
10727
11003
|
throw new Error(
|
|
10728
|
-
`Invalid frontmatter in ${(0,
|
|
11004
|
+
`Invalid frontmatter in ${(0, import_node_path84.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10729
11005
|
);
|
|
10730
11006
|
}
|
|
10731
11007
|
}
|
|
@@ -10737,7 +11013,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
10737
11013
|
}
|
|
10738
11014
|
static getSettablePaths(_options = {}) {
|
|
10739
11015
|
return {
|
|
10740
|
-
relativeDirPath: (0,
|
|
11016
|
+
relativeDirPath: (0, import_node_path84.join)(".cursor", "agents")
|
|
10741
11017
|
};
|
|
10742
11018
|
}
|
|
10743
11019
|
getFrontmatter() {
|
|
@@ -10804,7 +11080,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
10804
11080
|
return {
|
|
10805
11081
|
success: false,
|
|
10806
11082
|
error: new Error(
|
|
10807
|
-
`Invalid frontmatter in ${(0,
|
|
11083
|
+
`Invalid frontmatter in ${(0, import_node_path84.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10808
11084
|
)
|
|
10809
11085
|
};
|
|
10810
11086
|
}
|
|
@@ -10822,7 +11098,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
10822
11098
|
global = false
|
|
10823
11099
|
}) {
|
|
10824
11100
|
const paths = this.getSettablePaths({ global });
|
|
10825
|
-
const filePath = (0,
|
|
11101
|
+
const filePath = (0, import_node_path84.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10826
11102
|
const fileContent = await readFileContent(filePath);
|
|
10827
11103
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10828
11104
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -10858,23 +11134,23 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
10858
11134
|
};
|
|
10859
11135
|
|
|
10860
11136
|
// src/features/subagents/kiro-subagent.ts
|
|
10861
|
-
var
|
|
10862
|
-
var
|
|
10863
|
-
var KiroCliSubagentJsonSchema =
|
|
10864
|
-
name:
|
|
10865
|
-
description:
|
|
10866
|
-
prompt:
|
|
10867
|
-
tools:
|
|
10868
|
-
toolAliases:
|
|
10869
|
-
toolSettings:
|
|
10870
|
-
toolSchema:
|
|
10871
|
-
hooks:
|
|
10872
|
-
model:
|
|
10873
|
-
mcpServers:
|
|
10874
|
-
useLegacyMcpJson:
|
|
10875
|
-
resources:
|
|
10876
|
-
allowedTools:
|
|
10877
|
-
includeMcpJson:
|
|
11137
|
+
var import_node_path85 = require("path");
|
|
11138
|
+
var import_mini43 = require("zod/mini");
|
|
11139
|
+
var KiroCliSubagentJsonSchema = import_mini43.z.looseObject({
|
|
11140
|
+
name: import_mini43.z.string(),
|
|
11141
|
+
description: import_mini43.z.optional(import_mini43.z.nullable(import_mini43.z.string())),
|
|
11142
|
+
prompt: import_mini43.z.optional(import_mini43.z.nullable(import_mini43.z.string())),
|
|
11143
|
+
tools: import_mini43.z.optional(import_mini43.z.nullable(import_mini43.z.array(import_mini43.z.string()))),
|
|
11144
|
+
toolAliases: import_mini43.z.optional(import_mini43.z.nullable(import_mini43.z.record(import_mini43.z.string(), import_mini43.z.string()))),
|
|
11145
|
+
toolSettings: import_mini43.z.optional(import_mini43.z.nullable(import_mini43.z.unknown())),
|
|
11146
|
+
toolSchema: import_mini43.z.optional(import_mini43.z.nullable(import_mini43.z.unknown())),
|
|
11147
|
+
hooks: import_mini43.z.optional(import_mini43.z.nullable(import_mini43.z.record(import_mini43.z.string(), import_mini43.z.array(import_mini43.z.unknown())))),
|
|
11148
|
+
model: import_mini43.z.optional(import_mini43.z.nullable(import_mini43.z.string())),
|
|
11149
|
+
mcpServers: import_mini43.z.optional(import_mini43.z.nullable(import_mini43.z.record(import_mini43.z.string(), import_mini43.z.unknown()))),
|
|
11150
|
+
useLegacyMcpJson: import_mini43.z.optional(import_mini43.z.nullable(import_mini43.z.boolean())),
|
|
11151
|
+
resources: import_mini43.z.optional(import_mini43.z.nullable(import_mini43.z.array(import_mini43.z.string()))),
|
|
11152
|
+
allowedTools: import_mini43.z.optional(import_mini43.z.nullable(import_mini43.z.array(import_mini43.z.string()))),
|
|
11153
|
+
includeMcpJson: import_mini43.z.optional(import_mini43.z.nullable(import_mini43.z.boolean()))
|
|
10878
11154
|
});
|
|
10879
11155
|
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
10880
11156
|
body;
|
|
@@ -10885,7 +11161,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
10885
11161
|
KiroCliSubagentJsonSchema.parse(parsed);
|
|
10886
11162
|
} catch (error) {
|
|
10887
11163
|
throw new Error(
|
|
10888
|
-
`Invalid JSON in ${(0,
|
|
11164
|
+
`Invalid JSON in ${(0, import_node_path85.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
10889
11165
|
{ cause: error }
|
|
10890
11166
|
);
|
|
10891
11167
|
}
|
|
@@ -10897,7 +11173,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
10897
11173
|
}
|
|
10898
11174
|
static getSettablePaths(_options = {}) {
|
|
10899
11175
|
return {
|
|
10900
|
-
relativeDirPath: (0,
|
|
11176
|
+
relativeDirPath: (0, import_node_path85.join)(".kiro", "agents")
|
|
10901
11177
|
};
|
|
10902
11178
|
}
|
|
10903
11179
|
getBody() {
|
|
@@ -10909,7 +11185,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
10909
11185
|
parsed = JSON.parse(this.body);
|
|
10910
11186
|
} catch (error) {
|
|
10911
11187
|
throw new Error(
|
|
10912
|
-
`Failed to parse JSON in ${(0,
|
|
11188
|
+
`Failed to parse JSON in ${(0, import_node_path85.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
10913
11189
|
{ cause: error }
|
|
10914
11190
|
);
|
|
10915
11191
|
}
|
|
@@ -10990,7 +11266,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
10990
11266
|
global = false
|
|
10991
11267
|
}) {
|
|
10992
11268
|
const paths = this.getSettablePaths({ global });
|
|
10993
|
-
const filePath = (0,
|
|
11269
|
+
const filePath = (0, import_node_path85.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10994
11270
|
const fileContent = await readFileContent(filePath);
|
|
10995
11271
|
const subagent = new _KiroSubagent({
|
|
10996
11272
|
baseDir,
|
|
@@ -11028,12 +11304,12 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11028
11304
|
};
|
|
11029
11305
|
|
|
11030
11306
|
// src/features/subagents/opencode-subagent.ts
|
|
11031
|
-
var
|
|
11032
|
-
var
|
|
11033
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
11034
|
-
description:
|
|
11035
|
-
mode:
|
|
11036
|
-
name:
|
|
11307
|
+
var import_node_path86 = require("path");
|
|
11308
|
+
var import_mini44 = require("zod/mini");
|
|
11309
|
+
var OpenCodeSubagentFrontmatterSchema = import_mini44.z.looseObject({
|
|
11310
|
+
description: import_mini44.z.string(),
|
|
11311
|
+
mode: import_mini44.z._default(import_mini44.z.string(), "subagent"),
|
|
11312
|
+
name: import_mini44.z.optional(import_mini44.z.string())
|
|
11037
11313
|
});
|
|
11038
11314
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
11039
11315
|
frontmatter;
|
|
@@ -11043,7 +11319,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11043
11319
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11044
11320
|
if (!result.success) {
|
|
11045
11321
|
throw new Error(
|
|
11046
|
-
`Invalid frontmatter in ${(0,
|
|
11322
|
+
`Invalid frontmatter in ${(0, import_node_path86.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11047
11323
|
);
|
|
11048
11324
|
}
|
|
11049
11325
|
}
|
|
@@ -11057,7 +11333,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11057
11333
|
global = false
|
|
11058
11334
|
} = {}) {
|
|
11059
11335
|
return {
|
|
11060
|
-
relativeDirPath: global ? (0,
|
|
11336
|
+
relativeDirPath: global ? (0, import_node_path86.join)(".config", "opencode", "agent") : (0, import_node_path86.join)(".opencode", "agent")
|
|
11061
11337
|
};
|
|
11062
11338
|
}
|
|
11063
11339
|
getFrontmatter() {
|
|
@@ -11070,7 +11346,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11070
11346
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
11071
11347
|
const rulesyncFrontmatter = {
|
|
11072
11348
|
targets: ["*"],
|
|
11073
|
-
name: name ?? (0,
|
|
11349
|
+
name: name ?? (0, import_node_path86.basename)(this.getRelativeFilePath(), ".md"),
|
|
11074
11350
|
description,
|
|
11075
11351
|
opencode: { mode, ...opencodeSection }
|
|
11076
11352
|
};
|
|
@@ -11123,7 +11399,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11123
11399
|
return {
|
|
11124
11400
|
success: false,
|
|
11125
11401
|
error: new Error(
|
|
11126
|
-
`Invalid frontmatter in ${(0,
|
|
11402
|
+
`Invalid frontmatter in ${(0, import_node_path86.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11127
11403
|
)
|
|
11128
11404
|
};
|
|
11129
11405
|
}
|
|
@@ -11140,7 +11416,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11140
11416
|
global = false
|
|
11141
11417
|
}) {
|
|
11142
11418
|
const paths = this.getSettablePaths({ global });
|
|
11143
|
-
const filePath = (0,
|
|
11419
|
+
const filePath = (0, import_node_path86.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11144
11420
|
const fileContent = await readFileContent(filePath);
|
|
11145
11421
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11146
11422
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11189,7 +11465,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
11189
11465
|
"opencode",
|
|
11190
11466
|
"roo"
|
|
11191
11467
|
];
|
|
11192
|
-
var SubagentsProcessorToolTargetSchema =
|
|
11468
|
+
var SubagentsProcessorToolTargetSchema = import_mini45.z.enum(subagentsProcessorToolTargetTuple);
|
|
11193
11469
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
11194
11470
|
[
|
|
11195
11471
|
"agentsmd",
|
|
@@ -11351,7 +11627,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
11351
11627
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
11352
11628
|
*/
|
|
11353
11629
|
async loadRulesyncFiles() {
|
|
11354
|
-
const subagentsDir = (0,
|
|
11630
|
+
const subagentsDir = (0, import_node_path87.join)(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
11355
11631
|
const dirExists = await directoryExists(subagentsDir);
|
|
11356
11632
|
if (!dirExists) {
|
|
11357
11633
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -11366,7 +11642,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
11366
11642
|
logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
11367
11643
|
const rulesyncSubagents = [];
|
|
11368
11644
|
for (const mdFile of mdFiles) {
|
|
11369
|
-
const filepath = (0,
|
|
11645
|
+
const filepath = (0, import_node_path87.join)(subagentsDir, mdFile);
|
|
11370
11646
|
try {
|
|
11371
11647
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
11372
11648
|
relativeFilePath: mdFile,
|
|
@@ -11396,14 +11672,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
11396
11672
|
const factory = this.getFactory(this.toolTarget);
|
|
11397
11673
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
11398
11674
|
const subagentFilePaths = await findFilesByGlobs(
|
|
11399
|
-
(0,
|
|
11675
|
+
(0, import_node_path87.join)(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
11400
11676
|
);
|
|
11401
11677
|
if (forDeletion) {
|
|
11402
11678
|
const toolSubagents2 = subagentFilePaths.map(
|
|
11403
11679
|
(path4) => factory.class.forDeletion({
|
|
11404
11680
|
baseDir: this.baseDir,
|
|
11405
11681
|
relativeDirPath: paths.relativeDirPath,
|
|
11406
|
-
relativeFilePath: (0,
|
|
11682
|
+
relativeFilePath: (0, import_node_path87.basename)(path4),
|
|
11407
11683
|
global: this.global
|
|
11408
11684
|
})
|
|
11409
11685
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -11416,7 +11692,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
11416
11692
|
subagentFilePaths.map(
|
|
11417
11693
|
(path4) => factory.class.fromFile({
|
|
11418
11694
|
baseDir: this.baseDir,
|
|
11419
|
-
relativeFilePath: (0,
|
|
11695
|
+
relativeFilePath: (0, import_node_path87.basename)(path4),
|
|
11420
11696
|
global: this.global
|
|
11421
11697
|
})
|
|
11422
11698
|
)
|
|
@@ -11461,49 +11737,49 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
11461
11737
|
};
|
|
11462
11738
|
|
|
11463
11739
|
// src/features/rules/agentsmd-rule.ts
|
|
11464
|
-
var
|
|
11740
|
+
var import_node_path90 = require("path");
|
|
11465
11741
|
|
|
11466
11742
|
// src/features/rules/tool-rule.ts
|
|
11467
|
-
var
|
|
11743
|
+
var import_node_path89 = require("path");
|
|
11468
11744
|
|
|
11469
11745
|
// src/features/rules/rulesync-rule.ts
|
|
11470
|
-
var
|
|
11471
|
-
var
|
|
11472
|
-
var RulesyncRuleFrontmatterSchema =
|
|
11473
|
-
root:
|
|
11474
|
-
localRoot:
|
|
11475
|
-
targets:
|
|
11476
|
-
description:
|
|
11477
|
-
globs:
|
|
11478
|
-
agentsmd:
|
|
11479
|
-
|
|
11746
|
+
var import_node_path88 = require("path");
|
|
11747
|
+
var import_mini46 = require("zod/mini");
|
|
11748
|
+
var RulesyncRuleFrontmatterSchema = import_mini46.z.object({
|
|
11749
|
+
root: import_mini46.z.optional(import_mini46.z.boolean()),
|
|
11750
|
+
localRoot: import_mini46.z.optional(import_mini46.z.boolean()),
|
|
11751
|
+
targets: import_mini46.z._default(RulesyncTargetsSchema, ["*"]),
|
|
11752
|
+
description: import_mini46.z.optional(import_mini46.z.string()),
|
|
11753
|
+
globs: import_mini46.z.optional(import_mini46.z.array(import_mini46.z.string())),
|
|
11754
|
+
agentsmd: import_mini46.z.optional(
|
|
11755
|
+
import_mini46.z.object({
|
|
11480
11756
|
// @example "path/to/subproject"
|
|
11481
|
-
subprojectPath:
|
|
11757
|
+
subprojectPath: import_mini46.z.optional(import_mini46.z.string())
|
|
11482
11758
|
})
|
|
11483
11759
|
),
|
|
11484
|
-
claudecode:
|
|
11485
|
-
|
|
11760
|
+
claudecode: import_mini46.z.optional(
|
|
11761
|
+
import_mini46.z.object({
|
|
11486
11762
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
11487
11763
|
// @example ["src/**/*.ts", "tests/**/*.test.ts"]
|
|
11488
|
-
paths:
|
|
11764
|
+
paths: import_mini46.z.optional(import_mini46.z.array(import_mini46.z.string()))
|
|
11489
11765
|
})
|
|
11490
11766
|
),
|
|
11491
|
-
cursor:
|
|
11492
|
-
|
|
11493
|
-
alwaysApply:
|
|
11494
|
-
description:
|
|
11495
|
-
globs:
|
|
11767
|
+
cursor: import_mini46.z.optional(
|
|
11768
|
+
import_mini46.z.object({
|
|
11769
|
+
alwaysApply: import_mini46.z.optional(import_mini46.z.boolean()),
|
|
11770
|
+
description: import_mini46.z.optional(import_mini46.z.string()),
|
|
11771
|
+
globs: import_mini46.z.optional(import_mini46.z.array(import_mini46.z.string()))
|
|
11496
11772
|
})
|
|
11497
11773
|
),
|
|
11498
|
-
copilot:
|
|
11499
|
-
|
|
11500
|
-
excludeAgent:
|
|
11774
|
+
copilot: import_mini46.z.optional(
|
|
11775
|
+
import_mini46.z.object({
|
|
11776
|
+
excludeAgent: import_mini46.z.optional(import_mini46.z.union([import_mini46.z.literal("code-review"), import_mini46.z.literal("coding-agent")]))
|
|
11501
11777
|
})
|
|
11502
11778
|
),
|
|
11503
|
-
antigravity:
|
|
11504
|
-
|
|
11505
|
-
trigger:
|
|
11506
|
-
globs:
|
|
11779
|
+
antigravity: import_mini46.z.optional(
|
|
11780
|
+
import_mini46.z.looseObject({
|
|
11781
|
+
trigger: import_mini46.z.optional(import_mini46.z.string()),
|
|
11782
|
+
globs: import_mini46.z.optional(import_mini46.z.array(import_mini46.z.string()))
|
|
11507
11783
|
})
|
|
11508
11784
|
)
|
|
11509
11785
|
});
|
|
@@ -11514,7 +11790,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
11514
11790
|
const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
11515
11791
|
if (!parseResult.success && rest.validate !== false) {
|
|
11516
11792
|
throw new Error(
|
|
11517
|
-
`Invalid frontmatter in ${(0,
|
|
11793
|
+
`Invalid frontmatter in ${(0, import_node_path88.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
11518
11794
|
);
|
|
11519
11795
|
}
|
|
11520
11796
|
const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
|
|
@@ -11549,7 +11825,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
11549
11825
|
return {
|
|
11550
11826
|
success: false,
|
|
11551
11827
|
error: new Error(
|
|
11552
|
-
`Invalid frontmatter in ${(0,
|
|
11828
|
+
`Invalid frontmatter in ${(0, import_node_path88.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11553
11829
|
)
|
|
11554
11830
|
};
|
|
11555
11831
|
}
|
|
@@ -11558,7 +11834,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
11558
11834
|
relativeFilePath,
|
|
11559
11835
|
validate = true
|
|
11560
11836
|
}) {
|
|
11561
|
-
const filePath = (0,
|
|
11837
|
+
const filePath = (0, import_node_path88.join)(
|
|
11562
11838
|
process.cwd(),
|
|
11563
11839
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
11564
11840
|
relativeFilePath
|
|
@@ -11660,7 +11936,7 @@ var ToolRule = class extends ToolFile {
|
|
|
11660
11936
|
rulesyncRule,
|
|
11661
11937
|
validate = true,
|
|
11662
11938
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
11663
|
-
nonRootPath = { relativeDirPath: (0,
|
|
11939
|
+
nonRootPath = { relativeDirPath: (0, import_node_path89.join)(".agents", "memories") }
|
|
11664
11940
|
}) {
|
|
11665
11941
|
const params = this.buildToolRuleParamsDefault({
|
|
11666
11942
|
baseDir,
|
|
@@ -11671,7 +11947,7 @@ var ToolRule = class extends ToolFile {
|
|
|
11671
11947
|
});
|
|
11672
11948
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
11673
11949
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
11674
|
-
params.relativeDirPath = (0,
|
|
11950
|
+
params.relativeDirPath = (0, import_node_path89.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
11675
11951
|
params.relativeFilePath = "AGENTS.md";
|
|
11676
11952
|
}
|
|
11677
11953
|
return params;
|
|
@@ -11720,7 +11996,7 @@ var ToolRule = class extends ToolFile {
|
|
|
11720
11996
|
}
|
|
11721
11997
|
};
|
|
11722
11998
|
function buildToolPath(toolDir, subDir, excludeToolDir) {
|
|
11723
|
-
return excludeToolDir ? subDir : (0,
|
|
11999
|
+
return excludeToolDir ? subDir : (0, import_node_path89.join)(toolDir, subDir);
|
|
11724
12000
|
}
|
|
11725
12001
|
|
|
11726
12002
|
// src/features/rules/agentsmd-rule.ts
|
|
@@ -11749,8 +12025,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
11749
12025
|
validate = true
|
|
11750
12026
|
}) {
|
|
11751
12027
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
11752
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
11753
|
-
const fileContent = await readFileContent((0,
|
|
12028
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path90.join)(".agents", "memories", relativeFilePath);
|
|
12029
|
+
const fileContent = await readFileContent((0, import_node_path90.join)(baseDir, relativePath));
|
|
11754
12030
|
return new _AgentsMdRule({
|
|
11755
12031
|
baseDir,
|
|
11756
12032
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -11805,21 +12081,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
11805
12081
|
};
|
|
11806
12082
|
|
|
11807
12083
|
// src/features/rules/antigravity-rule.ts
|
|
11808
|
-
var
|
|
11809
|
-
var
|
|
11810
|
-
var AntigravityRuleFrontmatterSchema =
|
|
11811
|
-
trigger:
|
|
11812
|
-
|
|
11813
|
-
|
|
11814
|
-
|
|
11815
|
-
|
|
11816
|
-
|
|
11817
|
-
|
|
12084
|
+
var import_node_path91 = require("path");
|
|
12085
|
+
var import_mini47 = require("zod/mini");
|
|
12086
|
+
var AntigravityRuleFrontmatterSchema = import_mini47.z.looseObject({
|
|
12087
|
+
trigger: import_mini47.z.optional(
|
|
12088
|
+
import_mini47.z.union([
|
|
12089
|
+
import_mini47.z.literal("always_on"),
|
|
12090
|
+
import_mini47.z.literal("glob"),
|
|
12091
|
+
import_mini47.z.literal("manual"),
|
|
12092
|
+
import_mini47.z.literal("model_decision"),
|
|
12093
|
+
import_mini47.z.string()
|
|
11818
12094
|
// accepts any string for forward compatibility
|
|
11819
12095
|
])
|
|
11820
12096
|
),
|
|
11821
|
-
globs:
|
|
11822
|
-
description:
|
|
12097
|
+
globs: import_mini47.z.optional(import_mini47.z.string()),
|
|
12098
|
+
description: import_mini47.z.optional(import_mini47.z.string())
|
|
11823
12099
|
});
|
|
11824
12100
|
function parseGlobsString(globs) {
|
|
11825
12101
|
if (!globs) {
|
|
@@ -11964,7 +12240,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
11964
12240
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
11965
12241
|
if (!result.success) {
|
|
11966
12242
|
throw new Error(
|
|
11967
|
-
`Invalid frontmatter in ${(0,
|
|
12243
|
+
`Invalid frontmatter in ${(0, import_node_path91.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11968
12244
|
);
|
|
11969
12245
|
}
|
|
11970
12246
|
}
|
|
@@ -11988,7 +12264,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
11988
12264
|
relativeFilePath,
|
|
11989
12265
|
validate = true
|
|
11990
12266
|
}) {
|
|
11991
|
-
const filePath = (0,
|
|
12267
|
+
const filePath = (0, import_node_path91.join)(
|
|
11992
12268
|
baseDir,
|
|
11993
12269
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
11994
12270
|
relativeFilePath
|
|
@@ -12129,7 +12405,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
12129
12405
|
};
|
|
12130
12406
|
|
|
12131
12407
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
12132
|
-
var
|
|
12408
|
+
var import_node_path92 = require("path");
|
|
12133
12409
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
12134
12410
|
toRulesyncRule() {
|
|
12135
12411
|
const rulesyncFrontmatter = {
|
|
@@ -12190,8 +12466,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
12190
12466
|
}) {
|
|
12191
12467
|
const settablePaths = this.getSettablePaths();
|
|
12192
12468
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
12193
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
12194
|
-
const fileContent = await readFileContent((0,
|
|
12469
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path92.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
12470
|
+
const fileContent = await readFileContent((0, import_node_path92.join)(baseDir, relativePath));
|
|
12195
12471
|
return new _AugmentcodeLegacyRule({
|
|
12196
12472
|
baseDir,
|
|
12197
12473
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -12220,7 +12496,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
12220
12496
|
};
|
|
12221
12497
|
|
|
12222
12498
|
// src/features/rules/augmentcode-rule.ts
|
|
12223
|
-
var
|
|
12499
|
+
var import_node_path93 = require("path");
|
|
12224
12500
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
12225
12501
|
toRulesyncRule() {
|
|
12226
12502
|
return this.toRulesyncRuleDefault();
|
|
@@ -12251,7 +12527,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
12251
12527
|
relativeFilePath,
|
|
12252
12528
|
validate = true
|
|
12253
12529
|
}) {
|
|
12254
|
-
const filePath = (0,
|
|
12530
|
+
const filePath = (0, import_node_path93.join)(
|
|
12255
12531
|
baseDir,
|
|
12256
12532
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
12257
12533
|
relativeFilePath
|
|
@@ -12291,7 +12567,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
12291
12567
|
};
|
|
12292
12568
|
|
|
12293
12569
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
12294
|
-
var
|
|
12570
|
+
var import_node_path94 = require("path");
|
|
12295
12571
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
12296
12572
|
static getSettablePaths({
|
|
12297
12573
|
global,
|
|
@@ -12326,7 +12602,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
12326
12602
|
if (isRoot) {
|
|
12327
12603
|
const relativePath2 = paths.root.relativeFilePath;
|
|
12328
12604
|
const fileContent2 = await readFileContent(
|
|
12329
|
-
(0,
|
|
12605
|
+
(0, import_node_path94.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
12330
12606
|
);
|
|
12331
12607
|
return new _ClaudecodeLegacyRule({
|
|
12332
12608
|
baseDir,
|
|
@@ -12340,8 +12616,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
12340
12616
|
if (!paths.nonRoot) {
|
|
12341
12617
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
12342
12618
|
}
|
|
12343
|
-
const relativePath = (0,
|
|
12344
|
-
const fileContent = await readFileContent((0,
|
|
12619
|
+
const relativePath = (0, import_node_path94.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
12620
|
+
const fileContent = await readFileContent((0, import_node_path94.join)(baseDir, relativePath));
|
|
12345
12621
|
return new _ClaudecodeLegacyRule({
|
|
12346
12622
|
baseDir,
|
|
12347
12623
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -12400,10 +12676,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
12400
12676
|
};
|
|
12401
12677
|
|
|
12402
12678
|
// src/features/rules/claudecode-rule.ts
|
|
12403
|
-
var
|
|
12404
|
-
var
|
|
12405
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
12406
|
-
paths:
|
|
12679
|
+
var import_node_path95 = require("path");
|
|
12680
|
+
var import_mini48 = require("zod/mini");
|
|
12681
|
+
var ClaudecodeRuleFrontmatterSchema = import_mini48.z.object({
|
|
12682
|
+
paths: import_mini48.z.optional(import_mini48.z.array(import_mini48.z.string()))
|
|
12407
12683
|
});
|
|
12408
12684
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
12409
12685
|
frontmatter;
|
|
@@ -12435,7 +12711,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
12435
12711
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12436
12712
|
if (!result.success) {
|
|
12437
12713
|
throw new Error(
|
|
12438
|
-
`Invalid frontmatter in ${(0,
|
|
12714
|
+
`Invalid frontmatter in ${(0, import_node_path95.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12439
12715
|
);
|
|
12440
12716
|
}
|
|
12441
12717
|
}
|
|
@@ -12463,7 +12739,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
12463
12739
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
12464
12740
|
if (isRoot) {
|
|
12465
12741
|
const fileContent2 = await readFileContent(
|
|
12466
|
-
(0,
|
|
12742
|
+
(0, import_node_path95.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
12467
12743
|
);
|
|
12468
12744
|
return new _ClaudecodeRule({
|
|
12469
12745
|
baseDir,
|
|
@@ -12478,16 +12754,16 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
12478
12754
|
if (!paths.nonRoot) {
|
|
12479
12755
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
12480
12756
|
}
|
|
12481
|
-
const relativePath = (0,
|
|
12482
|
-
const fileContent = await readFileContent((0,
|
|
12757
|
+
const relativePath = (0, import_node_path95.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
12758
|
+
const fileContent = await readFileContent((0, import_node_path95.join)(baseDir, relativePath));
|
|
12483
12759
|
const { frontmatter, body: content } = parseFrontmatter(
|
|
12484
12760
|
fileContent,
|
|
12485
|
-
(0,
|
|
12761
|
+
(0, import_node_path95.join)(baseDir, relativePath)
|
|
12486
12762
|
);
|
|
12487
12763
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12488
12764
|
if (!result.success) {
|
|
12489
12765
|
throw new Error(
|
|
12490
|
-
`Invalid frontmatter in ${(0,
|
|
12766
|
+
`Invalid frontmatter in ${(0, import_node_path95.join)(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
12491
12767
|
);
|
|
12492
12768
|
}
|
|
12493
12769
|
return new _ClaudecodeRule({
|
|
@@ -12594,7 +12870,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
12594
12870
|
return {
|
|
12595
12871
|
success: false,
|
|
12596
12872
|
error: new Error(
|
|
12597
|
-
`Invalid frontmatter in ${(0,
|
|
12873
|
+
`Invalid frontmatter in ${(0, import_node_path95.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12598
12874
|
)
|
|
12599
12875
|
};
|
|
12600
12876
|
}
|
|
@@ -12614,10 +12890,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
12614
12890
|
};
|
|
12615
12891
|
|
|
12616
12892
|
// src/features/rules/cline-rule.ts
|
|
12617
|
-
var
|
|
12618
|
-
var
|
|
12619
|
-
var ClineRuleFrontmatterSchema =
|
|
12620
|
-
description:
|
|
12893
|
+
var import_node_path96 = require("path");
|
|
12894
|
+
var import_mini49 = require("zod/mini");
|
|
12895
|
+
var ClineRuleFrontmatterSchema = import_mini49.z.object({
|
|
12896
|
+
description: import_mini49.z.string()
|
|
12621
12897
|
});
|
|
12622
12898
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
12623
12899
|
static getSettablePaths(_options = {}) {
|
|
@@ -12660,7 +12936,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
12660
12936
|
validate = true
|
|
12661
12937
|
}) {
|
|
12662
12938
|
const fileContent = await readFileContent(
|
|
12663
|
-
(0,
|
|
12939
|
+
(0, import_node_path96.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
12664
12940
|
);
|
|
12665
12941
|
return new _ClineRule({
|
|
12666
12942
|
baseDir,
|
|
@@ -12686,7 +12962,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
12686
12962
|
};
|
|
12687
12963
|
|
|
12688
12964
|
// src/features/rules/codexcli-rule.ts
|
|
12689
|
-
var
|
|
12965
|
+
var import_node_path97 = require("path");
|
|
12690
12966
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
12691
12967
|
static getSettablePaths({
|
|
12692
12968
|
global,
|
|
@@ -12721,7 +12997,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
12721
12997
|
if (isRoot) {
|
|
12722
12998
|
const relativePath2 = paths.root.relativeFilePath;
|
|
12723
12999
|
const fileContent2 = await readFileContent(
|
|
12724
|
-
(0,
|
|
13000
|
+
(0, import_node_path97.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
12725
13001
|
);
|
|
12726
13002
|
return new _CodexcliRule({
|
|
12727
13003
|
baseDir,
|
|
@@ -12735,8 +13011,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
12735
13011
|
if (!paths.nonRoot) {
|
|
12736
13012
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
12737
13013
|
}
|
|
12738
|
-
const relativePath = (0,
|
|
12739
|
-
const fileContent = await readFileContent((0,
|
|
13014
|
+
const relativePath = (0, import_node_path97.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13015
|
+
const fileContent = await readFileContent((0, import_node_path97.join)(baseDir, relativePath));
|
|
12740
13016
|
return new _CodexcliRule({
|
|
12741
13017
|
baseDir,
|
|
12742
13018
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -12795,12 +13071,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
12795
13071
|
};
|
|
12796
13072
|
|
|
12797
13073
|
// src/features/rules/copilot-rule.ts
|
|
12798
|
-
var
|
|
12799
|
-
var
|
|
12800
|
-
var CopilotRuleFrontmatterSchema =
|
|
12801
|
-
description:
|
|
12802
|
-
applyTo:
|
|
12803
|
-
excludeAgent:
|
|
13074
|
+
var import_node_path98 = require("path");
|
|
13075
|
+
var import_mini50 = require("zod/mini");
|
|
13076
|
+
var CopilotRuleFrontmatterSchema = import_mini50.z.object({
|
|
13077
|
+
description: import_mini50.z.optional(import_mini50.z.string()),
|
|
13078
|
+
applyTo: import_mini50.z.optional(import_mini50.z.string()),
|
|
13079
|
+
excludeAgent: import_mini50.z.optional(import_mini50.z.union([import_mini50.z.literal("code-review"), import_mini50.z.literal("coding-agent")]))
|
|
12804
13080
|
});
|
|
12805
13081
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
12806
13082
|
frontmatter;
|
|
@@ -12829,7 +13105,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
12829
13105
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12830
13106
|
if (!result.success) {
|
|
12831
13107
|
throw new Error(
|
|
12832
|
-
`Invalid frontmatter in ${(0,
|
|
13108
|
+
`Invalid frontmatter in ${(0, import_node_path98.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12833
13109
|
);
|
|
12834
13110
|
}
|
|
12835
13111
|
}
|
|
@@ -12919,8 +13195,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
12919
13195
|
const paths = this.getSettablePaths({ global });
|
|
12920
13196
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
12921
13197
|
if (isRoot) {
|
|
12922
|
-
const relativePath2 = (0,
|
|
12923
|
-
const fileContent2 = await readFileContent((0,
|
|
13198
|
+
const relativePath2 = (0, import_node_path98.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
13199
|
+
const fileContent2 = await readFileContent((0, import_node_path98.join)(baseDir, relativePath2));
|
|
12924
13200
|
return new _CopilotRule({
|
|
12925
13201
|
baseDir,
|
|
12926
13202
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -12934,16 +13210,16 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
12934
13210
|
if (!paths.nonRoot) {
|
|
12935
13211
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
12936
13212
|
}
|
|
12937
|
-
const relativePath = (0,
|
|
12938
|
-
const fileContent = await readFileContent((0,
|
|
13213
|
+
const relativePath = (0, import_node_path98.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13214
|
+
const fileContent = await readFileContent((0, import_node_path98.join)(baseDir, relativePath));
|
|
12939
13215
|
const { frontmatter, body: content } = parseFrontmatter(
|
|
12940
13216
|
fileContent,
|
|
12941
|
-
(0,
|
|
13217
|
+
(0, import_node_path98.join)(baseDir, relativePath)
|
|
12942
13218
|
);
|
|
12943
13219
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12944
13220
|
if (!result.success) {
|
|
12945
13221
|
throw new Error(
|
|
12946
|
-
`Invalid frontmatter in ${(0,
|
|
13222
|
+
`Invalid frontmatter in ${(0, import_node_path98.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
12947
13223
|
);
|
|
12948
13224
|
}
|
|
12949
13225
|
return new _CopilotRule({
|
|
@@ -12985,7 +13261,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
12985
13261
|
return {
|
|
12986
13262
|
success: false,
|
|
12987
13263
|
error: new Error(
|
|
12988
|
-
`Invalid frontmatter in ${(0,
|
|
13264
|
+
`Invalid frontmatter in ${(0, import_node_path98.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12989
13265
|
)
|
|
12990
13266
|
};
|
|
12991
13267
|
}
|
|
@@ -13005,12 +13281,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13005
13281
|
};
|
|
13006
13282
|
|
|
13007
13283
|
// src/features/rules/cursor-rule.ts
|
|
13008
|
-
var
|
|
13009
|
-
var
|
|
13010
|
-
var CursorRuleFrontmatterSchema =
|
|
13011
|
-
description:
|
|
13012
|
-
globs:
|
|
13013
|
-
alwaysApply:
|
|
13284
|
+
var import_node_path99 = require("path");
|
|
13285
|
+
var import_mini51 = require("zod/mini");
|
|
13286
|
+
var CursorRuleFrontmatterSchema = import_mini51.z.object({
|
|
13287
|
+
description: import_mini51.z.optional(import_mini51.z.string()),
|
|
13288
|
+
globs: import_mini51.z.optional(import_mini51.z.string()),
|
|
13289
|
+
alwaysApply: import_mini51.z.optional(import_mini51.z.boolean())
|
|
13014
13290
|
});
|
|
13015
13291
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
13016
13292
|
frontmatter;
|
|
@@ -13027,7 +13303,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13027
13303
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13028
13304
|
if (!result.success) {
|
|
13029
13305
|
throw new Error(
|
|
13030
|
-
`Invalid frontmatter in ${(0,
|
|
13306
|
+
`Invalid frontmatter in ${(0, import_node_path99.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13031
13307
|
);
|
|
13032
13308
|
}
|
|
13033
13309
|
}
|
|
@@ -13143,7 +13419,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13143
13419
|
relativeFilePath,
|
|
13144
13420
|
validate = true
|
|
13145
13421
|
}) {
|
|
13146
|
-
const filePath = (0,
|
|
13422
|
+
const filePath = (0, import_node_path99.join)(
|
|
13147
13423
|
baseDir,
|
|
13148
13424
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13149
13425
|
relativeFilePath
|
|
@@ -13153,7 +13429,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13153
13429
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13154
13430
|
if (!result.success) {
|
|
13155
13431
|
throw new Error(
|
|
13156
|
-
`Invalid frontmatter in ${(0,
|
|
13432
|
+
`Invalid frontmatter in ${(0, import_node_path99.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
13157
13433
|
);
|
|
13158
13434
|
}
|
|
13159
13435
|
return new _CursorRule({
|
|
@@ -13190,7 +13466,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13190
13466
|
return {
|
|
13191
13467
|
success: false,
|
|
13192
13468
|
error: new Error(
|
|
13193
|
-
`Invalid frontmatter in ${(0,
|
|
13469
|
+
`Invalid frontmatter in ${(0, import_node_path99.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13194
13470
|
)
|
|
13195
13471
|
};
|
|
13196
13472
|
}
|
|
@@ -13210,7 +13486,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13210
13486
|
};
|
|
13211
13487
|
|
|
13212
13488
|
// src/features/rules/factorydroid-rule.ts
|
|
13213
|
-
var
|
|
13489
|
+
var import_node_path100 = require("path");
|
|
13214
13490
|
var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
13215
13491
|
constructor({ fileContent, root, ...rest }) {
|
|
13216
13492
|
super({
|
|
@@ -13250,8 +13526,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
13250
13526
|
const paths = this.getSettablePaths({ global });
|
|
13251
13527
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
13252
13528
|
if (isRoot) {
|
|
13253
|
-
const relativePath2 = (0,
|
|
13254
|
-
const fileContent2 = await readFileContent((0,
|
|
13529
|
+
const relativePath2 = (0, import_node_path100.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
13530
|
+
const fileContent2 = await readFileContent((0, import_node_path100.join)(baseDir, relativePath2));
|
|
13255
13531
|
return new _FactorydroidRule({
|
|
13256
13532
|
baseDir,
|
|
13257
13533
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -13264,8 +13540,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
13264
13540
|
if (!paths.nonRoot) {
|
|
13265
13541
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13266
13542
|
}
|
|
13267
|
-
const relativePath = (0,
|
|
13268
|
-
const fileContent = await readFileContent((0,
|
|
13543
|
+
const relativePath = (0, import_node_path100.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13544
|
+
const fileContent = await readFileContent((0, import_node_path100.join)(baseDir, relativePath));
|
|
13269
13545
|
return new _FactorydroidRule({
|
|
13270
13546
|
baseDir,
|
|
13271
13547
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13324,7 +13600,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
13324
13600
|
};
|
|
13325
13601
|
|
|
13326
13602
|
// src/features/rules/geminicli-rule.ts
|
|
13327
|
-
var
|
|
13603
|
+
var import_node_path101 = require("path");
|
|
13328
13604
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
13329
13605
|
static getSettablePaths({
|
|
13330
13606
|
global,
|
|
@@ -13359,7 +13635,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
13359
13635
|
if (isRoot) {
|
|
13360
13636
|
const relativePath2 = paths.root.relativeFilePath;
|
|
13361
13637
|
const fileContent2 = await readFileContent(
|
|
13362
|
-
(0,
|
|
13638
|
+
(0, import_node_path101.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
13363
13639
|
);
|
|
13364
13640
|
return new _GeminiCliRule({
|
|
13365
13641
|
baseDir,
|
|
@@ -13373,8 +13649,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
13373
13649
|
if (!paths.nonRoot) {
|
|
13374
13650
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13375
13651
|
}
|
|
13376
|
-
const relativePath = (0,
|
|
13377
|
-
const fileContent = await readFileContent((0,
|
|
13652
|
+
const relativePath = (0, import_node_path101.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13653
|
+
const fileContent = await readFileContent((0, import_node_path101.join)(baseDir, relativePath));
|
|
13378
13654
|
return new _GeminiCliRule({
|
|
13379
13655
|
baseDir,
|
|
13380
13656
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13433,7 +13709,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
13433
13709
|
};
|
|
13434
13710
|
|
|
13435
13711
|
// src/features/rules/goose-rule.ts
|
|
13436
|
-
var
|
|
13712
|
+
var import_node_path102 = require("path");
|
|
13437
13713
|
var GooseRule = class _GooseRule extends ToolRule {
|
|
13438
13714
|
static getSettablePaths({
|
|
13439
13715
|
global,
|
|
@@ -13468,7 +13744,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
13468
13744
|
if (isRoot) {
|
|
13469
13745
|
const relativePath2 = paths.root.relativeFilePath;
|
|
13470
13746
|
const fileContent2 = await readFileContent(
|
|
13471
|
-
(0,
|
|
13747
|
+
(0, import_node_path102.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
13472
13748
|
);
|
|
13473
13749
|
return new _GooseRule({
|
|
13474
13750
|
baseDir,
|
|
@@ -13482,8 +13758,8 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
13482
13758
|
if (!paths.nonRoot) {
|
|
13483
13759
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13484
13760
|
}
|
|
13485
|
-
const relativePath = (0,
|
|
13486
|
-
const fileContent = await readFileContent((0,
|
|
13761
|
+
const relativePath = (0, import_node_path102.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13762
|
+
const fileContent = await readFileContent((0, import_node_path102.join)(baseDir, relativePath));
|
|
13487
13763
|
return new _GooseRule({
|
|
13488
13764
|
baseDir,
|
|
13489
13765
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13542,7 +13818,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
13542
13818
|
};
|
|
13543
13819
|
|
|
13544
13820
|
// src/features/rules/junie-rule.ts
|
|
13545
|
-
var
|
|
13821
|
+
var import_node_path103 = require("path");
|
|
13546
13822
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
13547
13823
|
static getSettablePaths(_options = {}) {
|
|
13548
13824
|
return {
|
|
@@ -13561,8 +13837,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
13561
13837
|
validate = true
|
|
13562
13838
|
}) {
|
|
13563
13839
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
13564
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
13565
|
-
const fileContent = await readFileContent((0,
|
|
13840
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path103.join)(".junie", "memories", relativeFilePath);
|
|
13841
|
+
const fileContent = await readFileContent((0, import_node_path103.join)(baseDir, relativePath));
|
|
13566
13842
|
return new _JunieRule({
|
|
13567
13843
|
baseDir,
|
|
13568
13844
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -13617,7 +13893,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
13617
13893
|
};
|
|
13618
13894
|
|
|
13619
13895
|
// src/features/rules/kilo-rule.ts
|
|
13620
|
-
var
|
|
13896
|
+
var import_node_path104 = require("path");
|
|
13621
13897
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
13622
13898
|
static getSettablePaths(_options = {}) {
|
|
13623
13899
|
return {
|
|
@@ -13632,7 +13908,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
13632
13908
|
validate = true
|
|
13633
13909
|
}) {
|
|
13634
13910
|
const fileContent = await readFileContent(
|
|
13635
|
-
(0,
|
|
13911
|
+
(0, import_node_path104.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
13636
13912
|
);
|
|
13637
13913
|
return new _KiloRule({
|
|
13638
13914
|
baseDir,
|
|
@@ -13684,7 +13960,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
13684
13960
|
};
|
|
13685
13961
|
|
|
13686
13962
|
// src/features/rules/kiro-rule.ts
|
|
13687
|
-
var
|
|
13963
|
+
var import_node_path105 = require("path");
|
|
13688
13964
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
13689
13965
|
static getSettablePaths(_options = {}) {
|
|
13690
13966
|
return {
|
|
@@ -13699,7 +13975,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
13699
13975
|
validate = true
|
|
13700
13976
|
}) {
|
|
13701
13977
|
const fileContent = await readFileContent(
|
|
13702
|
-
(0,
|
|
13978
|
+
(0, import_node_path105.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
13703
13979
|
);
|
|
13704
13980
|
return new _KiroRule({
|
|
13705
13981
|
baseDir,
|
|
@@ -13753,7 +14029,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
13753
14029
|
};
|
|
13754
14030
|
|
|
13755
14031
|
// src/features/rules/opencode-rule.ts
|
|
13756
|
-
var
|
|
14032
|
+
var import_node_path106 = require("path");
|
|
13757
14033
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
13758
14034
|
static getSettablePaths({
|
|
13759
14035
|
global,
|
|
@@ -13788,7 +14064,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
13788
14064
|
if (isRoot) {
|
|
13789
14065
|
const relativePath2 = paths.root.relativeFilePath;
|
|
13790
14066
|
const fileContent2 = await readFileContent(
|
|
13791
|
-
(0,
|
|
14067
|
+
(0, import_node_path106.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
13792
14068
|
);
|
|
13793
14069
|
return new _OpenCodeRule({
|
|
13794
14070
|
baseDir,
|
|
@@ -13802,8 +14078,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
13802
14078
|
if (!paths.nonRoot) {
|
|
13803
14079
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13804
14080
|
}
|
|
13805
|
-
const relativePath = (0,
|
|
13806
|
-
const fileContent = await readFileContent((0,
|
|
14081
|
+
const relativePath = (0, import_node_path106.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14082
|
+
const fileContent = await readFileContent((0, import_node_path106.join)(baseDir, relativePath));
|
|
13807
14083
|
return new _OpenCodeRule({
|
|
13808
14084
|
baseDir,
|
|
13809
14085
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13862,7 +14138,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
13862
14138
|
};
|
|
13863
14139
|
|
|
13864
14140
|
// src/features/rules/qwencode-rule.ts
|
|
13865
|
-
var
|
|
14141
|
+
var import_node_path107 = require("path");
|
|
13866
14142
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
13867
14143
|
static getSettablePaths(_options = {}) {
|
|
13868
14144
|
return {
|
|
@@ -13881,8 +14157,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
13881
14157
|
validate = true
|
|
13882
14158
|
}) {
|
|
13883
14159
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
13884
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
13885
|
-
const fileContent = await readFileContent((0,
|
|
14160
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path107.join)(".qwen", "memories", relativeFilePath);
|
|
14161
|
+
const fileContent = await readFileContent((0, import_node_path107.join)(baseDir, relativePath));
|
|
13886
14162
|
return new _QwencodeRule({
|
|
13887
14163
|
baseDir,
|
|
13888
14164
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -13934,7 +14210,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
13934
14210
|
};
|
|
13935
14211
|
|
|
13936
14212
|
// src/features/rules/replit-rule.ts
|
|
13937
|
-
var
|
|
14213
|
+
var import_node_path108 = require("path");
|
|
13938
14214
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
13939
14215
|
static getSettablePaths(_options = {}) {
|
|
13940
14216
|
return {
|
|
@@ -13956,7 +14232,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
13956
14232
|
}
|
|
13957
14233
|
const relativePath = paths.root.relativeFilePath;
|
|
13958
14234
|
const fileContent = await readFileContent(
|
|
13959
|
-
(0,
|
|
14235
|
+
(0, import_node_path108.join)(baseDir, paths.root.relativeDirPath, relativePath)
|
|
13960
14236
|
);
|
|
13961
14237
|
return new _ReplitRule({
|
|
13962
14238
|
baseDir,
|
|
@@ -14022,7 +14298,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
14022
14298
|
};
|
|
14023
14299
|
|
|
14024
14300
|
// src/features/rules/roo-rule.ts
|
|
14025
|
-
var
|
|
14301
|
+
var import_node_path109 = require("path");
|
|
14026
14302
|
var RooRule = class _RooRule extends ToolRule {
|
|
14027
14303
|
static getSettablePaths(_options = {}) {
|
|
14028
14304
|
return {
|
|
@@ -14037,7 +14313,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
14037
14313
|
validate = true
|
|
14038
14314
|
}) {
|
|
14039
14315
|
const fileContent = await readFileContent(
|
|
14040
|
-
(0,
|
|
14316
|
+
(0, import_node_path109.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14041
14317
|
);
|
|
14042
14318
|
return new _RooRule({
|
|
14043
14319
|
baseDir,
|
|
@@ -14106,7 +14382,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
14106
14382
|
};
|
|
14107
14383
|
|
|
14108
14384
|
// src/features/rules/warp-rule.ts
|
|
14109
|
-
var
|
|
14385
|
+
var import_node_path110 = require("path");
|
|
14110
14386
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
14111
14387
|
constructor({ fileContent, root, ...rest }) {
|
|
14112
14388
|
super({
|
|
@@ -14132,8 +14408,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
14132
14408
|
validate = true
|
|
14133
14409
|
}) {
|
|
14134
14410
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
14135
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
14136
|
-
const fileContent = await readFileContent((0,
|
|
14411
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path110.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
14412
|
+
const fileContent = await readFileContent((0, import_node_path110.join)(baseDir, relativePath));
|
|
14137
14413
|
return new _WarpRule({
|
|
14138
14414
|
baseDir,
|
|
14139
14415
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -14188,7 +14464,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
14188
14464
|
};
|
|
14189
14465
|
|
|
14190
14466
|
// src/features/rules/windsurf-rule.ts
|
|
14191
|
-
var
|
|
14467
|
+
var import_node_path111 = require("path");
|
|
14192
14468
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
14193
14469
|
static getSettablePaths(_options = {}) {
|
|
14194
14470
|
return {
|
|
@@ -14203,7 +14479,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
14203
14479
|
validate = true
|
|
14204
14480
|
}) {
|
|
14205
14481
|
const fileContent = await readFileContent(
|
|
14206
|
-
(0,
|
|
14482
|
+
(0, import_node_path111.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14207
14483
|
);
|
|
14208
14484
|
return new _WindsurfRule({
|
|
14209
14485
|
baseDir,
|
|
@@ -14279,8 +14555,8 @@ var rulesProcessorToolTargets = [
|
|
|
14279
14555
|
"warp",
|
|
14280
14556
|
"windsurf"
|
|
14281
14557
|
];
|
|
14282
|
-
var RulesProcessorToolTargetSchema =
|
|
14283
|
-
var formatRulePaths = (rules) => rules.map((r) => (0,
|
|
14558
|
+
var RulesProcessorToolTargetSchema = import_mini52.z.enum(rulesProcessorToolTargets);
|
|
14559
|
+
var formatRulePaths = (rules) => rules.map((r) => (0, import_node_path112.join)(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
14284
14560
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
14285
14561
|
[
|
|
14286
14562
|
"agentsmd",
|
|
@@ -14655,7 +14931,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14655
14931
|
}).relativeDirPath;
|
|
14656
14932
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
14657
14933
|
const frontmatter = skill.getFrontmatter();
|
|
14658
|
-
const relativePath = (0,
|
|
14934
|
+
const relativePath = (0, import_node_path112.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
14659
14935
|
return {
|
|
14660
14936
|
name: frontmatter.name,
|
|
14661
14937
|
description: frontmatter.description,
|
|
@@ -14768,12 +15044,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14768
15044
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
14769
15045
|
*/
|
|
14770
15046
|
async loadRulesyncFiles() {
|
|
14771
|
-
const rulesyncBaseDir = (0,
|
|
14772
|
-
const files = await findFilesByGlobs((0,
|
|
15047
|
+
const rulesyncBaseDir = (0, import_node_path112.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
15048
|
+
const files = await findFilesByGlobs((0, import_node_path112.join)(rulesyncBaseDir, "**", "*.md"));
|
|
14773
15049
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
14774
15050
|
const rulesyncRules = await Promise.all(
|
|
14775
15051
|
files.map((file) => {
|
|
14776
|
-
const relativeFilePath = (0,
|
|
15052
|
+
const relativeFilePath = (0, import_node_path112.relative)(rulesyncBaseDir, file);
|
|
14777
15053
|
checkPathTraversal({
|
|
14778
15054
|
relativePath: relativeFilePath,
|
|
14779
15055
|
intendedRootDir: rulesyncBaseDir
|
|
@@ -14836,7 +15112,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14836
15112
|
return [];
|
|
14837
15113
|
}
|
|
14838
15114
|
const rootFilePaths = await findFilesByGlobs(
|
|
14839
|
-
(0,
|
|
15115
|
+
(0, import_node_path112.join)(
|
|
14840
15116
|
this.baseDir,
|
|
14841
15117
|
settablePaths.root.relativeDirPath ?? ".",
|
|
14842
15118
|
settablePaths.root.relativeFilePath
|
|
@@ -14847,7 +15123,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14847
15123
|
(filePath) => factory.class.forDeletion({
|
|
14848
15124
|
baseDir: this.baseDir,
|
|
14849
15125
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
14850
|
-
relativeFilePath: (0,
|
|
15126
|
+
relativeFilePath: (0, import_node_path112.basename)(filePath),
|
|
14851
15127
|
global: this.global
|
|
14852
15128
|
})
|
|
14853
15129
|
).filter((rule) => rule.isDeletable());
|
|
@@ -14856,7 +15132,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14856
15132
|
rootFilePaths.map(
|
|
14857
15133
|
(filePath) => factory.class.fromFile({
|
|
14858
15134
|
baseDir: this.baseDir,
|
|
14859
|
-
relativeFilePath: (0,
|
|
15135
|
+
relativeFilePath: (0, import_node_path112.basename)(filePath),
|
|
14860
15136
|
global: this.global
|
|
14861
15137
|
})
|
|
14862
15138
|
)
|
|
@@ -14874,13 +15150,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14874
15150
|
return [];
|
|
14875
15151
|
}
|
|
14876
15152
|
const localRootFilePaths = await findFilesByGlobs(
|
|
14877
|
-
(0,
|
|
15153
|
+
(0, import_node_path112.join)(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md")
|
|
14878
15154
|
);
|
|
14879
15155
|
return localRootFilePaths.map(
|
|
14880
15156
|
(filePath) => factory.class.forDeletion({
|
|
14881
15157
|
baseDir: this.baseDir,
|
|
14882
15158
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
14883
|
-
relativeFilePath: (0,
|
|
15159
|
+
relativeFilePath: (0, import_node_path112.basename)(filePath),
|
|
14884
15160
|
global: this.global
|
|
14885
15161
|
})
|
|
14886
15162
|
).filter((rule) => rule.isDeletable());
|
|
@@ -14890,13 +15166,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14890
15166
|
if (!settablePaths.nonRoot) {
|
|
14891
15167
|
return [];
|
|
14892
15168
|
}
|
|
14893
|
-
const nonRootBaseDir = (0,
|
|
15169
|
+
const nonRootBaseDir = (0, import_node_path112.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
14894
15170
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
14895
|
-
(0,
|
|
15171
|
+
(0, import_node_path112.join)(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
14896
15172
|
);
|
|
14897
15173
|
if (forDeletion) {
|
|
14898
15174
|
return nonRootFilePaths.map((filePath) => {
|
|
14899
|
-
const relativeFilePath = (0,
|
|
15175
|
+
const relativeFilePath = (0, import_node_path112.relative)(nonRootBaseDir, filePath);
|
|
14900
15176
|
checkPathTraversal({
|
|
14901
15177
|
relativePath: relativeFilePath,
|
|
14902
15178
|
intendedRootDir: nonRootBaseDir
|
|
@@ -14911,7 +15187,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14911
15187
|
}
|
|
14912
15188
|
return await Promise.all(
|
|
14913
15189
|
nonRootFilePaths.map((filePath) => {
|
|
14914
|
-
const relativeFilePath = (0,
|
|
15190
|
+
const relativeFilePath = (0, import_node_path112.relative)(nonRootBaseDir, filePath);
|
|
14915
15191
|
checkPathTraversal({
|
|
14916
15192
|
relativePath: relativeFilePath,
|
|
14917
15193
|
intendedRootDir: nonRootBaseDir
|
|
@@ -15024,14 +15300,14 @@ s/<command> [arguments]
|
|
|
15024
15300
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
15025
15301
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
15026
15302
|
|
|
15027
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
15303
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path112.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
15028
15304
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
15029
15305
|
|
|
15030
15306
|
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.
|
|
15031
15307
|
|
|
15032
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
15308
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path112.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
15033
15309
|
|
|
15034
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
15310
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path112.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
15035
15311
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
15036
15312
|
const result = [
|
|
15037
15313
|
overview,
|
|
@@ -15063,51 +15339,51 @@ var import_request_error = require("@octokit/request-error");
|
|
|
15063
15339
|
var import_rest = require("@octokit/rest");
|
|
15064
15340
|
|
|
15065
15341
|
// src/types/fetch.ts
|
|
15066
|
-
var
|
|
15342
|
+
var import_mini54 = require("zod/mini");
|
|
15067
15343
|
|
|
15068
15344
|
// src/types/fetch-targets.ts
|
|
15069
|
-
var
|
|
15345
|
+
var import_mini53 = require("zod/mini");
|
|
15070
15346
|
var ALL_FETCH_TARGETS = ["rulesync", ...ALL_TOOL_TARGETS];
|
|
15071
|
-
var FetchTargetSchema =
|
|
15347
|
+
var FetchTargetSchema = import_mini53.z.enum(ALL_FETCH_TARGETS);
|
|
15072
15348
|
|
|
15073
15349
|
// src/types/fetch.ts
|
|
15074
|
-
var ConflictStrategySchema =
|
|
15075
|
-
var GitHubFileTypeSchema =
|
|
15076
|
-
var GitHubFileEntrySchema =
|
|
15077
|
-
name:
|
|
15078
|
-
path:
|
|
15079
|
-
sha:
|
|
15080
|
-
size:
|
|
15350
|
+
var ConflictStrategySchema = import_mini54.z.enum(["skip", "overwrite"]);
|
|
15351
|
+
var GitHubFileTypeSchema = import_mini54.z.enum(["file", "dir", "symlink", "submodule"]);
|
|
15352
|
+
var GitHubFileEntrySchema = import_mini54.z.looseObject({
|
|
15353
|
+
name: import_mini54.z.string(),
|
|
15354
|
+
path: import_mini54.z.string(),
|
|
15355
|
+
sha: import_mini54.z.string(),
|
|
15356
|
+
size: import_mini54.z.number(),
|
|
15081
15357
|
type: GitHubFileTypeSchema,
|
|
15082
|
-
download_url:
|
|
15358
|
+
download_url: import_mini54.z.nullable(import_mini54.z.string())
|
|
15083
15359
|
});
|
|
15084
|
-
var FetchOptionsSchema =
|
|
15085
|
-
target:
|
|
15086
|
-
features:
|
|
15087
|
-
ref:
|
|
15088
|
-
path:
|
|
15089
|
-
output:
|
|
15090
|
-
conflict:
|
|
15091
|
-
token:
|
|
15092
|
-
verbose:
|
|
15093
|
-
silent:
|
|
15360
|
+
var FetchOptionsSchema = import_mini54.z.looseObject({
|
|
15361
|
+
target: import_mini54.z.optional(FetchTargetSchema),
|
|
15362
|
+
features: import_mini54.z.optional(import_mini54.z.array(import_mini54.z.enum(ALL_FEATURES_WITH_WILDCARD))),
|
|
15363
|
+
ref: import_mini54.z.optional(import_mini54.z.string()),
|
|
15364
|
+
path: import_mini54.z.optional(import_mini54.z.string()),
|
|
15365
|
+
output: import_mini54.z.optional(import_mini54.z.string()),
|
|
15366
|
+
conflict: import_mini54.z.optional(ConflictStrategySchema),
|
|
15367
|
+
token: import_mini54.z.optional(import_mini54.z.string()),
|
|
15368
|
+
verbose: import_mini54.z.optional(import_mini54.z.boolean()),
|
|
15369
|
+
silent: import_mini54.z.optional(import_mini54.z.boolean())
|
|
15094
15370
|
});
|
|
15095
|
-
var FetchFileStatusSchema =
|
|
15096
|
-
var GitHubRepoInfoSchema =
|
|
15097
|
-
default_branch:
|
|
15098
|
-
private:
|
|
15371
|
+
var FetchFileStatusSchema = import_mini54.z.enum(["created", "overwritten", "skipped"]);
|
|
15372
|
+
var GitHubRepoInfoSchema = import_mini54.z.looseObject({
|
|
15373
|
+
default_branch: import_mini54.z.string(),
|
|
15374
|
+
private: import_mini54.z.boolean()
|
|
15099
15375
|
});
|
|
15100
|
-
var GitHubReleaseAssetSchema =
|
|
15101
|
-
name:
|
|
15102
|
-
browser_download_url:
|
|
15103
|
-
size:
|
|
15376
|
+
var GitHubReleaseAssetSchema = import_mini54.z.looseObject({
|
|
15377
|
+
name: import_mini54.z.string(),
|
|
15378
|
+
browser_download_url: import_mini54.z.string(),
|
|
15379
|
+
size: import_mini54.z.number()
|
|
15104
15380
|
});
|
|
15105
|
-
var GitHubReleaseSchema =
|
|
15106
|
-
tag_name:
|
|
15107
|
-
name:
|
|
15108
|
-
prerelease:
|
|
15109
|
-
draft:
|
|
15110
|
-
assets:
|
|
15381
|
+
var GitHubReleaseSchema = import_mini54.z.looseObject({
|
|
15382
|
+
tag_name: import_mini54.z.string(),
|
|
15383
|
+
name: import_mini54.z.nullable(import_mini54.z.string()),
|
|
15384
|
+
prerelease: import_mini54.z.boolean(),
|
|
15385
|
+
draft: import_mini54.z.boolean(),
|
|
15386
|
+
assets: import_mini54.z.array(GitHubReleaseAssetSchema)
|
|
15111
15387
|
});
|
|
15112
15388
|
|
|
15113
15389
|
// src/lib/github-client.ts
|
|
@@ -15407,9 +15683,9 @@ async function listDirectoryRecursive(params) {
|
|
|
15407
15683
|
}
|
|
15408
15684
|
|
|
15409
15685
|
// src/types/git-provider.ts
|
|
15410
|
-
var
|
|
15686
|
+
var import_mini55 = require("zod/mini");
|
|
15411
15687
|
var ALL_GIT_PROVIDERS = ["github", "gitlab"];
|
|
15412
|
-
var GitProviderSchema =
|
|
15688
|
+
var GitProviderSchema = import_mini55.z.enum(ALL_GIT_PROVIDERS);
|
|
15413
15689
|
|
|
15414
15690
|
// src/lib/source-parser.ts
|
|
15415
15691
|
var GITHUB_HOSTS = /* @__PURE__ */ new Set(["github.com", "www.github.com"]);
|
|
@@ -15534,8 +15810,8 @@ async function processFeatureConversion(params) {
|
|
|
15534
15810
|
}
|
|
15535
15811
|
const rulesyncFiles = await processor.convertToolFilesToRulesyncFiles(toolFiles);
|
|
15536
15812
|
for (const file of rulesyncFiles) {
|
|
15537
|
-
const relativePath = (0,
|
|
15538
|
-
const outputPath = (0,
|
|
15813
|
+
const relativePath = (0, import_node_path113.join)(file.getRelativeDirPath(), file.getRelativeFilePath());
|
|
15814
|
+
const outputPath = (0, import_node_path113.join)(outputDir, relativePath);
|
|
15539
15815
|
await writeFileContent(outputPath, file.getFileContent());
|
|
15540
15816
|
paths.push(relativePath);
|
|
15541
15817
|
}
|
|
@@ -15681,7 +15957,7 @@ async function fetchFiles(params) {
|
|
|
15681
15957
|
skipped: 0
|
|
15682
15958
|
};
|
|
15683
15959
|
}
|
|
15684
|
-
const outputBasePath = (0,
|
|
15960
|
+
const outputBasePath = (0, import_node_path113.join)(baseDir, outputDir);
|
|
15685
15961
|
for (const { relativePath, size } of filesToFetch) {
|
|
15686
15962
|
checkPathTraversal({
|
|
15687
15963
|
relativePath,
|
|
@@ -15691,7 +15967,7 @@ async function fetchFiles(params) {
|
|
|
15691
15967
|
}
|
|
15692
15968
|
const results = await Promise.all(
|
|
15693
15969
|
filesToFetch.map(async ({ remotePath, relativePath }) => {
|
|
15694
|
-
const localPath = (0,
|
|
15970
|
+
const localPath = (0, import_node_path113.join)(outputBasePath, relativePath);
|
|
15695
15971
|
const exists = await fileExists(localPath);
|
|
15696
15972
|
if (exists && conflictStrategy === "skip") {
|
|
15697
15973
|
logger.debug(`Skipping existing file: ${relativePath}`);
|
|
@@ -15733,7 +16009,7 @@ async function collectFeatureFiles(params) {
|
|
|
15733
16009
|
);
|
|
15734
16010
|
const results = await Promise.all(
|
|
15735
16011
|
tasks.map(async ({ featurePath }) => {
|
|
15736
|
-
const fullPath = basePath === "." || basePath === "" ? featurePath : (0,
|
|
16012
|
+
const fullPath = basePath === "." || basePath === "" ? featurePath : (0, import_node_path113.join)(basePath, featurePath);
|
|
15737
16013
|
const collected = [];
|
|
15738
16014
|
try {
|
|
15739
16015
|
if (featurePath.includes(".")) {
|
|
@@ -15833,7 +16109,7 @@ async function fetchAndConvertToolFiles(params) {
|
|
|
15833
16109
|
relativePath: toolRelativePath,
|
|
15834
16110
|
intendedRootDir: tempDir
|
|
15835
16111
|
});
|
|
15836
|
-
const localPath = (0,
|
|
16112
|
+
const localPath = (0, import_node_path113.join)(tempDir, toolRelativePath);
|
|
15837
16113
|
const content = await withSemaphore(
|
|
15838
16114
|
semaphore,
|
|
15839
16115
|
() => client.getFileContent(parsed.owner, parsed.repo, remotePath, ref)
|
|
@@ -15842,7 +16118,7 @@ async function fetchAndConvertToolFiles(params) {
|
|
|
15842
16118
|
logger.debug(`Fetched to temp: ${toolRelativePath}`);
|
|
15843
16119
|
})
|
|
15844
16120
|
);
|
|
15845
|
-
const outputBasePath = (0,
|
|
16121
|
+
const outputBasePath = (0, import_node_path113.join)(baseDir, outputDir);
|
|
15846
16122
|
const { converted, convertedPaths } = await convertFetchedFilesToRulesync({
|
|
15847
16123
|
tempDir,
|
|
15848
16124
|
outputDir: outputBasePath,
|
|
@@ -15915,7 +16191,7 @@ function mapToToolPath(relativePath, toolPaths) {
|
|
|
15915
16191
|
if (relativePath.startsWith("rules/")) {
|
|
15916
16192
|
const restPath = relativePath.substring("rules/".length);
|
|
15917
16193
|
if (toolPaths.rules?.nonRoot) {
|
|
15918
|
-
return (0,
|
|
16194
|
+
return (0, import_node_path113.join)(toolPaths.rules.nonRoot, restPath);
|
|
15919
16195
|
}
|
|
15920
16196
|
}
|
|
15921
16197
|
if (toolPaths.rules?.root && relativePath === toolPaths.rules.root) {
|
|
@@ -15924,19 +16200,19 @@ function mapToToolPath(relativePath, toolPaths) {
|
|
|
15924
16200
|
if (relativePath.startsWith("commands/")) {
|
|
15925
16201
|
const restPath = relativePath.substring("commands/".length);
|
|
15926
16202
|
if (toolPaths.commands) {
|
|
15927
|
-
return (0,
|
|
16203
|
+
return (0, import_node_path113.join)(toolPaths.commands, restPath);
|
|
15928
16204
|
}
|
|
15929
16205
|
}
|
|
15930
16206
|
if (relativePath.startsWith("subagents/")) {
|
|
15931
16207
|
const restPath = relativePath.substring("subagents/".length);
|
|
15932
16208
|
if (toolPaths.subagents) {
|
|
15933
|
-
return (0,
|
|
16209
|
+
return (0, import_node_path113.join)(toolPaths.subagents, restPath);
|
|
15934
16210
|
}
|
|
15935
16211
|
}
|
|
15936
16212
|
if (relativePath.startsWith("skills/")) {
|
|
15937
16213
|
const restPath = relativePath.substring("skills/".length);
|
|
15938
16214
|
if (toolPaths.skills) {
|
|
15939
|
-
return (0,
|
|
16215
|
+
return (0, import_node_path113.join)(toolPaths.skills, restPath);
|
|
15940
16216
|
}
|
|
15941
16217
|
}
|
|
15942
16218
|
return relativePath;
|
|
@@ -15988,38 +16264,38 @@ async function fetchCommand(options) {
|
|
|
15988
16264
|
}
|
|
15989
16265
|
|
|
15990
16266
|
// src/config/config-resolver.ts
|
|
15991
|
-
var
|
|
15992
|
-
var
|
|
16267
|
+
var import_node_path114 = require("path");
|
|
16268
|
+
var import_jsonc_parser2 = require("jsonc-parser");
|
|
15993
16269
|
|
|
15994
16270
|
// src/config/config.ts
|
|
15995
|
-
var
|
|
15996
|
-
var SourceEntrySchema =
|
|
15997
|
-
source:
|
|
15998
|
-
skills: (0,
|
|
16271
|
+
var import_mini56 = require("zod/mini");
|
|
16272
|
+
var SourceEntrySchema = import_mini56.z.object({
|
|
16273
|
+
source: import_mini56.z.string().check((0, import_mini56.minLength)(1, "source must be a non-empty string")),
|
|
16274
|
+
skills: (0, import_mini56.optional)(import_mini56.z.array(import_mini56.z.string()))
|
|
15999
16275
|
});
|
|
16000
|
-
var ConfigParamsSchema =
|
|
16001
|
-
baseDirs:
|
|
16276
|
+
var ConfigParamsSchema = import_mini56.z.object({
|
|
16277
|
+
baseDirs: import_mini56.z.array(import_mini56.z.string()),
|
|
16002
16278
|
targets: RulesyncTargetsSchema,
|
|
16003
16279
|
features: RulesyncFeaturesSchema,
|
|
16004
|
-
verbose:
|
|
16005
|
-
delete:
|
|
16280
|
+
verbose: import_mini56.z.boolean(),
|
|
16281
|
+
delete: import_mini56.z.boolean(),
|
|
16006
16282
|
// New non-experimental options
|
|
16007
|
-
global: (0,
|
|
16008
|
-
silent: (0,
|
|
16009
|
-
simulateCommands: (0,
|
|
16010
|
-
simulateSubagents: (0,
|
|
16011
|
-
simulateSkills: (0,
|
|
16012
|
-
dryRun: (0,
|
|
16013
|
-
check: (0,
|
|
16283
|
+
global: (0, import_mini56.optional)(import_mini56.z.boolean()),
|
|
16284
|
+
silent: (0, import_mini56.optional)(import_mini56.z.boolean()),
|
|
16285
|
+
simulateCommands: (0, import_mini56.optional)(import_mini56.z.boolean()),
|
|
16286
|
+
simulateSubagents: (0, import_mini56.optional)(import_mini56.z.boolean()),
|
|
16287
|
+
simulateSkills: (0, import_mini56.optional)(import_mini56.z.boolean()),
|
|
16288
|
+
dryRun: (0, import_mini56.optional)(import_mini56.z.boolean()),
|
|
16289
|
+
check: (0, import_mini56.optional)(import_mini56.z.boolean()),
|
|
16014
16290
|
// Declarative skill sources
|
|
16015
|
-
sources: (0,
|
|
16291
|
+
sources: (0, import_mini56.optional)(import_mini56.z.array(SourceEntrySchema))
|
|
16016
16292
|
});
|
|
16017
|
-
var PartialConfigParamsSchema =
|
|
16018
|
-
var ConfigFileSchema =
|
|
16019
|
-
$schema: (0,
|
|
16020
|
-
...
|
|
16293
|
+
var PartialConfigParamsSchema = import_mini56.z.partial(ConfigParamsSchema);
|
|
16294
|
+
var ConfigFileSchema = import_mini56.z.object({
|
|
16295
|
+
$schema: (0, import_mini56.optional)(import_mini56.z.string()),
|
|
16296
|
+
...import_mini56.z.partial(ConfigParamsSchema).shape
|
|
16021
16297
|
});
|
|
16022
|
-
var RequiredConfigParamsSchema =
|
|
16298
|
+
var RequiredConfigParamsSchema = import_mini56.z.required(ConfigParamsSchema);
|
|
16023
16299
|
var CONFLICTING_TARGET_PAIRS = [
|
|
16024
16300
|
["augmentcode", "augmentcode-legacy"],
|
|
16025
16301
|
["claudecode", "claudecode-legacy"]
|
|
@@ -16196,7 +16472,7 @@ var loadConfigFromFile = async (filePath) => {
|
|
|
16196
16472
|
}
|
|
16197
16473
|
try {
|
|
16198
16474
|
const fileContent = await readFileContent(filePath);
|
|
16199
|
-
const jsonData = (0,
|
|
16475
|
+
const jsonData = (0, import_jsonc_parser2.parse)(fileContent);
|
|
16200
16476
|
const parsed = ConfigFileSchema.parse(jsonData);
|
|
16201
16477
|
const { $schema: _schema, ...configParams } = parsed;
|
|
16202
16478
|
return configParams;
|
|
@@ -16240,8 +16516,8 @@ var ConfigResolver = class {
|
|
|
16240
16516
|
}) {
|
|
16241
16517
|
const validatedConfigPath = resolvePath(configPath, process.cwd());
|
|
16242
16518
|
const baseConfig = await loadConfigFromFile(validatedConfigPath);
|
|
16243
|
-
const configDir = (0,
|
|
16244
|
-
const localConfigPath = (0,
|
|
16519
|
+
const configDir = (0, import_node_path114.dirname)(validatedConfigPath);
|
|
16520
|
+
const localConfigPath = (0, import_node_path114.join)(configDir, RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH);
|
|
16245
16521
|
const localConfig = await loadConfigFromFile(localConfigPath);
|
|
16246
16522
|
const configByFile = mergeConfigs(baseConfig, localConfig);
|
|
16247
16523
|
const resolvedGlobal = global ?? configByFile.global ?? getDefaults().global;
|
|
@@ -16276,7 +16552,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
16276
16552
|
if (global) {
|
|
16277
16553
|
return [getHomeDirectory()];
|
|
16278
16554
|
}
|
|
16279
|
-
const resolvedBaseDirs = baseDirs.map((baseDir) => (0,
|
|
16555
|
+
const resolvedBaseDirs = baseDirs.map((baseDir) => (0, import_node_path114.resolve)(baseDir));
|
|
16280
16556
|
resolvedBaseDirs.forEach((baseDir) => {
|
|
16281
16557
|
validateBaseDir(baseDir);
|
|
16282
16558
|
});
|
|
@@ -16284,7 +16560,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
16284
16560
|
}
|
|
16285
16561
|
|
|
16286
16562
|
// src/lib/generate.ts
|
|
16287
|
-
var
|
|
16563
|
+
var import_node_path115 = require("path");
|
|
16288
16564
|
var import_es_toolkit4 = require("es-toolkit");
|
|
16289
16565
|
async function processFeatureGeneration(params) {
|
|
16290
16566
|
const { config, processor, toolFiles } = params;
|
|
@@ -16330,7 +16606,7 @@ async function processEmptyFeatureGeneration(params) {
|
|
|
16330
16606
|
return { count: totalCount, paths: [], hasDiff };
|
|
16331
16607
|
}
|
|
16332
16608
|
async function checkRulesyncDirExists(params) {
|
|
16333
|
-
return fileExists((0,
|
|
16609
|
+
return fileExists((0, import_node_path115.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
16334
16610
|
}
|
|
16335
16611
|
async function generate(params) {
|
|
16336
16612
|
const { config } = params;
|
|
@@ -16776,7 +17052,7 @@ async function generateCommand(options) {
|
|
|
16776
17052
|
}
|
|
16777
17053
|
|
|
16778
17054
|
// src/cli/commands/gitignore.ts
|
|
16779
|
-
var
|
|
17055
|
+
var import_node_path116 = require("path");
|
|
16780
17056
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
16781
17057
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
16782
17058
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -16931,7 +17207,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
16931
17207
|
return result;
|
|
16932
17208
|
};
|
|
16933
17209
|
var gitignoreCommand = async () => {
|
|
16934
|
-
const gitignorePath = (0,
|
|
17210
|
+
const gitignorePath = (0, import_node_path116.join)(process.cwd(), ".gitignore");
|
|
16935
17211
|
let gitignoreContent = "";
|
|
16936
17212
|
if (await fileExists(gitignorePath)) {
|
|
16937
17213
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -17211,7 +17487,7 @@ async function importCommand(options) {
|
|
|
17211
17487
|
}
|
|
17212
17488
|
|
|
17213
17489
|
// src/lib/init.ts
|
|
17214
|
-
var
|
|
17490
|
+
var import_node_path117 = require("path");
|
|
17215
17491
|
async function init() {
|
|
17216
17492
|
const sampleFiles = await createSampleFiles();
|
|
17217
17493
|
const configFile = await createConfigFile();
|
|
@@ -17401,27 +17677,27 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
17401
17677
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
17402
17678
|
await ensureDir(skillPaths.relativeDirPath);
|
|
17403
17679
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
17404
|
-
const ruleFilepath = (0,
|
|
17680
|
+
const ruleFilepath = (0, import_node_path117.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
17405
17681
|
results.push(await writeIfNotExists(ruleFilepath, sampleRuleFile.content));
|
|
17406
|
-
const mcpFilepath = (0,
|
|
17682
|
+
const mcpFilepath = (0, import_node_path117.join)(
|
|
17407
17683
|
mcpPaths.recommended.relativeDirPath,
|
|
17408
17684
|
mcpPaths.recommended.relativeFilePath
|
|
17409
17685
|
);
|
|
17410
17686
|
results.push(await writeIfNotExists(mcpFilepath, sampleMcpFile.content));
|
|
17411
|
-
const commandFilepath = (0,
|
|
17687
|
+
const commandFilepath = (0, import_node_path117.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
17412
17688
|
results.push(await writeIfNotExists(commandFilepath, sampleCommandFile.content));
|
|
17413
|
-
const subagentFilepath = (0,
|
|
17689
|
+
const subagentFilepath = (0, import_node_path117.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
17414
17690
|
results.push(await writeIfNotExists(subagentFilepath, sampleSubagentFile.content));
|
|
17415
|
-
const skillDirPath = (0,
|
|
17691
|
+
const skillDirPath = (0, import_node_path117.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
17416
17692
|
await ensureDir(skillDirPath);
|
|
17417
|
-
const skillFilepath = (0,
|
|
17693
|
+
const skillFilepath = (0, import_node_path117.join)(skillDirPath, SKILL_FILE_NAME);
|
|
17418
17694
|
results.push(await writeIfNotExists(skillFilepath, sampleSkillFile.content));
|
|
17419
|
-
const ignoreFilepath = (0,
|
|
17695
|
+
const ignoreFilepath = (0, import_node_path117.join)(
|
|
17420
17696
|
ignorePaths.recommended.relativeDirPath,
|
|
17421
17697
|
ignorePaths.recommended.relativeFilePath
|
|
17422
17698
|
);
|
|
17423
17699
|
results.push(await writeIfNotExists(ignoreFilepath, sampleIgnoreFile.content));
|
|
17424
|
-
const hooksFilepath = (0,
|
|
17700
|
+
const hooksFilepath = (0, import_node_path117.join)(hooksPaths.relativeDirPath, hooksPaths.relativeFilePath);
|
|
17425
17701
|
results.push(await writeIfNotExists(hooksFilepath, sampleHooksFile.content));
|
|
17426
17702
|
return results;
|
|
17427
17703
|
}
|
|
@@ -17459,33 +17735,33 @@ async function initCommand() {
|
|
|
17459
17735
|
}
|
|
17460
17736
|
|
|
17461
17737
|
// src/lib/sources.ts
|
|
17462
|
-
var
|
|
17738
|
+
var import_node_path119 = require("path");
|
|
17463
17739
|
var import_promise2 = require("es-toolkit/promise");
|
|
17464
17740
|
|
|
17465
17741
|
// src/lib/sources-lock.ts
|
|
17466
17742
|
var import_node_crypto = require("crypto");
|
|
17467
|
-
var
|
|
17468
|
-
var
|
|
17743
|
+
var import_node_path118 = require("path");
|
|
17744
|
+
var import_mini57 = require("zod/mini");
|
|
17469
17745
|
var LOCKFILE_VERSION = 1;
|
|
17470
|
-
var LockedSkillSchema =
|
|
17471
|
-
integrity:
|
|
17746
|
+
var LockedSkillSchema = import_mini57.z.object({
|
|
17747
|
+
integrity: import_mini57.z.string()
|
|
17472
17748
|
});
|
|
17473
|
-
var LockedSourceSchema =
|
|
17474
|
-
requestedRef: (0,
|
|
17475
|
-
resolvedRef:
|
|
17476
|
-
resolvedAt: (0,
|
|
17477
|
-
skills:
|
|
17749
|
+
var LockedSourceSchema = import_mini57.z.object({
|
|
17750
|
+
requestedRef: (0, import_mini57.optional)(import_mini57.z.string()),
|
|
17751
|
+
resolvedRef: import_mini57.z.string(),
|
|
17752
|
+
resolvedAt: (0, import_mini57.optional)(import_mini57.z.string()),
|
|
17753
|
+
skills: import_mini57.z.record(import_mini57.z.string(), LockedSkillSchema)
|
|
17478
17754
|
});
|
|
17479
|
-
var SourcesLockSchema =
|
|
17480
|
-
lockfileVersion:
|
|
17481
|
-
sources:
|
|
17755
|
+
var SourcesLockSchema = import_mini57.z.object({
|
|
17756
|
+
lockfileVersion: import_mini57.z.number(),
|
|
17757
|
+
sources: import_mini57.z.record(import_mini57.z.string(), LockedSourceSchema)
|
|
17482
17758
|
});
|
|
17483
|
-
var LegacyLockedSourceSchema =
|
|
17484
|
-
resolvedRef:
|
|
17485
|
-
skills:
|
|
17759
|
+
var LegacyLockedSourceSchema = import_mini57.z.object({
|
|
17760
|
+
resolvedRef: import_mini57.z.string(),
|
|
17761
|
+
skills: import_mini57.z.array(import_mini57.z.string())
|
|
17486
17762
|
});
|
|
17487
|
-
var LegacySourcesLockSchema =
|
|
17488
|
-
sources:
|
|
17763
|
+
var LegacySourcesLockSchema = import_mini57.z.object({
|
|
17764
|
+
sources: import_mini57.z.record(import_mini57.z.string(), LegacyLockedSourceSchema)
|
|
17489
17765
|
});
|
|
17490
17766
|
function migrateLegacyLock(legacy) {
|
|
17491
17767
|
const sources = {};
|
|
@@ -17508,7 +17784,7 @@ function createEmptyLock() {
|
|
|
17508
17784
|
return { lockfileVersion: LOCKFILE_VERSION, sources: {} };
|
|
17509
17785
|
}
|
|
17510
17786
|
async function readLockFile(params) {
|
|
17511
|
-
const lockPath = (0,
|
|
17787
|
+
const lockPath = (0, import_node_path118.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
|
|
17512
17788
|
if (!await fileExists(lockPath)) {
|
|
17513
17789
|
logger.debug("No sources lockfile found, starting fresh.");
|
|
17514
17790
|
return createEmptyLock();
|
|
@@ -17536,7 +17812,7 @@ async function readLockFile(params) {
|
|
|
17536
17812
|
}
|
|
17537
17813
|
}
|
|
17538
17814
|
async function writeLockFile(params) {
|
|
17539
|
-
const lockPath = (0,
|
|
17815
|
+
const lockPath = (0, import_node_path118.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
|
|
17540
17816
|
const content = JSON.stringify(params.lock, null, 2) + "\n";
|
|
17541
17817
|
await writeFileContent(lockPath, content);
|
|
17542
17818
|
logger.debug(`Wrote sources lockfile to ${lockPath}`);
|
|
@@ -17677,7 +17953,7 @@ async function resolveAndFetchSources(params) {
|
|
|
17677
17953
|
async function checkLockedSkillsExist(curatedDir, skillNames) {
|
|
17678
17954
|
if (skillNames.length === 0) return true;
|
|
17679
17955
|
for (const name of skillNames) {
|
|
17680
|
-
if (!await directoryExists((0,
|
|
17956
|
+
if (!await directoryExists((0, import_node_path119.join)(curatedDir, name))) {
|
|
17681
17957
|
return false;
|
|
17682
17958
|
}
|
|
17683
17959
|
}
|
|
@@ -17707,7 +17983,7 @@ async function fetchSource(params) {
|
|
|
17707
17983
|
ref = resolvedSha;
|
|
17708
17984
|
logger.debug(`Resolved ${sourceKey} ref "${requestedRef}" to SHA: ${resolvedSha}`);
|
|
17709
17985
|
}
|
|
17710
|
-
const curatedDir = (0,
|
|
17986
|
+
const curatedDir = (0, import_node_path119.join)(baseDir, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
17711
17987
|
if (locked && resolvedSha === locked.resolvedRef && !updateSources) {
|
|
17712
17988
|
const allExist = await checkLockedSkillsExist(curatedDir, lockedSkillNames);
|
|
17713
17989
|
if (allExist) {
|
|
@@ -17737,10 +18013,10 @@ async function fetchSource(params) {
|
|
|
17737
18013
|
const semaphore = new import_promise2.Semaphore(FETCH_CONCURRENCY_LIMIT);
|
|
17738
18014
|
const fetchedSkills = {};
|
|
17739
18015
|
if (locked) {
|
|
17740
|
-
const resolvedCuratedDir = (0,
|
|
18016
|
+
const resolvedCuratedDir = (0, import_node_path119.resolve)(curatedDir);
|
|
17741
18017
|
for (const prevSkill of lockedSkillNames) {
|
|
17742
|
-
const prevDir = (0,
|
|
17743
|
-
if (!(0,
|
|
18018
|
+
const prevDir = (0, import_node_path119.join)(curatedDir, prevSkill);
|
|
18019
|
+
if (!(0, import_node_path119.resolve)(prevDir).startsWith(resolvedCuratedDir + import_node_path119.sep)) {
|
|
17744
18020
|
logger.warn(
|
|
17745
18021
|
`Skipping removal of "${prevSkill}": resolved path is outside the curated directory.`
|
|
17746
18022
|
);
|
|
@@ -17790,10 +18066,10 @@ async function fetchSource(params) {
|
|
|
17790
18066
|
const skillFiles = [];
|
|
17791
18067
|
for (const file of files) {
|
|
17792
18068
|
const relativeToSkill = file.path.substring(skillDir.path.length + 1);
|
|
17793
|
-
const localFilePath = (0,
|
|
18069
|
+
const localFilePath = (0, import_node_path119.join)(curatedDir, skillDir.name, relativeToSkill);
|
|
17794
18070
|
checkPathTraversal({
|
|
17795
18071
|
relativePath: relativeToSkill,
|
|
17796
|
-
intendedRootDir: (0,
|
|
18072
|
+
intendedRootDir: (0, import_node_path119.join)(curatedDir, skillDir.name)
|
|
17797
18073
|
});
|
|
17798
18074
|
const content = await withSemaphore(
|
|
17799
18075
|
semaphore,
|
|
@@ -17876,15 +18152,15 @@ async function installCommand(options) {
|
|
|
17876
18152
|
var import_fastmcp = require("fastmcp");
|
|
17877
18153
|
|
|
17878
18154
|
// src/mcp/tools.ts
|
|
17879
|
-
var
|
|
18155
|
+
var import_mini66 = require("zod/mini");
|
|
17880
18156
|
|
|
17881
18157
|
// src/mcp/commands.ts
|
|
17882
|
-
var
|
|
17883
|
-
var
|
|
18158
|
+
var import_node_path120 = require("path");
|
|
18159
|
+
var import_mini58 = require("zod/mini");
|
|
17884
18160
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
17885
18161
|
var maxCommandsCount = 1e3;
|
|
17886
18162
|
async function listCommands() {
|
|
17887
|
-
const commandsDir = (0,
|
|
18163
|
+
const commandsDir = (0, import_node_path120.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
17888
18164
|
try {
|
|
17889
18165
|
const files = await listDirectoryFiles(commandsDir);
|
|
17890
18166
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -17900,7 +18176,7 @@ async function listCommands() {
|
|
|
17900
18176
|
});
|
|
17901
18177
|
const frontmatter = command.getFrontmatter();
|
|
17902
18178
|
return {
|
|
17903
|
-
relativePathFromCwd: (0,
|
|
18179
|
+
relativePathFromCwd: (0, import_node_path120.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
17904
18180
|
frontmatter
|
|
17905
18181
|
};
|
|
17906
18182
|
} catch (error) {
|
|
@@ -17922,13 +18198,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
17922
18198
|
relativePath: relativePathFromCwd,
|
|
17923
18199
|
intendedRootDir: process.cwd()
|
|
17924
18200
|
});
|
|
17925
|
-
const filename = (0,
|
|
18201
|
+
const filename = (0, import_node_path120.basename)(relativePathFromCwd);
|
|
17926
18202
|
try {
|
|
17927
18203
|
const command = await RulesyncCommand.fromFile({
|
|
17928
18204
|
relativeFilePath: filename
|
|
17929
18205
|
});
|
|
17930
18206
|
return {
|
|
17931
|
-
relativePathFromCwd: (0,
|
|
18207
|
+
relativePathFromCwd: (0, import_node_path120.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
17932
18208
|
frontmatter: command.getFrontmatter(),
|
|
17933
18209
|
body: command.getBody()
|
|
17934
18210
|
};
|
|
@@ -17947,7 +18223,7 @@ async function putCommand({
|
|
|
17947
18223
|
relativePath: relativePathFromCwd,
|
|
17948
18224
|
intendedRootDir: process.cwd()
|
|
17949
18225
|
});
|
|
17950
|
-
const filename = (0,
|
|
18226
|
+
const filename = (0, import_node_path120.basename)(relativePathFromCwd);
|
|
17951
18227
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
17952
18228
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
17953
18229
|
throw new Error(
|
|
@@ -17957,7 +18233,7 @@ async function putCommand({
|
|
|
17957
18233
|
try {
|
|
17958
18234
|
const existingCommands = await listCommands();
|
|
17959
18235
|
const isUpdate = existingCommands.some(
|
|
17960
|
-
(command2) => command2.relativePathFromCwd === (0,
|
|
18236
|
+
(command2) => command2.relativePathFromCwd === (0, import_node_path120.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
17961
18237
|
);
|
|
17962
18238
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
17963
18239
|
throw new Error(
|
|
@@ -17974,11 +18250,11 @@ async function putCommand({
|
|
|
17974
18250
|
fileContent,
|
|
17975
18251
|
validate: true
|
|
17976
18252
|
});
|
|
17977
|
-
const commandsDir = (0,
|
|
18253
|
+
const commandsDir = (0, import_node_path120.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
17978
18254
|
await ensureDir(commandsDir);
|
|
17979
18255
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
17980
18256
|
return {
|
|
17981
|
-
relativePathFromCwd: (0,
|
|
18257
|
+
relativePathFromCwd: (0, import_node_path120.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
17982
18258
|
frontmatter: command.getFrontmatter(),
|
|
17983
18259
|
body: command.getBody()
|
|
17984
18260
|
};
|
|
@@ -17993,12 +18269,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
17993
18269
|
relativePath: relativePathFromCwd,
|
|
17994
18270
|
intendedRootDir: process.cwd()
|
|
17995
18271
|
});
|
|
17996
|
-
const filename = (0,
|
|
17997
|
-
const fullPath = (0,
|
|
18272
|
+
const filename = (0, import_node_path120.basename)(relativePathFromCwd);
|
|
18273
|
+
const fullPath = (0, import_node_path120.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
17998
18274
|
try {
|
|
17999
18275
|
await removeFile(fullPath);
|
|
18000
18276
|
return {
|
|
18001
|
-
relativePathFromCwd: (0,
|
|
18277
|
+
relativePathFromCwd: (0, import_node_path120.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
18002
18278
|
};
|
|
18003
18279
|
} catch (error) {
|
|
18004
18280
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -18007,23 +18283,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
18007
18283
|
}
|
|
18008
18284
|
}
|
|
18009
18285
|
var commandToolSchemas = {
|
|
18010
|
-
listCommands:
|
|
18011
|
-
getCommand:
|
|
18012
|
-
relativePathFromCwd:
|
|
18286
|
+
listCommands: import_mini58.z.object({}),
|
|
18287
|
+
getCommand: import_mini58.z.object({
|
|
18288
|
+
relativePathFromCwd: import_mini58.z.string()
|
|
18013
18289
|
}),
|
|
18014
|
-
putCommand:
|
|
18015
|
-
relativePathFromCwd:
|
|
18290
|
+
putCommand: import_mini58.z.object({
|
|
18291
|
+
relativePathFromCwd: import_mini58.z.string(),
|
|
18016
18292
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
18017
|
-
body:
|
|
18293
|
+
body: import_mini58.z.string()
|
|
18018
18294
|
}),
|
|
18019
|
-
deleteCommand:
|
|
18020
|
-
relativePathFromCwd:
|
|
18295
|
+
deleteCommand: import_mini58.z.object({
|
|
18296
|
+
relativePathFromCwd: import_mini58.z.string()
|
|
18021
18297
|
})
|
|
18022
18298
|
};
|
|
18023
18299
|
var commandTools = {
|
|
18024
18300
|
listCommands: {
|
|
18025
18301
|
name: "listCommands",
|
|
18026
|
-
description: `List all commands from ${(0,
|
|
18302
|
+
description: `List all commands from ${(0, import_node_path120.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
18027
18303
|
parameters: commandToolSchemas.listCommands,
|
|
18028
18304
|
execute: async () => {
|
|
18029
18305
|
const commands = await listCommands();
|
|
@@ -18065,15 +18341,15 @@ var commandTools = {
|
|
|
18065
18341
|
};
|
|
18066
18342
|
|
|
18067
18343
|
// src/mcp/generate.ts
|
|
18068
|
-
var
|
|
18069
|
-
var generateOptionsSchema =
|
|
18070
|
-
targets:
|
|
18071
|
-
features:
|
|
18072
|
-
delete:
|
|
18073
|
-
global:
|
|
18074
|
-
simulateCommands:
|
|
18075
|
-
simulateSubagents:
|
|
18076
|
-
simulateSkills:
|
|
18344
|
+
var import_mini59 = require("zod/mini");
|
|
18345
|
+
var generateOptionsSchema = import_mini59.z.object({
|
|
18346
|
+
targets: import_mini59.z.optional(import_mini59.z.array(import_mini59.z.string())),
|
|
18347
|
+
features: import_mini59.z.optional(import_mini59.z.array(import_mini59.z.string())),
|
|
18348
|
+
delete: import_mini59.z.optional(import_mini59.z.boolean()),
|
|
18349
|
+
global: import_mini59.z.optional(import_mini59.z.boolean()),
|
|
18350
|
+
simulateCommands: import_mini59.z.optional(import_mini59.z.boolean()),
|
|
18351
|
+
simulateSubagents: import_mini59.z.optional(import_mini59.z.boolean()),
|
|
18352
|
+
simulateSkills: import_mini59.z.optional(import_mini59.z.boolean())
|
|
18077
18353
|
});
|
|
18078
18354
|
async function executeGenerate(options = {}) {
|
|
18079
18355
|
try {
|
|
@@ -18150,11 +18426,11 @@ var generateTools = {
|
|
|
18150
18426
|
};
|
|
18151
18427
|
|
|
18152
18428
|
// src/mcp/ignore.ts
|
|
18153
|
-
var
|
|
18154
|
-
var
|
|
18429
|
+
var import_node_path121 = require("path");
|
|
18430
|
+
var import_mini60 = require("zod/mini");
|
|
18155
18431
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
18156
18432
|
async function getIgnoreFile() {
|
|
18157
|
-
const ignoreFilePath = (0,
|
|
18433
|
+
const ignoreFilePath = (0, import_node_path121.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
18158
18434
|
try {
|
|
18159
18435
|
const content = await readFileContent(ignoreFilePath);
|
|
18160
18436
|
return {
|
|
@@ -18171,7 +18447,7 @@ async function getIgnoreFile() {
|
|
|
18171
18447
|
}
|
|
18172
18448
|
}
|
|
18173
18449
|
async function putIgnoreFile({ content }) {
|
|
18174
|
-
const ignoreFilePath = (0,
|
|
18450
|
+
const ignoreFilePath = (0, import_node_path121.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
18175
18451
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
18176
18452
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
18177
18453
|
throw new Error(
|
|
@@ -18195,8 +18471,8 @@ async function putIgnoreFile({ content }) {
|
|
|
18195
18471
|
}
|
|
18196
18472
|
}
|
|
18197
18473
|
async function deleteIgnoreFile() {
|
|
18198
|
-
const aiignorePath = (0,
|
|
18199
|
-
const legacyIgnorePath = (0,
|
|
18474
|
+
const aiignorePath = (0, import_node_path121.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
18475
|
+
const legacyIgnorePath = (0, import_node_path121.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
18200
18476
|
try {
|
|
18201
18477
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
18202
18478
|
return {
|
|
@@ -18214,11 +18490,11 @@ async function deleteIgnoreFile() {
|
|
|
18214
18490
|
}
|
|
18215
18491
|
}
|
|
18216
18492
|
var ignoreToolSchemas = {
|
|
18217
|
-
getIgnoreFile:
|
|
18218
|
-
putIgnoreFile:
|
|
18219
|
-
content:
|
|
18493
|
+
getIgnoreFile: import_mini60.z.object({}),
|
|
18494
|
+
putIgnoreFile: import_mini60.z.object({
|
|
18495
|
+
content: import_mini60.z.string()
|
|
18220
18496
|
}),
|
|
18221
|
-
deleteIgnoreFile:
|
|
18497
|
+
deleteIgnoreFile: import_mini60.z.object({})
|
|
18222
18498
|
};
|
|
18223
18499
|
var ignoreTools = {
|
|
18224
18500
|
getIgnoreFile: {
|
|
@@ -18251,11 +18527,11 @@ var ignoreTools = {
|
|
|
18251
18527
|
};
|
|
18252
18528
|
|
|
18253
18529
|
// src/mcp/import.ts
|
|
18254
|
-
var
|
|
18255
|
-
var importOptionsSchema =
|
|
18256
|
-
target:
|
|
18257
|
-
features:
|
|
18258
|
-
global:
|
|
18530
|
+
var import_mini61 = require("zod/mini");
|
|
18531
|
+
var importOptionsSchema = import_mini61.z.object({
|
|
18532
|
+
target: import_mini61.z.string(),
|
|
18533
|
+
features: import_mini61.z.optional(import_mini61.z.array(import_mini61.z.string())),
|
|
18534
|
+
global: import_mini61.z.optional(import_mini61.z.boolean())
|
|
18259
18535
|
});
|
|
18260
18536
|
async function executeImport(options) {
|
|
18261
18537
|
try {
|
|
@@ -18324,15 +18600,15 @@ var importTools = {
|
|
|
18324
18600
|
};
|
|
18325
18601
|
|
|
18326
18602
|
// src/mcp/mcp.ts
|
|
18327
|
-
var
|
|
18328
|
-
var
|
|
18603
|
+
var import_node_path122 = require("path");
|
|
18604
|
+
var import_mini62 = require("zod/mini");
|
|
18329
18605
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
18330
18606
|
async function getMcpFile() {
|
|
18331
18607
|
try {
|
|
18332
18608
|
const rulesyncMcp = await RulesyncMcp.fromFile({
|
|
18333
18609
|
validate: true
|
|
18334
18610
|
});
|
|
18335
|
-
const relativePathFromCwd = (0,
|
|
18611
|
+
const relativePathFromCwd = (0, import_node_path122.join)(
|
|
18336
18612
|
rulesyncMcp.getRelativeDirPath(),
|
|
18337
18613
|
rulesyncMcp.getRelativeFilePath()
|
|
18338
18614
|
);
|
|
@@ -18370,7 +18646,7 @@ async function putMcpFile({ content }) {
|
|
|
18370
18646
|
const paths = RulesyncMcp.getSettablePaths();
|
|
18371
18647
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
18372
18648
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
18373
|
-
const fullPath = (0,
|
|
18649
|
+
const fullPath = (0, import_node_path122.join)(baseDir, relativeDirPath, relativeFilePath);
|
|
18374
18650
|
const rulesyncMcp = new RulesyncMcp({
|
|
18375
18651
|
baseDir,
|
|
18376
18652
|
relativeDirPath,
|
|
@@ -18378,9 +18654,9 @@ async function putMcpFile({ content }) {
|
|
|
18378
18654
|
fileContent: content,
|
|
18379
18655
|
validate: true
|
|
18380
18656
|
});
|
|
18381
|
-
await ensureDir((0,
|
|
18657
|
+
await ensureDir((0, import_node_path122.join)(baseDir, relativeDirPath));
|
|
18382
18658
|
await writeFileContent(fullPath, content);
|
|
18383
|
-
const relativePathFromCwd = (0,
|
|
18659
|
+
const relativePathFromCwd = (0, import_node_path122.join)(relativeDirPath, relativeFilePath);
|
|
18384
18660
|
return {
|
|
18385
18661
|
relativePathFromCwd,
|
|
18386
18662
|
content: rulesyncMcp.getFileContent()
|
|
@@ -18398,15 +18674,15 @@ async function deleteMcpFile() {
|
|
|
18398
18674
|
try {
|
|
18399
18675
|
const baseDir = process.cwd();
|
|
18400
18676
|
const paths = RulesyncMcp.getSettablePaths();
|
|
18401
|
-
const recommendedPath = (0,
|
|
18677
|
+
const recommendedPath = (0, import_node_path122.join)(
|
|
18402
18678
|
baseDir,
|
|
18403
18679
|
paths.recommended.relativeDirPath,
|
|
18404
18680
|
paths.recommended.relativeFilePath
|
|
18405
18681
|
);
|
|
18406
|
-
const legacyPath = (0,
|
|
18682
|
+
const legacyPath = (0, import_node_path122.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
18407
18683
|
await removeFile(recommendedPath);
|
|
18408
18684
|
await removeFile(legacyPath);
|
|
18409
|
-
const relativePathFromCwd = (0,
|
|
18685
|
+
const relativePathFromCwd = (0, import_node_path122.join)(
|
|
18410
18686
|
paths.recommended.relativeDirPath,
|
|
18411
18687
|
paths.recommended.relativeFilePath
|
|
18412
18688
|
);
|
|
@@ -18423,11 +18699,11 @@ async function deleteMcpFile() {
|
|
|
18423
18699
|
}
|
|
18424
18700
|
}
|
|
18425
18701
|
var mcpToolSchemas = {
|
|
18426
|
-
getMcpFile:
|
|
18427
|
-
putMcpFile:
|
|
18428
|
-
content:
|
|
18702
|
+
getMcpFile: import_mini62.z.object({}),
|
|
18703
|
+
putMcpFile: import_mini62.z.object({
|
|
18704
|
+
content: import_mini62.z.string()
|
|
18429
18705
|
}),
|
|
18430
|
-
deleteMcpFile:
|
|
18706
|
+
deleteMcpFile: import_mini62.z.object({})
|
|
18431
18707
|
};
|
|
18432
18708
|
var mcpTools = {
|
|
18433
18709
|
getMcpFile: {
|
|
@@ -18460,12 +18736,12 @@ var mcpTools = {
|
|
|
18460
18736
|
};
|
|
18461
18737
|
|
|
18462
18738
|
// src/mcp/rules.ts
|
|
18463
|
-
var
|
|
18464
|
-
var
|
|
18739
|
+
var import_node_path123 = require("path");
|
|
18740
|
+
var import_mini63 = require("zod/mini");
|
|
18465
18741
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
18466
18742
|
var maxRulesCount = 1e3;
|
|
18467
18743
|
async function listRules() {
|
|
18468
|
-
const rulesDir = (0,
|
|
18744
|
+
const rulesDir = (0, import_node_path123.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
18469
18745
|
try {
|
|
18470
18746
|
const files = await listDirectoryFiles(rulesDir);
|
|
18471
18747
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -18478,7 +18754,7 @@ async function listRules() {
|
|
|
18478
18754
|
});
|
|
18479
18755
|
const frontmatter = rule.getFrontmatter();
|
|
18480
18756
|
return {
|
|
18481
|
-
relativePathFromCwd: (0,
|
|
18757
|
+
relativePathFromCwd: (0, import_node_path123.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
18482
18758
|
frontmatter
|
|
18483
18759
|
};
|
|
18484
18760
|
} catch (error) {
|
|
@@ -18500,14 +18776,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
18500
18776
|
relativePath: relativePathFromCwd,
|
|
18501
18777
|
intendedRootDir: process.cwd()
|
|
18502
18778
|
});
|
|
18503
|
-
const filename = (0,
|
|
18779
|
+
const filename = (0, import_node_path123.basename)(relativePathFromCwd);
|
|
18504
18780
|
try {
|
|
18505
18781
|
const rule = await RulesyncRule.fromFile({
|
|
18506
18782
|
relativeFilePath: filename,
|
|
18507
18783
|
validate: true
|
|
18508
18784
|
});
|
|
18509
18785
|
return {
|
|
18510
|
-
relativePathFromCwd: (0,
|
|
18786
|
+
relativePathFromCwd: (0, import_node_path123.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
18511
18787
|
frontmatter: rule.getFrontmatter(),
|
|
18512
18788
|
body: rule.getBody()
|
|
18513
18789
|
};
|
|
@@ -18526,7 +18802,7 @@ async function putRule({
|
|
|
18526
18802
|
relativePath: relativePathFromCwd,
|
|
18527
18803
|
intendedRootDir: process.cwd()
|
|
18528
18804
|
});
|
|
18529
|
-
const filename = (0,
|
|
18805
|
+
const filename = (0, import_node_path123.basename)(relativePathFromCwd);
|
|
18530
18806
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
18531
18807
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
18532
18808
|
throw new Error(
|
|
@@ -18536,7 +18812,7 @@ async function putRule({
|
|
|
18536
18812
|
try {
|
|
18537
18813
|
const existingRules = await listRules();
|
|
18538
18814
|
const isUpdate = existingRules.some(
|
|
18539
|
-
(rule2) => rule2.relativePathFromCwd === (0,
|
|
18815
|
+
(rule2) => rule2.relativePathFromCwd === (0, import_node_path123.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
18540
18816
|
);
|
|
18541
18817
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
18542
18818
|
throw new Error(
|
|
@@ -18551,11 +18827,11 @@ async function putRule({
|
|
|
18551
18827
|
body,
|
|
18552
18828
|
validate: true
|
|
18553
18829
|
});
|
|
18554
|
-
const rulesDir = (0,
|
|
18830
|
+
const rulesDir = (0, import_node_path123.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
18555
18831
|
await ensureDir(rulesDir);
|
|
18556
18832
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
18557
18833
|
return {
|
|
18558
|
-
relativePathFromCwd: (0,
|
|
18834
|
+
relativePathFromCwd: (0, import_node_path123.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
18559
18835
|
frontmatter: rule.getFrontmatter(),
|
|
18560
18836
|
body: rule.getBody()
|
|
18561
18837
|
};
|
|
@@ -18570,12 +18846,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
18570
18846
|
relativePath: relativePathFromCwd,
|
|
18571
18847
|
intendedRootDir: process.cwd()
|
|
18572
18848
|
});
|
|
18573
|
-
const filename = (0,
|
|
18574
|
-
const fullPath = (0,
|
|
18849
|
+
const filename = (0, import_node_path123.basename)(relativePathFromCwd);
|
|
18850
|
+
const fullPath = (0, import_node_path123.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
18575
18851
|
try {
|
|
18576
18852
|
await removeFile(fullPath);
|
|
18577
18853
|
return {
|
|
18578
|
-
relativePathFromCwd: (0,
|
|
18854
|
+
relativePathFromCwd: (0, import_node_path123.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
18579
18855
|
};
|
|
18580
18856
|
} catch (error) {
|
|
18581
18857
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -18584,23 +18860,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
18584
18860
|
}
|
|
18585
18861
|
}
|
|
18586
18862
|
var ruleToolSchemas = {
|
|
18587
|
-
listRules:
|
|
18588
|
-
getRule:
|
|
18589
|
-
relativePathFromCwd:
|
|
18863
|
+
listRules: import_mini63.z.object({}),
|
|
18864
|
+
getRule: import_mini63.z.object({
|
|
18865
|
+
relativePathFromCwd: import_mini63.z.string()
|
|
18590
18866
|
}),
|
|
18591
|
-
putRule:
|
|
18592
|
-
relativePathFromCwd:
|
|
18867
|
+
putRule: import_mini63.z.object({
|
|
18868
|
+
relativePathFromCwd: import_mini63.z.string(),
|
|
18593
18869
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
18594
|
-
body:
|
|
18870
|
+
body: import_mini63.z.string()
|
|
18595
18871
|
}),
|
|
18596
|
-
deleteRule:
|
|
18597
|
-
relativePathFromCwd:
|
|
18872
|
+
deleteRule: import_mini63.z.object({
|
|
18873
|
+
relativePathFromCwd: import_mini63.z.string()
|
|
18598
18874
|
})
|
|
18599
18875
|
};
|
|
18600
18876
|
var ruleTools = {
|
|
18601
18877
|
listRules: {
|
|
18602
18878
|
name: "listRules",
|
|
18603
|
-
description: `List all rules from ${(0,
|
|
18879
|
+
description: `List all rules from ${(0, import_node_path123.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
18604
18880
|
parameters: ruleToolSchemas.listRules,
|
|
18605
18881
|
execute: async () => {
|
|
18606
18882
|
const rules = await listRules();
|
|
@@ -18642,8 +18918,8 @@ var ruleTools = {
|
|
|
18642
18918
|
};
|
|
18643
18919
|
|
|
18644
18920
|
// src/mcp/skills.ts
|
|
18645
|
-
var
|
|
18646
|
-
var
|
|
18921
|
+
var import_node_path124 = require("path");
|
|
18922
|
+
var import_mini64 = require("zod/mini");
|
|
18647
18923
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
18648
18924
|
var maxSkillsCount = 1e3;
|
|
18649
18925
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -18659,19 +18935,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
18659
18935
|
};
|
|
18660
18936
|
}
|
|
18661
18937
|
function extractDirName(relativeDirPathFromCwd) {
|
|
18662
|
-
const dirName = (0,
|
|
18938
|
+
const dirName = (0, import_node_path124.basename)(relativeDirPathFromCwd);
|
|
18663
18939
|
if (!dirName) {
|
|
18664
18940
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
18665
18941
|
}
|
|
18666
18942
|
return dirName;
|
|
18667
18943
|
}
|
|
18668
18944
|
async function listSkills() {
|
|
18669
|
-
const skillsDir = (0,
|
|
18945
|
+
const skillsDir = (0, import_node_path124.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
18670
18946
|
try {
|
|
18671
|
-
const skillDirPaths = await findFilesByGlobs((0,
|
|
18947
|
+
const skillDirPaths = await findFilesByGlobs((0, import_node_path124.join)(skillsDir, "*"), { type: "dir" });
|
|
18672
18948
|
const skills = await Promise.all(
|
|
18673
18949
|
skillDirPaths.map(async (dirPath) => {
|
|
18674
|
-
const dirName = (0,
|
|
18950
|
+
const dirName = (0, import_node_path124.basename)(dirPath);
|
|
18675
18951
|
if (!dirName) return null;
|
|
18676
18952
|
try {
|
|
18677
18953
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -18679,7 +18955,7 @@ async function listSkills() {
|
|
|
18679
18955
|
});
|
|
18680
18956
|
const frontmatter = skill.getFrontmatter();
|
|
18681
18957
|
return {
|
|
18682
|
-
relativeDirPathFromCwd: (0,
|
|
18958
|
+
relativeDirPathFromCwd: (0, import_node_path124.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
18683
18959
|
frontmatter
|
|
18684
18960
|
};
|
|
18685
18961
|
} catch (error) {
|
|
@@ -18707,7 +18983,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
18707
18983
|
dirName
|
|
18708
18984
|
});
|
|
18709
18985
|
return {
|
|
18710
|
-
relativeDirPathFromCwd: (0,
|
|
18986
|
+
relativeDirPathFromCwd: (0, import_node_path124.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
18711
18987
|
frontmatter: skill.getFrontmatter(),
|
|
18712
18988
|
body: skill.getBody(),
|
|
18713
18989
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -18741,7 +19017,7 @@ async function putSkill({
|
|
|
18741
19017
|
try {
|
|
18742
19018
|
const existingSkills = await listSkills();
|
|
18743
19019
|
const isUpdate = existingSkills.some(
|
|
18744
|
-
(skill2) => skill2.relativeDirPathFromCwd === (0,
|
|
19020
|
+
(skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path124.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
18745
19021
|
);
|
|
18746
19022
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
18747
19023
|
throw new Error(
|
|
@@ -18758,9 +19034,9 @@ async function putSkill({
|
|
|
18758
19034
|
otherFiles: aiDirFiles,
|
|
18759
19035
|
validate: true
|
|
18760
19036
|
});
|
|
18761
|
-
const skillDirPath = (0,
|
|
19037
|
+
const skillDirPath = (0, import_node_path124.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
18762
19038
|
await ensureDir(skillDirPath);
|
|
18763
|
-
const skillFilePath = (0,
|
|
19039
|
+
const skillFilePath = (0, import_node_path124.join)(skillDirPath, SKILL_FILE_NAME);
|
|
18764
19040
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
18765
19041
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
18766
19042
|
for (const file of otherFiles) {
|
|
@@ -18768,15 +19044,15 @@ async function putSkill({
|
|
|
18768
19044
|
relativePath: file.name,
|
|
18769
19045
|
intendedRootDir: skillDirPath
|
|
18770
19046
|
});
|
|
18771
|
-
const filePath = (0,
|
|
18772
|
-
const fileDir = (0,
|
|
19047
|
+
const filePath = (0, import_node_path124.join)(skillDirPath, file.name);
|
|
19048
|
+
const fileDir = (0, import_node_path124.join)(skillDirPath, (0, import_node_path124.dirname)(file.name));
|
|
18773
19049
|
if (fileDir !== skillDirPath) {
|
|
18774
19050
|
await ensureDir(fileDir);
|
|
18775
19051
|
}
|
|
18776
19052
|
await writeFileContent(filePath, file.body);
|
|
18777
19053
|
}
|
|
18778
19054
|
return {
|
|
18779
|
-
relativeDirPathFromCwd: (0,
|
|
19055
|
+
relativeDirPathFromCwd: (0, import_node_path124.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
18780
19056
|
frontmatter: skill.getFrontmatter(),
|
|
18781
19057
|
body: skill.getBody(),
|
|
18782
19058
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -18798,13 +19074,13 @@ async function deleteSkill({
|
|
|
18798
19074
|
intendedRootDir: process.cwd()
|
|
18799
19075
|
});
|
|
18800
19076
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
18801
|
-
const skillDirPath = (0,
|
|
19077
|
+
const skillDirPath = (0, import_node_path124.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
18802
19078
|
try {
|
|
18803
19079
|
if (await directoryExists(skillDirPath)) {
|
|
18804
19080
|
await removeDirectory(skillDirPath);
|
|
18805
19081
|
}
|
|
18806
19082
|
return {
|
|
18807
|
-
relativeDirPathFromCwd: (0,
|
|
19083
|
+
relativeDirPathFromCwd: (0, import_node_path124.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
18808
19084
|
};
|
|
18809
19085
|
} catch (error) {
|
|
18810
19086
|
throw new Error(
|
|
@@ -18815,29 +19091,29 @@ async function deleteSkill({
|
|
|
18815
19091
|
);
|
|
18816
19092
|
}
|
|
18817
19093
|
}
|
|
18818
|
-
var McpSkillFileSchema =
|
|
18819
|
-
name:
|
|
18820
|
-
body:
|
|
19094
|
+
var McpSkillFileSchema = import_mini64.z.object({
|
|
19095
|
+
name: import_mini64.z.string(),
|
|
19096
|
+
body: import_mini64.z.string()
|
|
18821
19097
|
});
|
|
18822
19098
|
var skillToolSchemas = {
|
|
18823
|
-
listSkills:
|
|
18824
|
-
getSkill:
|
|
18825
|
-
relativeDirPathFromCwd:
|
|
19099
|
+
listSkills: import_mini64.z.object({}),
|
|
19100
|
+
getSkill: import_mini64.z.object({
|
|
19101
|
+
relativeDirPathFromCwd: import_mini64.z.string()
|
|
18826
19102
|
}),
|
|
18827
|
-
putSkill:
|
|
18828
|
-
relativeDirPathFromCwd:
|
|
19103
|
+
putSkill: import_mini64.z.object({
|
|
19104
|
+
relativeDirPathFromCwd: import_mini64.z.string(),
|
|
18829
19105
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
18830
|
-
body:
|
|
18831
|
-
otherFiles:
|
|
19106
|
+
body: import_mini64.z.string(),
|
|
19107
|
+
otherFiles: import_mini64.z.optional(import_mini64.z.array(McpSkillFileSchema))
|
|
18832
19108
|
}),
|
|
18833
|
-
deleteSkill:
|
|
18834
|
-
relativeDirPathFromCwd:
|
|
19109
|
+
deleteSkill: import_mini64.z.object({
|
|
19110
|
+
relativeDirPathFromCwd: import_mini64.z.string()
|
|
18835
19111
|
})
|
|
18836
19112
|
};
|
|
18837
19113
|
var skillTools = {
|
|
18838
19114
|
listSkills: {
|
|
18839
19115
|
name: "listSkills",
|
|
18840
|
-
description: `List all skills from ${(0,
|
|
19116
|
+
description: `List all skills from ${(0, import_node_path124.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
18841
19117
|
parameters: skillToolSchemas.listSkills,
|
|
18842
19118
|
execute: async () => {
|
|
18843
19119
|
const skills = await listSkills();
|
|
@@ -18880,12 +19156,12 @@ var skillTools = {
|
|
|
18880
19156
|
};
|
|
18881
19157
|
|
|
18882
19158
|
// src/mcp/subagents.ts
|
|
18883
|
-
var
|
|
18884
|
-
var
|
|
19159
|
+
var import_node_path125 = require("path");
|
|
19160
|
+
var import_mini65 = require("zod/mini");
|
|
18885
19161
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
18886
19162
|
var maxSubagentsCount = 1e3;
|
|
18887
19163
|
async function listSubagents() {
|
|
18888
|
-
const subagentsDir = (0,
|
|
19164
|
+
const subagentsDir = (0, import_node_path125.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
18889
19165
|
try {
|
|
18890
19166
|
const files = await listDirectoryFiles(subagentsDir);
|
|
18891
19167
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -18898,7 +19174,7 @@ async function listSubagents() {
|
|
|
18898
19174
|
});
|
|
18899
19175
|
const frontmatter = subagent.getFrontmatter();
|
|
18900
19176
|
return {
|
|
18901
|
-
relativePathFromCwd: (0,
|
|
19177
|
+
relativePathFromCwd: (0, import_node_path125.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
18902
19178
|
frontmatter
|
|
18903
19179
|
};
|
|
18904
19180
|
} catch (error) {
|
|
@@ -18922,14 +19198,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
18922
19198
|
relativePath: relativePathFromCwd,
|
|
18923
19199
|
intendedRootDir: process.cwd()
|
|
18924
19200
|
});
|
|
18925
|
-
const filename = (0,
|
|
19201
|
+
const filename = (0, import_node_path125.basename)(relativePathFromCwd);
|
|
18926
19202
|
try {
|
|
18927
19203
|
const subagent = await RulesyncSubagent.fromFile({
|
|
18928
19204
|
relativeFilePath: filename,
|
|
18929
19205
|
validate: true
|
|
18930
19206
|
});
|
|
18931
19207
|
return {
|
|
18932
|
-
relativePathFromCwd: (0,
|
|
19208
|
+
relativePathFromCwd: (0, import_node_path125.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
18933
19209
|
frontmatter: subagent.getFrontmatter(),
|
|
18934
19210
|
body: subagent.getBody()
|
|
18935
19211
|
};
|
|
@@ -18948,7 +19224,7 @@ async function putSubagent({
|
|
|
18948
19224
|
relativePath: relativePathFromCwd,
|
|
18949
19225
|
intendedRootDir: process.cwd()
|
|
18950
19226
|
});
|
|
18951
|
-
const filename = (0,
|
|
19227
|
+
const filename = (0, import_node_path125.basename)(relativePathFromCwd);
|
|
18952
19228
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
18953
19229
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
18954
19230
|
throw new Error(
|
|
@@ -18958,7 +19234,7 @@ async function putSubagent({
|
|
|
18958
19234
|
try {
|
|
18959
19235
|
const existingSubagents = await listSubagents();
|
|
18960
19236
|
const isUpdate = existingSubagents.some(
|
|
18961
|
-
(subagent2) => subagent2.relativePathFromCwd === (0,
|
|
19237
|
+
(subagent2) => subagent2.relativePathFromCwd === (0, import_node_path125.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
18962
19238
|
);
|
|
18963
19239
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
18964
19240
|
throw new Error(
|
|
@@ -18973,11 +19249,11 @@ async function putSubagent({
|
|
|
18973
19249
|
body,
|
|
18974
19250
|
validate: true
|
|
18975
19251
|
});
|
|
18976
|
-
const subagentsDir = (0,
|
|
19252
|
+
const subagentsDir = (0, import_node_path125.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
18977
19253
|
await ensureDir(subagentsDir);
|
|
18978
19254
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
18979
19255
|
return {
|
|
18980
|
-
relativePathFromCwd: (0,
|
|
19256
|
+
relativePathFromCwd: (0, import_node_path125.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
18981
19257
|
frontmatter: subagent.getFrontmatter(),
|
|
18982
19258
|
body: subagent.getBody()
|
|
18983
19259
|
};
|
|
@@ -18992,12 +19268,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
18992
19268
|
relativePath: relativePathFromCwd,
|
|
18993
19269
|
intendedRootDir: process.cwd()
|
|
18994
19270
|
});
|
|
18995
|
-
const filename = (0,
|
|
18996
|
-
const fullPath = (0,
|
|
19271
|
+
const filename = (0, import_node_path125.basename)(relativePathFromCwd);
|
|
19272
|
+
const fullPath = (0, import_node_path125.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
18997
19273
|
try {
|
|
18998
19274
|
await removeFile(fullPath);
|
|
18999
19275
|
return {
|
|
19000
|
-
relativePathFromCwd: (0,
|
|
19276
|
+
relativePathFromCwd: (0, import_node_path125.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
19001
19277
|
};
|
|
19002
19278
|
} catch (error) {
|
|
19003
19279
|
throw new Error(
|
|
@@ -19009,23 +19285,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
19009
19285
|
}
|
|
19010
19286
|
}
|
|
19011
19287
|
var subagentToolSchemas = {
|
|
19012
|
-
listSubagents:
|
|
19013
|
-
getSubagent:
|
|
19014
|
-
relativePathFromCwd:
|
|
19288
|
+
listSubagents: import_mini65.z.object({}),
|
|
19289
|
+
getSubagent: import_mini65.z.object({
|
|
19290
|
+
relativePathFromCwd: import_mini65.z.string()
|
|
19015
19291
|
}),
|
|
19016
|
-
putSubagent:
|
|
19017
|
-
relativePathFromCwd:
|
|
19292
|
+
putSubagent: import_mini65.z.object({
|
|
19293
|
+
relativePathFromCwd: import_mini65.z.string(),
|
|
19018
19294
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
19019
|
-
body:
|
|
19295
|
+
body: import_mini65.z.string()
|
|
19020
19296
|
}),
|
|
19021
|
-
deleteSubagent:
|
|
19022
|
-
relativePathFromCwd:
|
|
19297
|
+
deleteSubagent: import_mini65.z.object({
|
|
19298
|
+
relativePathFromCwd: import_mini65.z.string()
|
|
19023
19299
|
})
|
|
19024
19300
|
};
|
|
19025
19301
|
var subagentTools = {
|
|
19026
19302
|
listSubagents: {
|
|
19027
19303
|
name: "listSubagents",
|
|
19028
|
-
description: `List all subagents from ${(0,
|
|
19304
|
+
description: `List all subagents from ${(0, import_node_path125.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
19029
19305
|
parameters: subagentToolSchemas.listSubagents,
|
|
19030
19306
|
execute: async () => {
|
|
19031
19307
|
const subagents = await listSubagents();
|
|
@@ -19067,7 +19343,7 @@ var subagentTools = {
|
|
|
19067
19343
|
};
|
|
19068
19344
|
|
|
19069
19345
|
// src/mcp/tools.ts
|
|
19070
|
-
var rulesyncFeatureSchema =
|
|
19346
|
+
var rulesyncFeatureSchema = import_mini66.z.enum([
|
|
19071
19347
|
"rule",
|
|
19072
19348
|
"command",
|
|
19073
19349
|
"subagent",
|
|
@@ -19077,21 +19353,21 @@ var rulesyncFeatureSchema = import_mini65.z.enum([
|
|
|
19077
19353
|
"generate",
|
|
19078
19354
|
"import"
|
|
19079
19355
|
]);
|
|
19080
|
-
var rulesyncOperationSchema =
|
|
19081
|
-
var skillFileSchema =
|
|
19082
|
-
name:
|
|
19083
|
-
body:
|
|
19356
|
+
var rulesyncOperationSchema = import_mini66.z.enum(["list", "get", "put", "delete", "run"]);
|
|
19357
|
+
var skillFileSchema = import_mini66.z.object({
|
|
19358
|
+
name: import_mini66.z.string(),
|
|
19359
|
+
body: import_mini66.z.string()
|
|
19084
19360
|
});
|
|
19085
|
-
var rulesyncToolSchema =
|
|
19361
|
+
var rulesyncToolSchema = import_mini66.z.object({
|
|
19086
19362
|
feature: rulesyncFeatureSchema,
|
|
19087
19363
|
operation: rulesyncOperationSchema,
|
|
19088
|
-
targetPathFromCwd:
|
|
19089
|
-
frontmatter:
|
|
19090
|
-
body:
|
|
19091
|
-
otherFiles:
|
|
19092
|
-
content:
|
|
19093
|
-
generateOptions:
|
|
19094
|
-
importOptions:
|
|
19364
|
+
targetPathFromCwd: import_mini66.z.optional(import_mini66.z.string()),
|
|
19365
|
+
frontmatter: import_mini66.z.optional(import_mini66.z.unknown()),
|
|
19366
|
+
body: import_mini66.z.optional(import_mini66.z.string()),
|
|
19367
|
+
otherFiles: import_mini66.z.optional(import_mini66.z.array(skillFileSchema)),
|
|
19368
|
+
content: import_mini66.z.optional(import_mini66.z.string()),
|
|
19369
|
+
generateOptions: import_mini66.z.optional(generateOptionsSchema),
|
|
19370
|
+
importOptions: import_mini66.z.optional(importOptionsSchema)
|
|
19095
19371
|
});
|
|
19096
19372
|
var supportedOperationsByFeature = {
|
|
19097
19373
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -19650,7 +19926,7 @@ async function updateCommand(currentVersion, options) {
|
|
|
19650
19926
|
}
|
|
19651
19927
|
|
|
19652
19928
|
// src/cli/index.ts
|
|
19653
|
-
var getVersion = () => "7.
|
|
19929
|
+
var getVersion = () => "7.10.0";
|
|
19654
19930
|
var main = async () => {
|
|
19655
19931
|
const program = new import_commander.Command();
|
|
19656
19932
|
const version = getVersion();
|
|
@@ -19755,7 +20031,10 @@ var main = async () => {
|
|
|
19755
20031
|
}
|
|
19756
20032
|
).option("--delete", "Delete all existing files in output directories before generating").option(
|
|
19757
20033
|
"-b, --base-dir <paths>",
|
|
19758
|
-
"Base directories to generate files (comma-separated for multiple paths)"
|
|
20034
|
+
"Base directories to generate files (comma-separated for multiple paths)",
|
|
20035
|
+
(value) => {
|
|
20036
|
+
return value.split(",").map((p) => p.trim());
|
|
20037
|
+
}
|
|
19759
20038
|
).option("-V, --verbose", "Verbose output").option("-s, --silent", "Suppress all output").option("-c, --config <path>", "Path to configuration file").option("-g, --global", "Generate for global(user scope) configuration files").option(
|
|
19760
20039
|
"--simulate-commands",
|
|
19761
20040
|
"Generate simulated commands. This feature is only available for copilot, cursor and codexcli."
|
|
@@ -19773,7 +20052,7 @@ var main = async () => {
|
|
|
19773
20052
|
verbose: options.verbose,
|
|
19774
20053
|
silent: options.silent,
|
|
19775
20054
|
delete: options.delete,
|
|
19776
|
-
baseDirs: options.
|
|
20055
|
+
baseDirs: options.baseDir,
|
|
19777
20056
|
configPath: options.config,
|
|
19778
20057
|
global: options.global,
|
|
19779
20058
|
simulateCommands: options.simulateCommands,
|