rulesync 7.9.0 → 7.11.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-HA3HGPC7.js → chunk-T5MWTRJM.js} +852 -594
- package/dist/cli/index.cjs +1144 -882
- package/dist/cli/index.js +8 -4
- package/dist/index.cjs +877 -619
- 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_path114 = 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_mini16 = require("zod/mini");
|
|
2730
2730
|
|
|
2731
2731
|
// src/types/hooks.ts
|
|
2732
2732
|
var import_mini13 = require("zod/mini");
|
|
@@ -2745,7 +2745,9 @@ var HookDefinitionSchema = import_mini13.z.looseObject({
|
|
|
2745
2745
|
timeout: import_mini13.z.optional(import_mini13.z.number()),
|
|
2746
2746
|
matcher: import_mini13.z.optional(safeString),
|
|
2747
2747
|
prompt: import_mini13.z.optional(import_mini13.z.string()),
|
|
2748
|
-
loop_limit: import_mini13.z.optional(import_mini13.z.nullable(import_mini13.z.number()))
|
|
2748
|
+
loop_limit: import_mini13.z.optional(import_mini13.z.nullable(import_mini13.z.number())),
|
|
2749
|
+
name: import_mini13.z.optional(safeString),
|
|
2750
|
+
description: import_mini13.z.optional(safeString)
|
|
2749
2751
|
});
|
|
2750
2752
|
var CURSOR_HOOK_EVENTS = [
|
|
2751
2753
|
"sessionStart",
|
|
@@ -2812,6 +2814,19 @@ var FACTORYDROID_HOOK_EVENTS = [
|
|
|
2812
2814
|
"notification",
|
|
2813
2815
|
"setup"
|
|
2814
2816
|
];
|
|
2817
|
+
var GEMINICLI_HOOK_EVENTS = [
|
|
2818
|
+
"sessionStart",
|
|
2819
|
+
"sessionEnd",
|
|
2820
|
+
"beforeSubmitPrompt",
|
|
2821
|
+
"stop",
|
|
2822
|
+
"beforeAgentResponse",
|
|
2823
|
+
"afterAgentResponse",
|
|
2824
|
+
"beforeToolSelection",
|
|
2825
|
+
"preToolUse",
|
|
2826
|
+
"postToolUse",
|
|
2827
|
+
"preCompact",
|
|
2828
|
+
"notification"
|
|
2829
|
+
];
|
|
2815
2830
|
var hooksRecordSchema = import_mini13.z.record(import_mini13.z.string(), import_mini13.z.array(HookDefinitionSchema));
|
|
2816
2831
|
var HooksConfigSchema = import_mini13.z.looseObject({
|
|
2817
2832
|
version: import_mini13.z.optional(import_mini13.z.number()),
|
|
@@ -2820,7 +2835,8 @@ var HooksConfigSchema = import_mini13.z.looseObject({
|
|
|
2820
2835
|
claudecode: import_mini13.z.optional(import_mini13.z.looseObject({ hooks: import_mini13.z.optional(hooksRecordSchema) })),
|
|
2821
2836
|
copilot: import_mini13.z.optional(import_mini13.z.looseObject({ hooks: import_mini13.z.optional(hooksRecordSchema) })),
|
|
2822
2837
|
opencode: import_mini13.z.optional(import_mini13.z.looseObject({ hooks: import_mini13.z.optional(hooksRecordSchema) })),
|
|
2823
|
-
factorydroid: import_mini13.z.optional(import_mini13.z.looseObject({ hooks: import_mini13.z.optional(hooksRecordSchema) }))
|
|
2838
|
+
factorydroid: import_mini13.z.optional(import_mini13.z.looseObject({ hooks: import_mini13.z.optional(hooksRecordSchema) })),
|
|
2839
|
+
geminicli: import_mini13.z.optional(import_mini13.z.looseObject({ hooks: import_mini13.z.optional(hooksRecordSchema) }))
|
|
2824
2840
|
});
|
|
2825
2841
|
var CANONICAL_TO_CLAUDE_EVENT_NAMES = {
|
|
2826
2842
|
sessionStart: "SessionStart",
|
|
@@ -2899,6 +2915,22 @@ var CANONICAL_TO_COPILOT_EVENT_NAMES = {
|
|
|
2899
2915
|
var COPILOT_TO_CANONICAL_EVENT_NAMES = Object.fromEntries(
|
|
2900
2916
|
Object.entries(CANONICAL_TO_COPILOT_EVENT_NAMES).map(([k, v]) => [v, k])
|
|
2901
2917
|
);
|
|
2918
|
+
var CANONICAL_TO_GEMINICLI_EVENT_NAMES = {
|
|
2919
|
+
sessionStart: "SessionStart",
|
|
2920
|
+
sessionEnd: "SessionEnd",
|
|
2921
|
+
beforeSubmitPrompt: "BeforeAgent",
|
|
2922
|
+
stop: "AfterAgent",
|
|
2923
|
+
beforeAgentResponse: "BeforeModel",
|
|
2924
|
+
afterAgentResponse: "AfterModel",
|
|
2925
|
+
beforeToolSelection: "BeforeToolSelection",
|
|
2926
|
+
preToolUse: "BeforeTool",
|
|
2927
|
+
postToolUse: "AfterTool",
|
|
2928
|
+
preCompact: "PreCompress",
|
|
2929
|
+
notification: "Notification"
|
|
2930
|
+
};
|
|
2931
|
+
var GEMINICLI_TO_CANONICAL_EVENT_NAMES = Object.fromEntries(
|
|
2932
|
+
Object.entries(CANONICAL_TO_GEMINICLI_EVENT_NAMES).map(([k, v]) => [v, k])
|
|
2933
|
+
);
|
|
2902
2934
|
|
|
2903
2935
|
// src/features/hooks/claudecode-hooks.ts
|
|
2904
2936
|
var import_node_path21 = require("path");
|
|
@@ -3185,6 +3217,7 @@ var CopilotHookEntrySchema = import_mini14.z.looseObject({
|
|
|
3185
3217
|
timeoutSec: import_mini14.z.optional(import_mini14.z.number())
|
|
3186
3218
|
});
|
|
3187
3219
|
function canonicalToCopilotHooks(config) {
|
|
3220
|
+
const canonicalSchemaKeys = Object.keys(HookDefinitionSchema.shape);
|
|
3188
3221
|
const isWindows = process.platform === "win32";
|
|
3189
3222
|
const commandField = isWindows ? "powershell" : "bash";
|
|
3190
3223
|
const supported = new Set(COPILOT_HOOK_EVENTS);
|
|
@@ -3209,9 +3242,7 @@ function canonicalToCopilotHooks(config) {
|
|
|
3209
3242
|
const command = def.command;
|
|
3210
3243
|
const timeout = def.timeout;
|
|
3211
3244
|
const rest = Object.fromEntries(
|
|
3212
|
-
Object.entries(def).filter(
|
|
3213
|
-
([k]) => !["type", "matcher", "command", "prompt", "timeout"].includes(k)
|
|
3214
|
-
)
|
|
3245
|
+
Object.entries(def).filter(([k]) => !canonicalSchemaKeys.includes(k))
|
|
3215
3246
|
);
|
|
3216
3247
|
entries.push({
|
|
3217
3248
|
type: hookType,
|
|
@@ -3404,7 +3435,14 @@ var CursorHooks = class _CursorHooks extends ToolHooks {
|
|
|
3404
3435
|
const mappedHooks = {};
|
|
3405
3436
|
for (const [eventName, defs] of Object.entries(mergedHooks)) {
|
|
3406
3437
|
const cursorEventName = CANONICAL_TO_CURSOR_EVENT_NAMES[eventName] ?? eventName;
|
|
3407
|
-
mappedHooks[cursorEventName] = defs
|
|
3438
|
+
mappedHooks[cursorEventName] = defs.map((def) => ({
|
|
3439
|
+
...def.type !== void 0 && def.type !== null && { type: def.type },
|
|
3440
|
+
...def.command !== void 0 && def.command !== null && { command: def.command },
|
|
3441
|
+
...def.timeout !== void 0 && def.timeout !== null && { timeout: def.timeout },
|
|
3442
|
+
...def.loop_limit !== void 0 && { loop_limit: def.loop_limit },
|
|
3443
|
+
...def.matcher !== void 0 && def.matcher !== null && { matcher: def.matcher },
|
|
3444
|
+
...def.prompt !== void 0 && def.prompt !== null && { prompt: def.prompt }
|
|
3445
|
+
}));
|
|
3408
3446
|
}
|
|
3409
3447
|
const cursorConfig = {
|
|
3410
3448
|
version: config.version ?? 1,
|
|
@@ -3637,8 +3675,193 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
3637
3675
|
}
|
|
3638
3676
|
};
|
|
3639
3677
|
|
|
3640
|
-
// src/features/hooks/
|
|
3678
|
+
// src/features/hooks/geminicli-hooks.ts
|
|
3641
3679
|
var import_node_path25 = require("path");
|
|
3680
|
+
var import_mini15 = require("zod/mini");
|
|
3681
|
+
function canonicalToGeminicliHooks(config) {
|
|
3682
|
+
const geminiSupported = new Set(GEMINICLI_HOOK_EVENTS);
|
|
3683
|
+
const sharedHooks = {};
|
|
3684
|
+
for (const [event, defs] of Object.entries(config.hooks)) {
|
|
3685
|
+
if (geminiSupported.has(event)) {
|
|
3686
|
+
sharedHooks[event] = defs;
|
|
3687
|
+
}
|
|
3688
|
+
}
|
|
3689
|
+
const effectiveHooks = {
|
|
3690
|
+
...sharedHooks,
|
|
3691
|
+
...config.geminicli?.hooks
|
|
3692
|
+
};
|
|
3693
|
+
const gemini = {};
|
|
3694
|
+
for (const [eventName, definitions] of Object.entries(effectiveHooks)) {
|
|
3695
|
+
const geminiEventName = CANONICAL_TO_GEMINICLI_EVENT_NAMES[eventName] ?? eventName;
|
|
3696
|
+
const byMatcher = /* @__PURE__ */ new Map();
|
|
3697
|
+
for (const def of definitions) {
|
|
3698
|
+
const key = def.matcher ?? "";
|
|
3699
|
+
const list = byMatcher.get(key);
|
|
3700
|
+
if (list) list.push(def);
|
|
3701
|
+
else byMatcher.set(key, [def]);
|
|
3702
|
+
}
|
|
3703
|
+
const entries = [];
|
|
3704
|
+
for (const [matcherKey, defs] of byMatcher) {
|
|
3705
|
+
const hooks = defs.map((def) => {
|
|
3706
|
+
const command = def.command !== void 0 && def.command !== null && !def.command.startsWith("$") ? `$GEMINI_PROJECT_DIR/${def.command.replace(/^\.\//, "")}` : def.command;
|
|
3707
|
+
return {
|
|
3708
|
+
type: def.type ?? "command",
|
|
3709
|
+
...command !== void 0 && command !== null && { command },
|
|
3710
|
+
...def.timeout !== void 0 && def.timeout !== null && { timeout: def.timeout },
|
|
3711
|
+
...def.name !== void 0 && def.name !== null && { name: def.name },
|
|
3712
|
+
...def.description !== void 0 && def.description !== null && { description: def.description }
|
|
3713
|
+
};
|
|
3714
|
+
});
|
|
3715
|
+
entries.push(matcherKey ? { matcher: matcherKey, hooks } : { hooks });
|
|
3716
|
+
}
|
|
3717
|
+
gemini[geminiEventName] = entries;
|
|
3718
|
+
}
|
|
3719
|
+
return gemini;
|
|
3720
|
+
}
|
|
3721
|
+
var GeminiHookEntrySchema = import_mini15.z.looseObject({
|
|
3722
|
+
type: import_mini15.z.optional(import_mini15.z.string()),
|
|
3723
|
+
command: import_mini15.z.optional(import_mini15.z.string()),
|
|
3724
|
+
timeout: import_mini15.z.optional(import_mini15.z.number()),
|
|
3725
|
+
name: import_mini15.z.optional(import_mini15.z.string()),
|
|
3726
|
+
description: import_mini15.z.optional(import_mini15.z.string())
|
|
3727
|
+
});
|
|
3728
|
+
var GeminiMatcherEntrySchema = import_mini15.z.looseObject({
|
|
3729
|
+
matcher: import_mini15.z.optional(import_mini15.z.string()),
|
|
3730
|
+
hooks: import_mini15.z.optional(import_mini15.z.array(GeminiHookEntrySchema))
|
|
3731
|
+
});
|
|
3732
|
+
function geminiHooksToCanonical(geminiHooks) {
|
|
3733
|
+
if (geminiHooks === null || geminiHooks === void 0 || typeof geminiHooks !== "object") {
|
|
3734
|
+
return {};
|
|
3735
|
+
}
|
|
3736
|
+
const canonical = {};
|
|
3737
|
+
for (const [geminiEventName, matcherEntries] of Object.entries(geminiHooks)) {
|
|
3738
|
+
const eventName = GEMINICLI_TO_CANONICAL_EVENT_NAMES[geminiEventName] ?? geminiEventName;
|
|
3739
|
+
if (!Array.isArray(matcherEntries)) continue;
|
|
3740
|
+
const defs = [];
|
|
3741
|
+
for (const rawEntry of matcherEntries) {
|
|
3742
|
+
const parseResult = GeminiMatcherEntrySchema.safeParse(rawEntry);
|
|
3743
|
+
if (!parseResult.success) continue;
|
|
3744
|
+
const entry = parseResult.data;
|
|
3745
|
+
const hooks = entry.hooks ?? [];
|
|
3746
|
+
for (const h of hooks) {
|
|
3747
|
+
const cmd = h.command;
|
|
3748
|
+
const command = typeof cmd === "string" && cmd.startsWith("$GEMINI_PROJECT_DIR/") ? cmd.replace(/^\$GEMINI_PROJECT_DIR\/?/, "./") : cmd;
|
|
3749
|
+
const hookType = h.type === "command" || h.type === "prompt" ? h.type : "command";
|
|
3750
|
+
defs.push({
|
|
3751
|
+
type: hookType,
|
|
3752
|
+
...command !== void 0 && command !== null && { command },
|
|
3753
|
+
...h.timeout !== void 0 && h.timeout !== null && { timeout: h.timeout },
|
|
3754
|
+
...h.name !== void 0 && h.name !== null && { name: h.name },
|
|
3755
|
+
...h.description !== void 0 && h.description !== null && { description: h.description },
|
|
3756
|
+
...entry.matcher !== void 0 && entry.matcher !== null && entry.matcher !== "" && { matcher: entry.matcher }
|
|
3757
|
+
});
|
|
3758
|
+
}
|
|
3759
|
+
}
|
|
3760
|
+
if (defs.length > 0) {
|
|
3761
|
+
canonical[eventName] = defs;
|
|
3762
|
+
}
|
|
3763
|
+
}
|
|
3764
|
+
return canonical;
|
|
3765
|
+
}
|
|
3766
|
+
var GeminicliHooks = class _GeminicliHooks extends ToolHooks {
|
|
3767
|
+
constructor(params) {
|
|
3768
|
+
super({
|
|
3769
|
+
...params,
|
|
3770
|
+
fileContent: params.fileContent ?? "{}"
|
|
3771
|
+
});
|
|
3772
|
+
}
|
|
3773
|
+
isDeletable() {
|
|
3774
|
+
return false;
|
|
3775
|
+
}
|
|
3776
|
+
static getSettablePaths(_options = {}) {
|
|
3777
|
+
return { relativeDirPath: ".gemini", relativeFilePath: "settings.json" };
|
|
3778
|
+
}
|
|
3779
|
+
static async fromFile({
|
|
3780
|
+
baseDir = process.cwd(),
|
|
3781
|
+
validate = true,
|
|
3782
|
+
global = false
|
|
3783
|
+
}) {
|
|
3784
|
+
const paths = _GeminicliHooks.getSettablePaths({ global });
|
|
3785
|
+
const filePath = (0, import_node_path25.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3786
|
+
const fileContent = await readFileContentOrNull(filePath) ?? '{"hooks":{}}';
|
|
3787
|
+
return new _GeminicliHooks({
|
|
3788
|
+
baseDir,
|
|
3789
|
+
relativeDirPath: paths.relativeDirPath,
|
|
3790
|
+
relativeFilePath: paths.relativeFilePath,
|
|
3791
|
+
fileContent,
|
|
3792
|
+
validate
|
|
3793
|
+
});
|
|
3794
|
+
}
|
|
3795
|
+
static async fromRulesyncHooks({
|
|
3796
|
+
baseDir = process.cwd(),
|
|
3797
|
+
rulesyncHooks,
|
|
3798
|
+
validate = true,
|
|
3799
|
+
global = false
|
|
3800
|
+
}) {
|
|
3801
|
+
const paths = _GeminicliHooks.getSettablePaths({ global });
|
|
3802
|
+
const filePath = (0, import_node_path25.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3803
|
+
const existingContent = await readOrInitializeFileContent(
|
|
3804
|
+
filePath,
|
|
3805
|
+
JSON.stringify({}, null, 2)
|
|
3806
|
+
);
|
|
3807
|
+
let settings;
|
|
3808
|
+
try {
|
|
3809
|
+
settings = JSON.parse(existingContent);
|
|
3810
|
+
} catch (error) {
|
|
3811
|
+
throw new Error(
|
|
3812
|
+
`Failed to parse existing Gemini CLI settings at ${filePath}: ${formatError(error)}`,
|
|
3813
|
+
{ cause: error }
|
|
3814
|
+
);
|
|
3815
|
+
}
|
|
3816
|
+
const config = rulesyncHooks.getJson();
|
|
3817
|
+
const geminiHooks = canonicalToGeminicliHooks(config);
|
|
3818
|
+
const merged = { ...settings, hooks: geminiHooks };
|
|
3819
|
+
const fileContent = JSON.stringify(merged, null, 2);
|
|
3820
|
+
return new _GeminicliHooks({
|
|
3821
|
+
baseDir,
|
|
3822
|
+
relativeDirPath: paths.relativeDirPath,
|
|
3823
|
+
relativeFilePath: paths.relativeFilePath,
|
|
3824
|
+
fileContent,
|
|
3825
|
+
validate
|
|
3826
|
+
});
|
|
3827
|
+
}
|
|
3828
|
+
toRulesyncHooks() {
|
|
3829
|
+
let settings;
|
|
3830
|
+
try {
|
|
3831
|
+
settings = JSON.parse(this.getFileContent());
|
|
3832
|
+
} catch (error) {
|
|
3833
|
+
throw new Error(
|
|
3834
|
+
`Failed to parse Gemini CLI hooks content in ${(0, import_node_path25.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
3835
|
+
{
|
|
3836
|
+
cause: error
|
|
3837
|
+
}
|
|
3838
|
+
);
|
|
3839
|
+
}
|
|
3840
|
+
const hooks = geminiHooksToCanonical(settings.hooks);
|
|
3841
|
+
return this.toRulesyncHooksDefault({
|
|
3842
|
+
fileContent: JSON.stringify({ version: 1, hooks }, null, 2)
|
|
3843
|
+
});
|
|
3844
|
+
}
|
|
3845
|
+
validate() {
|
|
3846
|
+
return { success: true, error: null };
|
|
3847
|
+
}
|
|
3848
|
+
static forDeletion({
|
|
3849
|
+
baseDir = process.cwd(),
|
|
3850
|
+
relativeDirPath,
|
|
3851
|
+
relativeFilePath
|
|
3852
|
+
}) {
|
|
3853
|
+
return new _GeminicliHooks({
|
|
3854
|
+
baseDir,
|
|
3855
|
+
relativeDirPath,
|
|
3856
|
+
relativeFilePath,
|
|
3857
|
+
fileContent: JSON.stringify({ hooks: {} }, null, 2),
|
|
3858
|
+
validate: false
|
|
3859
|
+
});
|
|
3860
|
+
}
|
|
3861
|
+
};
|
|
3862
|
+
|
|
3863
|
+
// src/features/hooks/opencode-hooks.ts
|
|
3864
|
+
var import_node_path26 = require("path");
|
|
3642
3865
|
var NAMED_HOOKS = /* @__PURE__ */ new Set(["tool.execute.before", "tool.execute.after"]);
|
|
3643
3866
|
function escapeForTemplateLiteral(command) {
|
|
3644
3867
|
return command.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${");
|
|
@@ -3736,7 +3959,7 @@ var OpencodeHooks = class _OpencodeHooks extends ToolHooks {
|
|
|
3736
3959
|
}
|
|
3737
3960
|
static getSettablePaths(options) {
|
|
3738
3961
|
return {
|
|
3739
|
-
relativeDirPath: options?.global ? (0,
|
|
3962
|
+
relativeDirPath: options?.global ? (0, import_node_path26.join)(".config", "opencode", "plugins") : (0, import_node_path26.join)(".opencode", "plugins"),
|
|
3740
3963
|
relativeFilePath: "rulesync-hooks.js"
|
|
3741
3964
|
};
|
|
3742
3965
|
}
|
|
@@ -3747,7 +3970,7 @@ var OpencodeHooks = class _OpencodeHooks extends ToolHooks {
|
|
|
3747
3970
|
}) {
|
|
3748
3971
|
const paths = _OpencodeHooks.getSettablePaths({ global });
|
|
3749
3972
|
const fileContent = await readFileContent(
|
|
3750
|
-
(0,
|
|
3973
|
+
(0, import_node_path26.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3751
3974
|
);
|
|
3752
3975
|
return new _OpencodeHooks({
|
|
3753
3976
|
baseDir,
|
|
@@ -3801,9 +4024,10 @@ var hooksProcessorToolTargetTuple = [
|
|
|
3801
4024
|
"claudecode",
|
|
3802
4025
|
"copilot",
|
|
3803
4026
|
"opencode",
|
|
3804
|
-
"factorydroid"
|
|
4027
|
+
"factorydroid",
|
|
4028
|
+
"geminicli"
|
|
3805
4029
|
];
|
|
3806
|
-
var HooksProcessorToolTargetSchema =
|
|
4030
|
+
var HooksProcessorToolTargetSchema = import_mini16.z.enum(hooksProcessorToolTargetTuple);
|
|
3807
4031
|
var toolHooksFactories = /* @__PURE__ */ new Map([
|
|
3808
4032
|
[
|
|
3809
4033
|
"cursor",
|
|
@@ -3874,6 +4098,16 @@ var toolHooksFactories = /* @__PURE__ */ new Map([
|
|
|
3874
4098
|
supportedHookTypes: ["command", "prompt"],
|
|
3875
4099
|
supportsMatcher: true
|
|
3876
4100
|
}
|
|
4101
|
+
],
|
|
4102
|
+
[
|
|
4103
|
+
"geminicli",
|
|
4104
|
+
{
|
|
4105
|
+
class: GeminicliHooks,
|
|
4106
|
+
meta: { supportsProject: true, supportsGlobal: true, supportsImport: true },
|
|
4107
|
+
supportedEvents: GEMINICLI_HOOK_EVENTS,
|
|
4108
|
+
supportedHookTypes: ["command"],
|
|
4109
|
+
supportsMatcher: true
|
|
4110
|
+
}
|
|
3877
4111
|
]
|
|
3878
4112
|
]);
|
|
3879
4113
|
var hooksProcessorToolTargets = [...toolHooksFactories.keys()];
|
|
@@ -4028,13 +4262,13 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4028
4262
|
};
|
|
4029
4263
|
|
|
4030
4264
|
// src/features/ignore/ignore-processor.ts
|
|
4031
|
-
var
|
|
4265
|
+
var import_mini17 = require("zod/mini");
|
|
4032
4266
|
|
|
4033
4267
|
// src/features/ignore/augmentcode-ignore.ts
|
|
4034
|
-
var
|
|
4268
|
+
var import_node_path28 = require("path");
|
|
4035
4269
|
|
|
4036
4270
|
// src/features/ignore/rulesync-ignore.ts
|
|
4037
|
-
var
|
|
4271
|
+
var import_node_path27 = require("path");
|
|
4038
4272
|
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
4039
4273
|
validate() {
|
|
4040
4274
|
return { success: true, error: null };
|
|
@@ -4054,12 +4288,12 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
4054
4288
|
static async fromFile() {
|
|
4055
4289
|
const baseDir = process.cwd();
|
|
4056
4290
|
const paths = this.getSettablePaths();
|
|
4057
|
-
const recommendedPath = (0,
|
|
4291
|
+
const recommendedPath = (0, import_node_path27.join)(
|
|
4058
4292
|
baseDir,
|
|
4059
4293
|
paths.recommended.relativeDirPath,
|
|
4060
4294
|
paths.recommended.relativeFilePath
|
|
4061
4295
|
);
|
|
4062
|
-
const legacyPath = (0,
|
|
4296
|
+
const legacyPath = (0, import_node_path27.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
4063
4297
|
if (await fileExists(recommendedPath)) {
|
|
4064
4298
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
4065
4299
|
return new _RulesyncIgnore({
|
|
@@ -4175,7 +4409,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
4175
4409
|
validate = true
|
|
4176
4410
|
}) {
|
|
4177
4411
|
const fileContent = await readFileContent(
|
|
4178
|
-
(0,
|
|
4412
|
+
(0, import_node_path28.join)(
|
|
4179
4413
|
baseDir,
|
|
4180
4414
|
this.getSettablePaths().relativeDirPath,
|
|
4181
4415
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4205,7 +4439,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
4205
4439
|
};
|
|
4206
4440
|
|
|
4207
4441
|
// src/features/ignore/claudecode-ignore.ts
|
|
4208
|
-
var
|
|
4442
|
+
var import_node_path29 = require("path");
|
|
4209
4443
|
var import_es_toolkit2 = require("es-toolkit");
|
|
4210
4444
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
4211
4445
|
constructor(params) {
|
|
@@ -4248,7 +4482,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
4248
4482
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
4249
4483
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
4250
4484
|
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
4251
|
-
const filePath = (0,
|
|
4485
|
+
const filePath = (0, import_node_path29.join)(
|
|
4252
4486
|
baseDir,
|
|
4253
4487
|
this.getSettablePaths().relativeDirPath,
|
|
4254
4488
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4284,7 +4518,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
4284
4518
|
validate = true
|
|
4285
4519
|
}) {
|
|
4286
4520
|
const fileContent = await readFileContent(
|
|
4287
|
-
(0,
|
|
4521
|
+
(0, import_node_path29.join)(
|
|
4288
4522
|
baseDir,
|
|
4289
4523
|
this.getSettablePaths().relativeDirPath,
|
|
4290
4524
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4314,7 +4548,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
4314
4548
|
};
|
|
4315
4549
|
|
|
4316
4550
|
// src/features/ignore/cline-ignore.ts
|
|
4317
|
-
var
|
|
4551
|
+
var import_node_path30 = require("path");
|
|
4318
4552
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
4319
4553
|
static getSettablePaths() {
|
|
4320
4554
|
return {
|
|
@@ -4351,7 +4585,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
4351
4585
|
validate = true
|
|
4352
4586
|
}) {
|
|
4353
4587
|
const fileContent = await readFileContent(
|
|
4354
|
-
(0,
|
|
4588
|
+
(0, import_node_path30.join)(
|
|
4355
4589
|
baseDir,
|
|
4356
4590
|
this.getSettablePaths().relativeDirPath,
|
|
4357
4591
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4381,7 +4615,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
4381
4615
|
};
|
|
4382
4616
|
|
|
4383
4617
|
// src/features/ignore/cursor-ignore.ts
|
|
4384
|
-
var
|
|
4618
|
+
var import_node_path31 = require("path");
|
|
4385
4619
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
4386
4620
|
static getSettablePaths() {
|
|
4387
4621
|
return {
|
|
@@ -4414,7 +4648,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
4414
4648
|
validate = true
|
|
4415
4649
|
}) {
|
|
4416
4650
|
const fileContent = await readFileContent(
|
|
4417
|
-
(0,
|
|
4651
|
+
(0, import_node_path31.join)(
|
|
4418
4652
|
baseDir,
|
|
4419
4653
|
this.getSettablePaths().relativeDirPath,
|
|
4420
4654
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4444,7 +4678,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
4444
4678
|
};
|
|
4445
4679
|
|
|
4446
4680
|
// src/features/ignore/geminicli-ignore.ts
|
|
4447
|
-
var
|
|
4681
|
+
var import_node_path32 = require("path");
|
|
4448
4682
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
4449
4683
|
static getSettablePaths() {
|
|
4450
4684
|
return {
|
|
@@ -4471,7 +4705,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
4471
4705
|
validate = true
|
|
4472
4706
|
}) {
|
|
4473
4707
|
const fileContent = await readFileContent(
|
|
4474
|
-
(0,
|
|
4708
|
+
(0, import_node_path32.join)(
|
|
4475
4709
|
baseDir,
|
|
4476
4710
|
this.getSettablePaths().relativeDirPath,
|
|
4477
4711
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4501,7 +4735,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
4501
4735
|
};
|
|
4502
4736
|
|
|
4503
4737
|
// src/features/ignore/goose-ignore.ts
|
|
4504
|
-
var
|
|
4738
|
+
var import_node_path33 = require("path");
|
|
4505
4739
|
var GooseIgnore = class _GooseIgnore extends ToolIgnore {
|
|
4506
4740
|
static getSettablePaths() {
|
|
4507
4741
|
return {
|
|
@@ -4538,7 +4772,7 @@ var GooseIgnore = class _GooseIgnore extends ToolIgnore {
|
|
|
4538
4772
|
validate = true
|
|
4539
4773
|
}) {
|
|
4540
4774
|
const fileContent = await readFileContent(
|
|
4541
|
-
(0,
|
|
4775
|
+
(0, import_node_path33.join)(
|
|
4542
4776
|
baseDir,
|
|
4543
4777
|
this.getSettablePaths().relativeDirPath,
|
|
4544
4778
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4568,7 +4802,7 @@ var GooseIgnore = class _GooseIgnore extends ToolIgnore {
|
|
|
4568
4802
|
};
|
|
4569
4803
|
|
|
4570
4804
|
// src/features/ignore/junie-ignore.ts
|
|
4571
|
-
var
|
|
4805
|
+
var import_node_path34 = require("path");
|
|
4572
4806
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
4573
4807
|
static getSettablePaths() {
|
|
4574
4808
|
return {
|
|
@@ -4595,7 +4829,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
4595
4829
|
validate = true
|
|
4596
4830
|
}) {
|
|
4597
4831
|
const fileContent = await readFileContent(
|
|
4598
|
-
(0,
|
|
4832
|
+
(0, import_node_path34.join)(
|
|
4599
4833
|
baseDir,
|
|
4600
4834
|
this.getSettablePaths().relativeDirPath,
|
|
4601
4835
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4625,7 +4859,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
4625
4859
|
};
|
|
4626
4860
|
|
|
4627
4861
|
// src/features/ignore/kilo-ignore.ts
|
|
4628
|
-
var
|
|
4862
|
+
var import_node_path35 = require("path");
|
|
4629
4863
|
var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
4630
4864
|
static getSettablePaths() {
|
|
4631
4865
|
return {
|
|
@@ -4662,7 +4896,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
4662
4896
|
validate = true
|
|
4663
4897
|
}) {
|
|
4664
4898
|
const fileContent = await readFileContent(
|
|
4665
|
-
(0,
|
|
4899
|
+
(0, import_node_path35.join)(
|
|
4666
4900
|
baseDir,
|
|
4667
4901
|
this.getSettablePaths().relativeDirPath,
|
|
4668
4902
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4692,7 +4926,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
4692
4926
|
};
|
|
4693
4927
|
|
|
4694
4928
|
// src/features/ignore/kiro-ignore.ts
|
|
4695
|
-
var
|
|
4929
|
+
var import_node_path36 = require("path");
|
|
4696
4930
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
4697
4931
|
static getSettablePaths() {
|
|
4698
4932
|
return {
|
|
@@ -4719,7 +4953,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
4719
4953
|
validate = true
|
|
4720
4954
|
}) {
|
|
4721
4955
|
const fileContent = await readFileContent(
|
|
4722
|
-
(0,
|
|
4956
|
+
(0, import_node_path36.join)(
|
|
4723
4957
|
baseDir,
|
|
4724
4958
|
this.getSettablePaths().relativeDirPath,
|
|
4725
4959
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4749,7 +4983,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
4749
4983
|
};
|
|
4750
4984
|
|
|
4751
4985
|
// src/features/ignore/qwencode-ignore.ts
|
|
4752
|
-
var
|
|
4986
|
+
var import_node_path37 = require("path");
|
|
4753
4987
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
4754
4988
|
static getSettablePaths() {
|
|
4755
4989
|
return {
|
|
@@ -4776,7 +5010,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
4776
5010
|
validate = true
|
|
4777
5011
|
}) {
|
|
4778
5012
|
const fileContent = await readFileContent(
|
|
4779
|
-
(0,
|
|
5013
|
+
(0, import_node_path37.join)(
|
|
4780
5014
|
baseDir,
|
|
4781
5015
|
this.getSettablePaths().relativeDirPath,
|
|
4782
5016
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4806,7 +5040,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
4806
5040
|
};
|
|
4807
5041
|
|
|
4808
5042
|
// src/features/ignore/roo-ignore.ts
|
|
4809
|
-
var
|
|
5043
|
+
var import_node_path38 = require("path");
|
|
4810
5044
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
4811
5045
|
static getSettablePaths() {
|
|
4812
5046
|
return {
|
|
@@ -4833,7 +5067,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
4833
5067
|
validate = true
|
|
4834
5068
|
}) {
|
|
4835
5069
|
const fileContent = await readFileContent(
|
|
4836
|
-
(0,
|
|
5070
|
+
(0, import_node_path38.join)(
|
|
4837
5071
|
baseDir,
|
|
4838
5072
|
this.getSettablePaths().relativeDirPath,
|
|
4839
5073
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4863,7 +5097,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
4863
5097
|
};
|
|
4864
5098
|
|
|
4865
5099
|
// src/features/ignore/windsurf-ignore.ts
|
|
4866
|
-
var
|
|
5100
|
+
var import_node_path39 = require("path");
|
|
4867
5101
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
4868
5102
|
static getSettablePaths() {
|
|
4869
5103
|
return {
|
|
@@ -4890,7 +5124,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
4890
5124
|
validate = true
|
|
4891
5125
|
}) {
|
|
4892
5126
|
const fileContent = await readFileContent(
|
|
4893
|
-
(0,
|
|
5127
|
+
(0, import_node_path39.join)(
|
|
4894
5128
|
baseDir,
|
|
4895
5129
|
this.getSettablePaths().relativeDirPath,
|
|
4896
5130
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4920,7 +5154,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
4920
5154
|
};
|
|
4921
5155
|
|
|
4922
5156
|
// src/features/ignore/zed-ignore.ts
|
|
4923
|
-
var
|
|
5157
|
+
var import_node_path40 = require("path");
|
|
4924
5158
|
var import_es_toolkit3 = require("es-toolkit");
|
|
4925
5159
|
var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
4926
5160
|
constructor(params) {
|
|
@@ -4957,7 +5191,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
4957
5191
|
}) {
|
|
4958
5192
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
4959
5193
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
4960
|
-
const filePath = (0,
|
|
5194
|
+
const filePath = (0, import_node_path40.join)(
|
|
4961
5195
|
baseDir,
|
|
4962
5196
|
this.getSettablePaths().relativeDirPath,
|
|
4963
5197
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4984,7 +5218,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
4984
5218
|
validate = true
|
|
4985
5219
|
}) {
|
|
4986
5220
|
const fileContent = await readFileContent(
|
|
4987
|
-
(0,
|
|
5221
|
+
(0, import_node_path40.join)(
|
|
4988
5222
|
baseDir,
|
|
4989
5223
|
this.getSettablePaths().relativeDirPath,
|
|
4990
5224
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5030,7 +5264,7 @@ var ignoreProcessorToolTargets = [
|
|
|
5030
5264
|
"windsurf",
|
|
5031
5265
|
"zed"
|
|
5032
5266
|
];
|
|
5033
|
-
var IgnoreProcessorToolTargetSchema =
|
|
5267
|
+
var IgnoreProcessorToolTargetSchema = import_mini17.z.enum(ignoreProcessorToolTargets);
|
|
5034
5268
|
var toolIgnoreFactories = /* @__PURE__ */ new Map([
|
|
5035
5269
|
["augmentcode", { class: AugmentcodeIgnore }],
|
|
5036
5270
|
["claudecode", { class: ClaudecodeIgnore }],
|
|
@@ -5168,49 +5402,49 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
5168
5402
|
};
|
|
5169
5403
|
|
|
5170
5404
|
// src/features/mcp/mcp-processor.ts
|
|
5171
|
-
var
|
|
5405
|
+
var import_mini21 = require("zod/mini");
|
|
5172
5406
|
|
|
5173
5407
|
// src/features/mcp/claudecode-mcp.ts
|
|
5174
|
-
var
|
|
5408
|
+
var import_node_path42 = require("path");
|
|
5175
5409
|
|
|
5176
5410
|
// src/features/mcp/rulesync-mcp.ts
|
|
5177
|
-
var
|
|
5411
|
+
var import_node_path41 = require("path");
|
|
5178
5412
|
var import_object = require("es-toolkit/object");
|
|
5179
|
-
var
|
|
5413
|
+
var import_mini19 = require("zod/mini");
|
|
5180
5414
|
|
|
5181
5415
|
// src/types/mcp.ts
|
|
5182
|
-
var
|
|
5183
|
-
var McpServerSchema =
|
|
5184
|
-
type:
|
|
5185
|
-
command:
|
|
5186
|
-
args:
|
|
5187
|
-
url:
|
|
5188
|
-
httpUrl:
|
|
5189
|
-
env:
|
|
5190
|
-
disabled:
|
|
5191
|
-
networkTimeout:
|
|
5192
|
-
timeout:
|
|
5193
|
-
trust:
|
|
5194
|
-
cwd:
|
|
5195
|
-
transport:
|
|
5196
|
-
alwaysAllow:
|
|
5197
|
-
tools:
|
|
5198
|
-
kiroAutoApprove:
|
|
5199
|
-
kiroAutoBlock:
|
|
5200
|
-
headers:
|
|
5201
|
-
enabledTools:
|
|
5202
|
-
disabledTools:
|
|
5416
|
+
var import_mini18 = require("zod/mini");
|
|
5417
|
+
var McpServerSchema = import_mini18.z.object({
|
|
5418
|
+
type: import_mini18.z.optional(import_mini18.z.enum(["stdio", "sse", "http"])),
|
|
5419
|
+
command: import_mini18.z.optional(import_mini18.z.union([import_mini18.z.string(), import_mini18.z.array(import_mini18.z.string())])),
|
|
5420
|
+
args: import_mini18.z.optional(import_mini18.z.array(import_mini18.z.string())),
|
|
5421
|
+
url: import_mini18.z.optional(import_mini18.z.string()),
|
|
5422
|
+
httpUrl: import_mini18.z.optional(import_mini18.z.string()),
|
|
5423
|
+
env: import_mini18.z.optional(import_mini18.z.record(import_mini18.z.string(), import_mini18.z.string())),
|
|
5424
|
+
disabled: import_mini18.z.optional(import_mini18.z.boolean()),
|
|
5425
|
+
networkTimeout: import_mini18.z.optional(import_mini18.z.number()),
|
|
5426
|
+
timeout: import_mini18.z.optional(import_mini18.z.number()),
|
|
5427
|
+
trust: import_mini18.z.optional(import_mini18.z.boolean()),
|
|
5428
|
+
cwd: import_mini18.z.optional(import_mini18.z.string()),
|
|
5429
|
+
transport: import_mini18.z.optional(import_mini18.z.enum(["stdio", "sse", "http"])),
|
|
5430
|
+
alwaysAllow: import_mini18.z.optional(import_mini18.z.array(import_mini18.z.string())),
|
|
5431
|
+
tools: import_mini18.z.optional(import_mini18.z.array(import_mini18.z.string())),
|
|
5432
|
+
kiroAutoApprove: import_mini18.z.optional(import_mini18.z.array(import_mini18.z.string())),
|
|
5433
|
+
kiroAutoBlock: import_mini18.z.optional(import_mini18.z.array(import_mini18.z.string())),
|
|
5434
|
+
headers: import_mini18.z.optional(import_mini18.z.record(import_mini18.z.string(), import_mini18.z.string())),
|
|
5435
|
+
enabledTools: import_mini18.z.optional(import_mini18.z.array(import_mini18.z.string())),
|
|
5436
|
+
disabledTools: import_mini18.z.optional(import_mini18.z.array(import_mini18.z.string()))
|
|
5203
5437
|
});
|
|
5204
|
-
var McpServersSchema =
|
|
5438
|
+
var McpServersSchema = import_mini18.z.record(import_mini18.z.string(), McpServerSchema);
|
|
5205
5439
|
|
|
5206
5440
|
// src/features/mcp/rulesync-mcp.ts
|
|
5207
|
-
var RulesyncMcpServerSchema =
|
|
5208
|
-
targets:
|
|
5209
|
-
description:
|
|
5210
|
-
exposed:
|
|
5441
|
+
var RulesyncMcpServerSchema = import_mini19.z.extend(McpServerSchema, {
|
|
5442
|
+
targets: import_mini19.z.optional(RulesyncTargetsSchema),
|
|
5443
|
+
description: import_mini19.z.optional(import_mini19.z.string()),
|
|
5444
|
+
exposed: import_mini19.z.optional(import_mini19.z.boolean())
|
|
5211
5445
|
});
|
|
5212
|
-
var RulesyncMcpConfigSchema =
|
|
5213
|
-
mcpServers:
|
|
5446
|
+
var RulesyncMcpConfigSchema = import_mini19.z.object({
|
|
5447
|
+
mcpServers: import_mini19.z.record(import_mini19.z.string(), RulesyncMcpServerSchema)
|
|
5214
5448
|
});
|
|
5215
5449
|
var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
5216
5450
|
json;
|
|
@@ -5246,12 +5480,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
5246
5480
|
static async fromFile({ validate = true }) {
|
|
5247
5481
|
const baseDir = process.cwd();
|
|
5248
5482
|
const paths = this.getSettablePaths();
|
|
5249
|
-
const recommendedPath = (0,
|
|
5483
|
+
const recommendedPath = (0, import_node_path41.join)(
|
|
5250
5484
|
baseDir,
|
|
5251
5485
|
paths.recommended.relativeDirPath,
|
|
5252
5486
|
paths.recommended.relativeFilePath
|
|
5253
5487
|
);
|
|
5254
|
-
const legacyPath = (0,
|
|
5488
|
+
const legacyPath = (0, import_node_path41.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
5255
5489
|
if (await fileExists(recommendedPath)) {
|
|
5256
5490
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
5257
5491
|
return new _RulesyncMcp({
|
|
@@ -5396,7 +5630,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
5396
5630
|
global = false
|
|
5397
5631
|
}) {
|
|
5398
5632
|
const paths = this.getSettablePaths({ global });
|
|
5399
|
-
const fileContent = await readFileContentOrNull((0,
|
|
5633
|
+
const fileContent = await readFileContentOrNull((0, import_node_path42.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
5400
5634
|
const json = JSON.parse(fileContent);
|
|
5401
5635
|
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
5402
5636
|
return new _ClaudecodeMcp({
|
|
@@ -5415,7 +5649,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
5415
5649
|
}) {
|
|
5416
5650
|
const paths = this.getSettablePaths({ global });
|
|
5417
5651
|
const fileContent = await readOrInitializeFileContent(
|
|
5418
|
-
(0,
|
|
5652
|
+
(0, import_node_path42.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
5419
5653
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
5420
5654
|
);
|
|
5421
5655
|
const json = JSON.parse(fileContent);
|
|
@@ -5454,7 +5688,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
5454
5688
|
};
|
|
5455
5689
|
|
|
5456
5690
|
// src/features/mcp/cline-mcp.ts
|
|
5457
|
-
var
|
|
5691
|
+
var import_node_path43 = require("path");
|
|
5458
5692
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
5459
5693
|
json;
|
|
5460
5694
|
constructor(params) {
|
|
@@ -5475,7 +5709,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
5475
5709
|
validate = true
|
|
5476
5710
|
}) {
|
|
5477
5711
|
const fileContent = await readFileContent(
|
|
5478
|
-
(0,
|
|
5712
|
+
(0, import_node_path43.join)(
|
|
5479
5713
|
baseDir,
|
|
5480
5714
|
this.getSettablePaths().relativeDirPath,
|
|
5481
5715
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5524,7 +5758,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
5524
5758
|
};
|
|
5525
5759
|
|
|
5526
5760
|
// src/features/mcp/codexcli-mcp.ts
|
|
5527
|
-
var
|
|
5761
|
+
var import_node_path44 = require("path");
|
|
5528
5762
|
var smolToml = __toESM(require("smol-toml"), 1);
|
|
5529
5763
|
function convertFromCodexFormat(codexMcp) {
|
|
5530
5764
|
const result = {};
|
|
@@ -5607,7 +5841,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
5607
5841
|
global = false
|
|
5608
5842
|
}) {
|
|
5609
5843
|
const paths = this.getSettablePaths({ global });
|
|
5610
|
-
const fileContent = await readFileContentOrNull((0,
|
|
5844
|
+
const fileContent = await readFileContentOrNull((0, import_node_path44.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? smolToml.stringify({});
|
|
5611
5845
|
return new _CodexcliMcp({
|
|
5612
5846
|
baseDir,
|
|
5613
5847
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -5623,7 +5857,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
5623
5857
|
global = false
|
|
5624
5858
|
}) {
|
|
5625
5859
|
const paths = this.getSettablePaths({ global });
|
|
5626
|
-
const configTomlFilePath = (0,
|
|
5860
|
+
const configTomlFilePath = (0, import_node_path44.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
5627
5861
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
5628
5862
|
configTomlFilePath,
|
|
5629
5863
|
smolToml.stringify({})
|
|
@@ -5680,7 +5914,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
5680
5914
|
};
|
|
5681
5915
|
|
|
5682
5916
|
// src/features/mcp/copilot-mcp.ts
|
|
5683
|
-
var
|
|
5917
|
+
var import_node_path45 = require("path");
|
|
5684
5918
|
function convertToCopilotFormat(mcpServers) {
|
|
5685
5919
|
return { servers: mcpServers };
|
|
5686
5920
|
}
|
|
@@ -5707,7 +5941,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
5707
5941
|
validate = true
|
|
5708
5942
|
}) {
|
|
5709
5943
|
const fileContent = await readFileContent(
|
|
5710
|
-
(0,
|
|
5944
|
+
(0, import_node_path45.join)(
|
|
5711
5945
|
baseDir,
|
|
5712
5946
|
this.getSettablePaths().relativeDirPath,
|
|
5713
5947
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5760,7 +5994,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
5760
5994
|
};
|
|
5761
5995
|
|
|
5762
5996
|
// src/features/mcp/cursor-mcp.ts
|
|
5763
|
-
var
|
|
5997
|
+
var import_node_path46 = require("path");
|
|
5764
5998
|
var CURSOR_ENV_VAR_PATTERN = /\$\{env:([^}]+)\}/g;
|
|
5765
5999
|
function isMcpServers(value) {
|
|
5766
6000
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
@@ -5821,7 +6055,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
5821
6055
|
validate = true
|
|
5822
6056
|
}) {
|
|
5823
6057
|
const fileContent = await readFileContent(
|
|
5824
|
-
(0,
|
|
6058
|
+
(0, import_node_path46.join)(
|
|
5825
6059
|
baseDir,
|
|
5826
6060
|
this.getSettablePaths().relativeDirPath,
|
|
5827
6061
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5889,7 +6123,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
5889
6123
|
};
|
|
5890
6124
|
|
|
5891
6125
|
// src/features/mcp/factorydroid-mcp.ts
|
|
5892
|
-
var
|
|
6126
|
+
var import_node_path47 = require("path");
|
|
5893
6127
|
var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
5894
6128
|
json;
|
|
5895
6129
|
constructor(params) {
|
|
@@ -5910,7 +6144,7 @@ var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
|
5910
6144
|
validate = true
|
|
5911
6145
|
}) {
|
|
5912
6146
|
const fileContent = await readFileContent(
|
|
5913
|
-
(0,
|
|
6147
|
+
(0, import_node_path47.join)(
|
|
5914
6148
|
baseDir,
|
|
5915
6149
|
this.getSettablePaths().relativeDirPath,
|
|
5916
6150
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5970,7 +6204,7 @@ var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
|
5970
6204
|
};
|
|
5971
6205
|
|
|
5972
6206
|
// src/features/mcp/geminicli-mcp.ts
|
|
5973
|
-
var
|
|
6207
|
+
var import_node_path48 = require("path");
|
|
5974
6208
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
5975
6209
|
json;
|
|
5976
6210
|
constructor(params) {
|
|
@@ -5998,7 +6232,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
5998
6232
|
global = false
|
|
5999
6233
|
}) {
|
|
6000
6234
|
const paths = this.getSettablePaths({ global });
|
|
6001
|
-
const fileContent = await readFileContentOrNull((0,
|
|
6235
|
+
const fileContent = await readFileContentOrNull((0, import_node_path48.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
6002
6236
|
const json = JSON.parse(fileContent);
|
|
6003
6237
|
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
6004
6238
|
return new _GeminiCliMcp({
|
|
@@ -6017,7 +6251,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6017
6251
|
}) {
|
|
6018
6252
|
const paths = this.getSettablePaths({ global });
|
|
6019
6253
|
const fileContent = await readOrInitializeFileContent(
|
|
6020
|
-
(0,
|
|
6254
|
+
(0, import_node_path48.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
6021
6255
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
6022
6256
|
);
|
|
6023
6257
|
const json = JSON.parse(fileContent);
|
|
@@ -6062,7 +6296,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6062
6296
|
};
|
|
6063
6297
|
|
|
6064
6298
|
// src/features/mcp/junie-mcp.ts
|
|
6065
|
-
var
|
|
6299
|
+
var import_node_path49 = require("path");
|
|
6066
6300
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
6067
6301
|
json;
|
|
6068
6302
|
constructor(params) {
|
|
@@ -6074,7 +6308,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6074
6308
|
}
|
|
6075
6309
|
static getSettablePaths() {
|
|
6076
6310
|
return {
|
|
6077
|
-
relativeDirPath: (0,
|
|
6311
|
+
relativeDirPath: (0, import_node_path49.join)(".junie", "mcp"),
|
|
6078
6312
|
relativeFilePath: "mcp.json"
|
|
6079
6313
|
};
|
|
6080
6314
|
}
|
|
@@ -6083,7 +6317,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6083
6317
|
validate = true
|
|
6084
6318
|
}) {
|
|
6085
6319
|
const fileContent = await readFileContent(
|
|
6086
|
-
(0,
|
|
6320
|
+
(0, import_node_path49.join)(
|
|
6087
6321
|
baseDir,
|
|
6088
6322
|
this.getSettablePaths().relativeDirPath,
|
|
6089
6323
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6132,7 +6366,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6132
6366
|
};
|
|
6133
6367
|
|
|
6134
6368
|
// src/features/mcp/kilo-mcp.ts
|
|
6135
|
-
var
|
|
6369
|
+
var import_node_path50 = require("path");
|
|
6136
6370
|
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
6137
6371
|
json;
|
|
6138
6372
|
constructor(params) {
|
|
@@ -6153,7 +6387,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
6153
6387
|
validate = true
|
|
6154
6388
|
}) {
|
|
6155
6389
|
const paths = this.getSettablePaths();
|
|
6156
|
-
const fileContent = await readFileContentOrNull((0,
|
|
6390
|
+
const fileContent = await readFileContentOrNull((0, import_node_path50.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
6157
6391
|
return new _KiloMcp({
|
|
6158
6392
|
baseDir,
|
|
6159
6393
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -6201,7 +6435,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
6201
6435
|
};
|
|
6202
6436
|
|
|
6203
6437
|
// src/features/mcp/kiro-mcp.ts
|
|
6204
|
-
var
|
|
6438
|
+
var import_node_path51 = require("path");
|
|
6205
6439
|
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
6206
6440
|
json;
|
|
6207
6441
|
constructor(params) {
|
|
@@ -6213,7 +6447,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
6213
6447
|
}
|
|
6214
6448
|
static getSettablePaths() {
|
|
6215
6449
|
return {
|
|
6216
|
-
relativeDirPath: (0,
|
|
6450
|
+
relativeDirPath: (0, import_node_path51.join)(".kiro", "settings"),
|
|
6217
6451
|
relativeFilePath: "mcp.json"
|
|
6218
6452
|
};
|
|
6219
6453
|
}
|
|
@@ -6222,7 +6456,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
6222
6456
|
validate = true
|
|
6223
6457
|
}) {
|
|
6224
6458
|
const paths = this.getSettablePaths();
|
|
6225
|
-
const fileContent = await readFileContentOrNull((0,
|
|
6459
|
+
const fileContent = await readFileContentOrNull((0, import_node_path51.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
6226
6460
|
return new _KiroMcp({
|
|
6227
6461
|
baseDir,
|
|
6228
6462
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -6270,29 +6504,30 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
6270
6504
|
};
|
|
6271
6505
|
|
|
6272
6506
|
// src/features/mcp/opencode-mcp.ts
|
|
6273
|
-
var
|
|
6274
|
-
var
|
|
6275
|
-
var
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6507
|
+
var import_node_path52 = require("path");
|
|
6508
|
+
var import_jsonc_parser = require("jsonc-parser");
|
|
6509
|
+
var import_mini20 = require("zod/mini");
|
|
6510
|
+
var OpencodeMcpLocalServerSchema = import_mini20.z.object({
|
|
6511
|
+
type: import_mini20.z.literal("local"),
|
|
6512
|
+
command: import_mini20.z.array(import_mini20.z.string()),
|
|
6513
|
+
environment: import_mini20.z.optional(import_mini20.z.record(import_mini20.z.string(), import_mini20.z.string())),
|
|
6514
|
+
enabled: import_mini20.z._default(import_mini20.z.boolean(), true),
|
|
6515
|
+
cwd: import_mini20.z.optional(import_mini20.z.string())
|
|
6281
6516
|
});
|
|
6282
|
-
var OpencodeMcpRemoteServerSchema =
|
|
6283
|
-
type:
|
|
6284
|
-
url:
|
|
6285
|
-
headers:
|
|
6286
|
-
enabled:
|
|
6517
|
+
var OpencodeMcpRemoteServerSchema = import_mini20.z.object({
|
|
6518
|
+
type: import_mini20.z.literal("remote"),
|
|
6519
|
+
url: import_mini20.z.string(),
|
|
6520
|
+
headers: import_mini20.z.optional(import_mini20.z.record(import_mini20.z.string(), import_mini20.z.string())),
|
|
6521
|
+
enabled: import_mini20.z._default(import_mini20.z.boolean(), true)
|
|
6287
6522
|
});
|
|
6288
|
-
var OpencodeMcpServerSchema =
|
|
6523
|
+
var OpencodeMcpServerSchema = import_mini20.z.union([
|
|
6289
6524
|
OpencodeMcpLocalServerSchema,
|
|
6290
6525
|
OpencodeMcpRemoteServerSchema
|
|
6291
6526
|
]);
|
|
6292
|
-
var OpencodeConfigSchema =
|
|
6293
|
-
$schema:
|
|
6294
|
-
mcp:
|
|
6295
|
-
tools:
|
|
6527
|
+
var OpencodeConfigSchema = import_mini20.z.looseObject({
|
|
6528
|
+
$schema: import_mini20.z.optional(import_mini20.z.string()),
|
|
6529
|
+
mcp: import_mini20.z.optional(import_mini20.z.record(import_mini20.z.string(), OpencodeMcpServerSchema)),
|
|
6530
|
+
tools: import_mini20.z.optional(import_mini20.z.record(import_mini20.z.string(), import_mini20.z.boolean()))
|
|
6296
6531
|
});
|
|
6297
6532
|
function convertFromOpencodeFormat(opencodeMcp, tools) {
|
|
6298
6533
|
return Object.fromEntries(
|
|
@@ -6396,7 +6631,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
6396
6631
|
json;
|
|
6397
6632
|
constructor(params) {
|
|
6398
6633
|
super(params);
|
|
6399
|
-
this.json = OpencodeConfigSchema.parse(
|
|
6634
|
+
this.json = OpencodeConfigSchema.parse((0, import_jsonc_parser.parse)(this.fileContent || "{}"));
|
|
6400
6635
|
}
|
|
6401
6636
|
getJson() {
|
|
6402
6637
|
return this.json;
|
|
@@ -6410,7 +6645,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
6410
6645
|
static getSettablePaths({ global } = {}) {
|
|
6411
6646
|
if (global) {
|
|
6412
6647
|
return {
|
|
6413
|
-
relativeDirPath: (0,
|
|
6648
|
+
relativeDirPath: (0, import_node_path52.join)(".config", "opencode"),
|
|
6414
6649
|
relativeFilePath: "opencode.json"
|
|
6415
6650
|
};
|
|
6416
6651
|
}
|
|
@@ -6424,14 +6659,26 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
6424
6659
|
validate = true,
|
|
6425
6660
|
global = false
|
|
6426
6661
|
}) {
|
|
6427
|
-
const
|
|
6428
|
-
const
|
|
6429
|
-
|
|
6662
|
+
const basePaths = this.getSettablePaths({ global });
|
|
6663
|
+
const jsonDir = (0, import_node_path52.join)(baseDir, basePaths.relativeDirPath);
|
|
6664
|
+
let fileContent = null;
|
|
6665
|
+
let relativeFilePath = "opencode.jsonc";
|
|
6666
|
+
const jsoncPath = (0, import_node_path52.join)(jsonDir, "opencode.jsonc");
|
|
6667
|
+
const jsonPath = (0, import_node_path52.join)(jsonDir, "opencode.json");
|
|
6668
|
+
fileContent = await readFileContentOrNull(jsoncPath);
|
|
6669
|
+
if (!fileContent) {
|
|
6670
|
+
fileContent = await readFileContentOrNull(jsonPath);
|
|
6671
|
+
if (fileContent) {
|
|
6672
|
+
relativeFilePath = "opencode.json";
|
|
6673
|
+
}
|
|
6674
|
+
}
|
|
6675
|
+
const fileContentToUse = fileContent ?? '{"mcp":{}}';
|
|
6676
|
+
const json = (0, import_jsonc_parser.parse)(fileContentToUse);
|
|
6430
6677
|
const newJson = { ...json, mcp: json.mcp ?? {} };
|
|
6431
6678
|
return new _OpencodeMcp({
|
|
6432
6679
|
baseDir,
|
|
6433
|
-
relativeDirPath:
|
|
6434
|
-
relativeFilePath
|
|
6680
|
+
relativeDirPath: basePaths.relativeDirPath,
|
|
6681
|
+
relativeFilePath,
|
|
6435
6682
|
fileContent: JSON.stringify(newJson, null, 2),
|
|
6436
6683
|
validate
|
|
6437
6684
|
});
|
|
@@ -6442,12 +6689,23 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
6442
6689
|
validate = true,
|
|
6443
6690
|
global = false
|
|
6444
6691
|
}) {
|
|
6445
|
-
const
|
|
6446
|
-
const
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
);
|
|
6450
|
-
const
|
|
6692
|
+
const basePaths = this.getSettablePaths({ global });
|
|
6693
|
+
const jsonDir = (0, import_node_path52.join)(baseDir, basePaths.relativeDirPath);
|
|
6694
|
+
let fileContent = null;
|
|
6695
|
+
let relativeFilePath = "opencode.jsonc";
|
|
6696
|
+
const jsoncPath = (0, import_node_path52.join)(jsonDir, "opencode.jsonc");
|
|
6697
|
+
const jsonPath = (0, import_node_path52.join)(jsonDir, "opencode.json");
|
|
6698
|
+
fileContent = await readFileContentOrNull(jsoncPath);
|
|
6699
|
+
if (!fileContent) {
|
|
6700
|
+
fileContent = await readFileContentOrNull(jsonPath);
|
|
6701
|
+
if (fileContent) {
|
|
6702
|
+
relativeFilePath = "opencode.json";
|
|
6703
|
+
}
|
|
6704
|
+
}
|
|
6705
|
+
if (!fileContent) {
|
|
6706
|
+
fileContent = JSON.stringify({ mcp: {} }, null, 2);
|
|
6707
|
+
}
|
|
6708
|
+
const json = (0, import_jsonc_parser.parse)(fileContent);
|
|
6451
6709
|
const { mcp: convertedMcp, tools: mcpTools2 } = convertToOpencodeFormat(
|
|
6452
6710
|
rulesyncMcp.getMcpServers()
|
|
6453
6711
|
);
|
|
@@ -6459,8 +6717,8 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
6459
6717
|
};
|
|
6460
6718
|
return new _OpencodeMcp({
|
|
6461
6719
|
baseDir,
|
|
6462
|
-
relativeDirPath:
|
|
6463
|
-
relativeFilePath
|
|
6720
|
+
relativeDirPath: basePaths.relativeDirPath,
|
|
6721
|
+
relativeFilePath,
|
|
6464
6722
|
fileContent: JSON.stringify(newJson, null, 2),
|
|
6465
6723
|
validate
|
|
6466
6724
|
});
|
|
@@ -6497,7 +6755,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
6497
6755
|
};
|
|
6498
6756
|
|
|
6499
6757
|
// src/features/mcp/roo-mcp.ts
|
|
6500
|
-
var
|
|
6758
|
+
var import_node_path53 = require("path");
|
|
6501
6759
|
function isRooMcpServers(value) {
|
|
6502
6760
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
6503
6761
|
}
|
|
@@ -6549,7 +6807,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
6549
6807
|
validate = true
|
|
6550
6808
|
}) {
|
|
6551
6809
|
const fileContent = await readFileContent(
|
|
6552
|
-
(0,
|
|
6810
|
+
(0, import_node_path53.join)(
|
|
6553
6811
|
baseDir,
|
|
6554
6812
|
this.getSettablePaths().relativeDirPath,
|
|
6555
6813
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6620,7 +6878,7 @@ var mcpProcessorToolTargetTuple = [
|
|
|
6620
6878
|
"opencode",
|
|
6621
6879
|
"roo"
|
|
6622
6880
|
];
|
|
6623
|
-
var McpProcessorToolTargetSchema =
|
|
6881
|
+
var McpProcessorToolTargetSchema = import_mini21.z.enum(mcpProcessorToolTargetTuple);
|
|
6624
6882
|
var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
6625
6883
|
[
|
|
6626
6884
|
"claudecode",
|
|
@@ -6922,25 +7180,25 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
6922
7180
|
};
|
|
6923
7181
|
|
|
6924
7182
|
// src/features/rules/rules-processor.ts
|
|
6925
|
-
var
|
|
7183
|
+
var import_node_path113 = require("path");
|
|
6926
7184
|
var import_toon = require("@toon-format/toon");
|
|
6927
|
-
var
|
|
7185
|
+
var import_mini53 = require("zod/mini");
|
|
6928
7186
|
|
|
6929
7187
|
// src/constants/general.ts
|
|
6930
7188
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
6931
7189
|
|
|
6932
7190
|
// src/features/skills/agentsmd-skill.ts
|
|
6933
|
-
var
|
|
7191
|
+
var import_node_path57 = require("path");
|
|
6934
7192
|
|
|
6935
7193
|
// src/features/skills/simulated-skill.ts
|
|
6936
|
-
var
|
|
6937
|
-
var
|
|
7194
|
+
var import_node_path56 = require("path");
|
|
7195
|
+
var import_mini22 = require("zod/mini");
|
|
6938
7196
|
|
|
6939
7197
|
// src/features/skills/tool-skill.ts
|
|
6940
|
-
var
|
|
7198
|
+
var import_node_path55 = require("path");
|
|
6941
7199
|
|
|
6942
7200
|
// src/types/ai-dir.ts
|
|
6943
|
-
var
|
|
7201
|
+
var import_node_path54 = __toESM(require("path"), 1);
|
|
6944
7202
|
var AiDir = class {
|
|
6945
7203
|
/**
|
|
6946
7204
|
* @example "."
|
|
@@ -6974,7 +7232,7 @@ var AiDir = class {
|
|
|
6974
7232
|
otherFiles = [],
|
|
6975
7233
|
global = false
|
|
6976
7234
|
}) {
|
|
6977
|
-
if (dirName.includes(
|
|
7235
|
+
if (dirName.includes(import_node_path54.default.sep) || dirName.includes("/") || dirName.includes("\\")) {
|
|
6978
7236
|
throw new Error(`Directory name cannot contain path separators: dirName="${dirName}"`);
|
|
6979
7237
|
}
|
|
6980
7238
|
this.baseDir = baseDir;
|
|
@@ -6997,11 +7255,11 @@ var AiDir = class {
|
|
|
6997
7255
|
return this.dirName;
|
|
6998
7256
|
}
|
|
6999
7257
|
getDirPath() {
|
|
7000
|
-
const fullPath =
|
|
7001
|
-
const resolvedFull = (0,
|
|
7002
|
-
const resolvedBase = (0,
|
|
7003
|
-
const rel = (0,
|
|
7004
|
-
if (rel.startsWith("..") ||
|
|
7258
|
+
const fullPath = import_node_path54.default.join(this.baseDir, this.relativeDirPath, this.dirName);
|
|
7259
|
+
const resolvedFull = (0, import_node_path54.resolve)(fullPath);
|
|
7260
|
+
const resolvedBase = (0, import_node_path54.resolve)(this.baseDir);
|
|
7261
|
+
const rel = (0, import_node_path54.relative)(resolvedBase, resolvedFull);
|
|
7262
|
+
if (rel.startsWith("..") || import_node_path54.default.isAbsolute(rel)) {
|
|
7005
7263
|
throw new Error(
|
|
7006
7264
|
`Path traversal detected: Final path escapes baseDir. baseDir="${this.baseDir}", relativeDirPath="${this.relativeDirPath}", dirName="${this.dirName}"`
|
|
7007
7265
|
);
|
|
@@ -7015,7 +7273,7 @@ var AiDir = class {
|
|
|
7015
7273
|
return this.otherFiles;
|
|
7016
7274
|
}
|
|
7017
7275
|
getRelativePathFromCwd() {
|
|
7018
|
-
return
|
|
7276
|
+
return import_node_path54.default.join(this.relativeDirPath, this.dirName);
|
|
7019
7277
|
}
|
|
7020
7278
|
getGlobal() {
|
|
7021
7279
|
return this.global;
|
|
@@ -7034,15 +7292,15 @@ var AiDir = class {
|
|
|
7034
7292
|
* @returns Array of files with their relative paths and buffers
|
|
7035
7293
|
*/
|
|
7036
7294
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
7037
|
-
const dirPath = (0,
|
|
7038
|
-
const glob = (0,
|
|
7295
|
+
const dirPath = (0, import_node_path54.join)(baseDir, relativeDirPath, dirName);
|
|
7296
|
+
const glob = (0, import_node_path54.join)(dirPath, "**", "*");
|
|
7039
7297
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
7040
|
-
const filteredPaths = filePaths.filter((filePath) => (0,
|
|
7298
|
+
const filteredPaths = filePaths.filter((filePath) => (0, import_node_path54.basename)(filePath) !== excludeFileName);
|
|
7041
7299
|
const files = await Promise.all(
|
|
7042
7300
|
filteredPaths.map(async (filePath) => {
|
|
7043
7301
|
const fileBuffer = await readFileBuffer(filePath);
|
|
7044
7302
|
return {
|
|
7045
|
-
relativeFilePathToDirPath: (0,
|
|
7303
|
+
relativeFilePathToDirPath: (0, import_node_path54.relative)(dirPath, filePath),
|
|
7046
7304
|
fileBuffer
|
|
7047
7305
|
};
|
|
7048
7306
|
})
|
|
@@ -7133,8 +7391,8 @@ var ToolSkill = class extends AiDir {
|
|
|
7133
7391
|
}) {
|
|
7134
7392
|
const settablePaths = getSettablePaths({ global });
|
|
7135
7393
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
7136
|
-
const skillDirPath = (0,
|
|
7137
|
-
const skillFilePath = (0,
|
|
7394
|
+
const skillDirPath = (0, import_node_path55.join)(baseDir, actualRelativeDirPath, dirName);
|
|
7395
|
+
const skillFilePath = (0, import_node_path55.join)(skillDirPath, SKILL_FILE_NAME);
|
|
7138
7396
|
if (!await fileExists(skillFilePath)) {
|
|
7139
7397
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
7140
7398
|
}
|
|
@@ -7158,16 +7416,16 @@ var ToolSkill = class extends AiDir {
|
|
|
7158
7416
|
}
|
|
7159
7417
|
requireMainFileFrontmatter() {
|
|
7160
7418
|
if (!this.mainFile?.frontmatter) {
|
|
7161
|
-
throw new Error(`Frontmatter is not defined in ${(0,
|
|
7419
|
+
throw new Error(`Frontmatter is not defined in ${(0, import_node_path55.join)(this.relativeDirPath, this.dirName)}`);
|
|
7162
7420
|
}
|
|
7163
7421
|
return this.mainFile.frontmatter;
|
|
7164
7422
|
}
|
|
7165
7423
|
};
|
|
7166
7424
|
|
|
7167
7425
|
// src/features/skills/simulated-skill.ts
|
|
7168
|
-
var SimulatedSkillFrontmatterSchema =
|
|
7169
|
-
name:
|
|
7170
|
-
description:
|
|
7426
|
+
var SimulatedSkillFrontmatterSchema = import_mini22.z.looseObject({
|
|
7427
|
+
name: import_mini22.z.string(),
|
|
7428
|
+
description: import_mini22.z.string()
|
|
7171
7429
|
});
|
|
7172
7430
|
var SimulatedSkill = class extends ToolSkill {
|
|
7173
7431
|
frontmatter;
|
|
@@ -7198,7 +7456,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
7198
7456
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
7199
7457
|
if (!result.success) {
|
|
7200
7458
|
throw new Error(
|
|
7201
|
-
`Invalid frontmatter in ${(0,
|
|
7459
|
+
`Invalid frontmatter in ${(0, import_node_path56.join)(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
7202
7460
|
);
|
|
7203
7461
|
}
|
|
7204
7462
|
}
|
|
@@ -7256,8 +7514,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
7256
7514
|
}) {
|
|
7257
7515
|
const settablePaths = this.getSettablePaths();
|
|
7258
7516
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
7259
|
-
const skillDirPath = (0,
|
|
7260
|
-
const skillFilePath = (0,
|
|
7517
|
+
const skillDirPath = (0, import_node_path56.join)(baseDir, actualRelativeDirPath, dirName);
|
|
7518
|
+
const skillFilePath = (0, import_node_path56.join)(skillDirPath, SKILL_FILE_NAME);
|
|
7261
7519
|
if (!await fileExists(skillFilePath)) {
|
|
7262
7520
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
7263
7521
|
}
|
|
@@ -7334,7 +7592,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
7334
7592
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
7335
7593
|
}
|
|
7336
7594
|
return {
|
|
7337
|
-
relativeDirPath: (0,
|
|
7595
|
+
relativeDirPath: (0, import_node_path57.join)(".agents", "skills")
|
|
7338
7596
|
};
|
|
7339
7597
|
}
|
|
7340
7598
|
static async fromDir(params) {
|
|
@@ -7361,11 +7619,11 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
7361
7619
|
};
|
|
7362
7620
|
|
|
7363
7621
|
// src/features/skills/factorydroid-skill.ts
|
|
7364
|
-
var
|
|
7622
|
+
var import_node_path58 = require("path");
|
|
7365
7623
|
var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
7366
7624
|
static getSettablePaths(_options) {
|
|
7367
7625
|
return {
|
|
7368
|
-
relativeDirPath: (0,
|
|
7626
|
+
relativeDirPath: (0, import_node_path58.join)(".factory", "skills")
|
|
7369
7627
|
};
|
|
7370
7628
|
}
|
|
7371
7629
|
static async fromDir(params) {
|
|
@@ -7392,11 +7650,11 @@ var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
|
7392
7650
|
};
|
|
7393
7651
|
|
|
7394
7652
|
// src/features/skills/skills-processor.ts
|
|
7395
|
-
var
|
|
7396
|
-
var
|
|
7653
|
+
var import_node_path75 = require("path");
|
|
7654
|
+
var import_mini37 = require("zod/mini");
|
|
7397
7655
|
|
|
7398
7656
|
// src/types/dir-feature-processor.ts
|
|
7399
|
-
var
|
|
7657
|
+
var import_node_path59 = require("path");
|
|
7400
7658
|
var DirFeatureProcessor = class {
|
|
7401
7659
|
baseDir;
|
|
7402
7660
|
dryRun;
|
|
@@ -7427,7 +7685,7 @@ var DirFeatureProcessor = class {
|
|
|
7427
7685
|
const mainFile = aiDir.getMainFile();
|
|
7428
7686
|
let mainFileContent;
|
|
7429
7687
|
if (mainFile) {
|
|
7430
|
-
const mainFilePath = (0,
|
|
7688
|
+
const mainFilePath = (0, import_node_path59.join)(dirPath, mainFile.name);
|
|
7431
7689
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
7432
7690
|
mainFileContent = addTrailingNewline(content);
|
|
7433
7691
|
const existingContent = await readFileContentOrNull(mainFilePath);
|
|
@@ -7441,7 +7699,7 @@ var DirFeatureProcessor = class {
|
|
|
7441
7699
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
7442
7700
|
otherFileContents.push(contentWithNewline);
|
|
7443
7701
|
if (!dirHasChanges) {
|
|
7444
|
-
const filePath = (0,
|
|
7702
|
+
const filePath = (0, import_node_path59.join)(dirPath, file.relativeFilePathToDirPath);
|
|
7445
7703
|
const existingContent = await readFileContentOrNull(filePath);
|
|
7446
7704
|
if (existingContent !== contentWithNewline) {
|
|
7447
7705
|
dirHasChanges = true;
|
|
@@ -7455,22 +7713,22 @@ var DirFeatureProcessor = class {
|
|
|
7455
7713
|
if (this.dryRun) {
|
|
7456
7714
|
logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
|
|
7457
7715
|
if (mainFile) {
|
|
7458
|
-
logger.info(`[DRY RUN] Would write: ${(0,
|
|
7459
|
-
changedPaths.push((0,
|
|
7716
|
+
logger.info(`[DRY RUN] Would write: ${(0, import_node_path59.join)(dirPath, mainFile.name)}`);
|
|
7717
|
+
changedPaths.push((0, import_node_path59.join)(relativeDir, mainFile.name));
|
|
7460
7718
|
}
|
|
7461
7719
|
for (const file of otherFiles) {
|
|
7462
|
-
logger.info(`[DRY RUN] Would write: ${(0,
|
|
7463
|
-
changedPaths.push((0,
|
|
7720
|
+
logger.info(`[DRY RUN] Would write: ${(0, import_node_path59.join)(dirPath, file.relativeFilePathToDirPath)}`);
|
|
7721
|
+
changedPaths.push((0, import_node_path59.join)(relativeDir, file.relativeFilePathToDirPath));
|
|
7464
7722
|
}
|
|
7465
7723
|
} else {
|
|
7466
7724
|
await ensureDir(dirPath);
|
|
7467
7725
|
if (mainFile && mainFileContent) {
|
|
7468
|
-
const mainFilePath = (0,
|
|
7726
|
+
const mainFilePath = (0, import_node_path59.join)(dirPath, mainFile.name);
|
|
7469
7727
|
await writeFileContent(mainFilePath, mainFileContent);
|
|
7470
|
-
changedPaths.push((0,
|
|
7728
|
+
changedPaths.push((0, import_node_path59.join)(relativeDir, mainFile.name));
|
|
7471
7729
|
}
|
|
7472
7730
|
for (const [i, file] of otherFiles.entries()) {
|
|
7473
|
-
const filePath = (0,
|
|
7731
|
+
const filePath = (0, import_node_path59.join)(dirPath, file.relativeFilePathToDirPath);
|
|
7474
7732
|
const content = otherFileContents[i];
|
|
7475
7733
|
if (content === void 0) {
|
|
7476
7734
|
throw new Error(
|
|
@@ -7478,7 +7736,7 @@ var DirFeatureProcessor = class {
|
|
|
7478
7736
|
);
|
|
7479
7737
|
}
|
|
7480
7738
|
await writeFileContent(filePath, content);
|
|
7481
|
-
changedPaths.push((0,
|
|
7739
|
+
changedPaths.push((0, import_node_path59.join)(relativeDir, file.relativeFilePathToDirPath));
|
|
7482
7740
|
}
|
|
7483
7741
|
}
|
|
7484
7742
|
changedCount++;
|
|
@@ -7510,38 +7768,38 @@ var DirFeatureProcessor = class {
|
|
|
7510
7768
|
};
|
|
7511
7769
|
|
|
7512
7770
|
// src/features/skills/agentsskills-skill.ts
|
|
7513
|
-
var
|
|
7514
|
-
var
|
|
7771
|
+
var import_node_path61 = require("path");
|
|
7772
|
+
var import_mini24 = require("zod/mini");
|
|
7515
7773
|
|
|
7516
7774
|
// src/features/skills/rulesync-skill.ts
|
|
7517
|
-
var
|
|
7518
|
-
var
|
|
7519
|
-
var RulesyncSkillFrontmatterSchemaInternal =
|
|
7520
|
-
name:
|
|
7521
|
-
description:
|
|
7522
|
-
targets:
|
|
7523
|
-
claudecode:
|
|
7524
|
-
|
|
7525
|
-
"allowed-tools":
|
|
7775
|
+
var import_node_path60 = require("path");
|
|
7776
|
+
var import_mini23 = require("zod/mini");
|
|
7777
|
+
var RulesyncSkillFrontmatterSchemaInternal = import_mini23.z.looseObject({
|
|
7778
|
+
name: import_mini23.z.string(),
|
|
7779
|
+
description: import_mini23.z.string(),
|
|
7780
|
+
targets: import_mini23.z._default(RulesyncTargetsSchema, ["*"]),
|
|
7781
|
+
claudecode: import_mini23.z.optional(
|
|
7782
|
+
import_mini23.z.looseObject({
|
|
7783
|
+
"allowed-tools": import_mini23.z.optional(import_mini23.z.array(import_mini23.z.string()))
|
|
7526
7784
|
})
|
|
7527
7785
|
),
|
|
7528
|
-
codexcli:
|
|
7529
|
-
|
|
7530
|
-
"short-description":
|
|
7786
|
+
codexcli: import_mini23.z.optional(
|
|
7787
|
+
import_mini23.z.looseObject({
|
|
7788
|
+
"short-description": import_mini23.z.optional(import_mini23.z.string())
|
|
7531
7789
|
})
|
|
7532
7790
|
),
|
|
7533
|
-
opencode:
|
|
7534
|
-
|
|
7535
|
-
"allowed-tools":
|
|
7791
|
+
opencode: import_mini23.z.optional(
|
|
7792
|
+
import_mini23.z.looseObject({
|
|
7793
|
+
"allowed-tools": import_mini23.z.optional(import_mini23.z.array(import_mini23.z.string()))
|
|
7536
7794
|
})
|
|
7537
7795
|
),
|
|
7538
|
-
copilot:
|
|
7539
|
-
|
|
7540
|
-
license:
|
|
7796
|
+
copilot: import_mini23.z.optional(
|
|
7797
|
+
import_mini23.z.looseObject({
|
|
7798
|
+
license: import_mini23.z.optional(import_mini23.z.string())
|
|
7541
7799
|
})
|
|
7542
7800
|
),
|
|
7543
|
-
cline:
|
|
7544
|
-
roo:
|
|
7801
|
+
cline: import_mini23.z.optional(import_mini23.z.looseObject({})),
|
|
7802
|
+
roo: import_mini23.z.optional(import_mini23.z.looseObject({}))
|
|
7545
7803
|
});
|
|
7546
7804
|
var RulesyncSkillFrontmatterSchema = RulesyncSkillFrontmatterSchemaInternal;
|
|
7547
7805
|
var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
@@ -7581,7 +7839,7 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
7581
7839
|
}
|
|
7582
7840
|
getFrontmatter() {
|
|
7583
7841
|
if (!this.mainFile?.frontmatter) {
|
|
7584
|
-
throw new Error(`Frontmatter is not defined in ${(0,
|
|
7842
|
+
throw new Error(`Frontmatter is not defined in ${(0, import_node_path60.join)(this.relativeDirPath, this.dirName)}`);
|
|
7585
7843
|
}
|
|
7586
7844
|
const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
7587
7845
|
return result;
|
|
@@ -7607,8 +7865,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
7607
7865
|
dirName,
|
|
7608
7866
|
global = false
|
|
7609
7867
|
}) {
|
|
7610
|
-
const skillDirPath = (0,
|
|
7611
|
-
const skillFilePath = (0,
|
|
7868
|
+
const skillDirPath = (0, import_node_path60.join)(baseDir, relativeDirPath, dirName);
|
|
7869
|
+
const skillFilePath = (0, import_node_path60.join)(skillDirPath, SKILL_FILE_NAME);
|
|
7612
7870
|
if (!await fileExists(skillFilePath)) {
|
|
7613
7871
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
7614
7872
|
}
|
|
@@ -7638,14 +7896,14 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
7638
7896
|
};
|
|
7639
7897
|
|
|
7640
7898
|
// src/features/skills/agentsskills-skill.ts
|
|
7641
|
-
var AgentsSkillsSkillFrontmatterSchema =
|
|
7642
|
-
name:
|
|
7643
|
-
description:
|
|
7899
|
+
var AgentsSkillsSkillFrontmatterSchema = import_mini24.z.looseObject({
|
|
7900
|
+
name: import_mini24.z.string(),
|
|
7901
|
+
description: import_mini24.z.string()
|
|
7644
7902
|
});
|
|
7645
7903
|
var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
7646
7904
|
constructor({
|
|
7647
7905
|
baseDir = process.cwd(),
|
|
7648
|
-
relativeDirPath = (0,
|
|
7906
|
+
relativeDirPath = (0, import_node_path61.join)(".agents", "skills"),
|
|
7649
7907
|
dirName,
|
|
7650
7908
|
frontmatter,
|
|
7651
7909
|
body,
|
|
@@ -7677,7 +7935,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
7677
7935
|
throw new Error("AgentsSkillsSkill does not support global mode.");
|
|
7678
7936
|
}
|
|
7679
7937
|
return {
|
|
7680
|
-
relativeDirPath: (0,
|
|
7938
|
+
relativeDirPath: (0, import_node_path61.join)(".agents", "skills")
|
|
7681
7939
|
};
|
|
7682
7940
|
}
|
|
7683
7941
|
getFrontmatter() {
|
|
@@ -7756,9 +8014,9 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
7756
8014
|
});
|
|
7757
8015
|
const result = AgentsSkillsSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7758
8016
|
if (!result.success) {
|
|
7759
|
-
const skillDirPath = (0,
|
|
8017
|
+
const skillDirPath = (0, import_node_path61.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7760
8018
|
throw new Error(
|
|
7761
|
-
`Invalid frontmatter in ${(0,
|
|
8019
|
+
`Invalid frontmatter in ${(0, import_node_path61.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7762
8020
|
);
|
|
7763
8021
|
}
|
|
7764
8022
|
return new _AgentsSkillsSkill({
|
|
@@ -7793,16 +8051,16 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
7793
8051
|
};
|
|
7794
8052
|
|
|
7795
8053
|
// src/features/skills/antigravity-skill.ts
|
|
7796
|
-
var
|
|
7797
|
-
var
|
|
7798
|
-
var AntigravitySkillFrontmatterSchema =
|
|
7799
|
-
name:
|
|
7800
|
-
description:
|
|
8054
|
+
var import_node_path62 = require("path");
|
|
8055
|
+
var import_mini25 = require("zod/mini");
|
|
8056
|
+
var AntigravitySkillFrontmatterSchema = import_mini25.z.looseObject({
|
|
8057
|
+
name: import_mini25.z.string(),
|
|
8058
|
+
description: import_mini25.z.string()
|
|
7801
8059
|
});
|
|
7802
8060
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
7803
8061
|
constructor({
|
|
7804
8062
|
baseDir = process.cwd(),
|
|
7805
|
-
relativeDirPath = (0,
|
|
8063
|
+
relativeDirPath = (0, import_node_path62.join)(".agent", "skills"),
|
|
7806
8064
|
dirName,
|
|
7807
8065
|
frontmatter,
|
|
7808
8066
|
body,
|
|
@@ -7834,11 +8092,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
7834
8092
|
} = {}) {
|
|
7835
8093
|
if (global) {
|
|
7836
8094
|
return {
|
|
7837
|
-
relativeDirPath: (0,
|
|
8095
|
+
relativeDirPath: (0, import_node_path62.join)(".gemini", "antigravity", "skills")
|
|
7838
8096
|
};
|
|
7839
8097
|
}
|
|
7840
8098
|
return {
|
|
7841
|
-
relativeDirPath: (0,
|
|
8099
|
+
relativeDirPath: (0, import_node_path62.join)(".agent", "skills")
|
|
7842
8100
|
};
|
|
7843
8101
|
}
|
|
7844
8102
|
getFrontmatter() {
|
|
@@ -7917,9 +8175,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
7917
8175
|
});
|
|
7918
8176
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7919
8177
|
if (!result.success) {
|
|
7920
|
-
const skillDirPath = (0,
|
|
8178
|
+
const skillDirPath = (0, import_node_path62.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7921
8179
|
throw new Error(
|
|
7922
|
-
`Invalid frontmatter in ${(0,
|
|
8180
|
+
`Invalid frontmatter in ${(0, import_node_path62.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7923
8181
|
);
|
|
7924
8182
|
}
|
|
7925
8183
|
return new _AntigravitySkill({
|
|
@@ -7953,17 +8211,17 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
7953
8211
|
};
|
|
7954
8212
|
|
|
7955
8213
|
// src/features/skills/claudecode-skill.ts
|
|
7956
|
-
var
|
|
7957
|
-
var
|
|
7958
|
-
var ClaudecodeSkillFrontmatterSchema =
|
|
7959
|
-
name:
|
|
7960
|
-
description:
|
|
7961
|
-
"allowed-tools":
|
|
8214
|
+
var import_node_path63 = require("path");
|
|
8215
|
+
var import_mini26 = require("zod/mini");
|
|
8216
|
+
var ClaudecodeSkillFrontmatterSchema = import_mini26.z.looseObject({
|
|
8217
|
+
name: import_mini26.z.string(),
|
|
8218
|
+
description: import_mini26.z.string(),
|
|
8219
|
+
"allowed-tools": import_mini26.z.optional(import_mini26.z.array(import_mini26.z.string()))
|
|
7962
8220
|
});
|
|
7963
8221
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
7964
8222
|
constructor({
|
|
7965
8223
|
baseDir = process.cwd(),
|
|
7966
|
-
relativeDirPath = (0,
|
|
8224
|
+
relativeDirPath = (0, import_node_path63.join)(".claude", "skills"),
|
|
7967
8225
|
dirName,
|
|
7968
8226
|
frontmatter,
|
|
7969
8227
|
body,
|
|
@@ -7994,7 +8252,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
7994
8252
|
global: _global = false
|
|
7995
8253
|
} = {}) {
|
|
7996
8254
|
return {
|
|
7997
|
-
relativeDirPath: (0,
|
|
8255
|
+
relativeDirPath: (0, import_node_path63.join)(".claude", "skills")
|
|
7998
8256
|
};
|
|
7999
8257
|
}
|
|
8000
8258
|
getFrontmatter() {
|
|
@@ -8079,9 +8337,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8079
8337
|
});
|
|
8080
8338
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8081
8339
|
if (!result.success) {
|
|
8082
|
-
const skillDirPath = (0,
|
|
8340
|
+
const skillDirPath = (0, import_node_path63.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8083
8341
|
throw new Error(
|
|
8084
|
-
`Invalid frontmatter in ${(0,
|
|
8342
|
+
`Invalid frontmatter in ${(0, import_node_path63.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8085
8343
|
);
|
|
8086
8344
|
}
|
|
8087
8345
|
return new _ClaudecodeSkill({
|
|
@@ -8115,16 +8373,16 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8115
8373
|
};
|
|
8116
8374
|
|
|
8117
8375
|
// src/features/skills/cline-skill.ts
|
|
8118
|
-
var
|
|
8119
|
-
var
|
|
8120
|
-
var ClineSkillFrontmatterSchema =
|
|
8121
|
-
name:
|
|
8122
|
-
description:
|
|
8376
|
+
var import_node_path64 = require("path");
|
|
8377
|
+
var import_mini27 = require("zod/mini");
|
|
8378
|
+
var ClineSkillFrontmatterSchema = import_mini27.z.looseObject({
|
|
8379
|
+
name: import_mini27.z.string(),
|
|
8380
|
+
description: import_mini27.z.string()
|
|
8123
8381
|
});
|
|
8124
8382
|
var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
8125
8383
|
constructor({
|
|
8126
8384
|
baseDir = process.cwd(),
|
|
8127
|
-
relativeDirPath = (0,
|
|
8385
|
+
relativeDirPath = (0, import_node_path64.join)(".cline", "skills"),
|
|
8128
8386
|
dirName,
|
|
8129
8387
|
frontmatter,
|
|
8130
8388
|
body,
|
|
@@ -8153,7 +8411,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
8153
8411
|
}
|
|
8154
8412
|
static getSettablePaths(_options = {}) {
|
|
8155
8413
|
return {
|
|
8156
|
-
relativeDirPath: (0,
|
|
8414
|
+
relativeDirPath: (0, import_node_path64.join)(".cline", "skills")
|
|
8157
8415
|
};
|
|
8158
8416
|
}
|
|
8159
8417
|
getFrontmatter() {
|
|
@@ -8240,13 +8498,13 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
8240
8498
|
});
|
|
8241
8499
|
const result = ClineSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8242
8500
|
if (!result.success) {
|
|
8243
|
-
const skillDirPath = (0,
|
|
8501
|
+
const skillDirPath = (0, import_node_path64.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8244
8502
|
throw new Error(
|
|
8245
|
-
`Invalid frontmatter in ${(0,
|
|
8503
|
+
`Invalid frontmatter in ${(0, import_node_path64.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8246
8504
|
);
|
|
8247
8505
|
}
|
|
8248
8506
|
if (result.data.name !== loaded.dirName) {
|
|
8249
|
-
const skillFilePath = (0,
|
|
8507
|
+
const skillFilePath = (0, import_node_path64.join)(
|
|
8250
8508
|
loaded.baseDir,
|
|
8251
8509
|
loaded.relativeDirPath,
|
|
8252
8510
|
loaded.dirName,
|
|
@@ -8287,21 +8545,21 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
8287
8545
|
};
|
|
8288
8546
|
|
|
8289
8547
|
// src/features/skills/codexcli-skill.ts
|
|
8290
|
-
var
|
|
8291
|
-
var
|
|
8292
|
-
var CodexCliSkillFrontmatterSchema =
|
|
8293
|
-
name:
|
|
8294
|
-
description:
|
|
8295
|
-
metadata:
|
|
8296
|
-
|
|
8297
|
-
"short-description":
|
|
8548
|
+
var import_node_path65 = require("path");
|
|
8549
|
+
var import_mini28 = require("zod/mini");
|
|
8550
|
+
var CodexCliSkillFrontmatterSchema = import_mini28.z.looseObject({
|
|
8551
|
+
name: import_mini28.z.string(),
|
|
8552
|
+
description: import_mini28.z.string(),
|
|
8553
|
+
metadata: import_mini28.z.optional(
|
|
8554
|
+
import_mini28.z.looseObject({
|
|
8555
|
+
"short-description": import_mini28.z.optional(import_mini28.z.string())
|
|
8298
8556
|
})
|
|
8299
8557
|
)
|
|
8300
8558
|
});
|
|
8301
8559
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
8302
8560
|
constructor({
|
|
8303
8561
|
baseDir = process.cwd(),
|
|
8304
|
-
relativeDirPath = (0,
|
|
8562
|
+
relativeDirPath = (0, import_node_path65.join)(".codex", "skills"),
|
|
8305
8563
|
dirName,
|
|
8306
8564
|
frontmatter,
|
|
8307
8565
|
body,
|
|
@@ -8332,7 +8590,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
8332
8590
|
global: _global = false
|
|
8333
8591
|
} = {}) {
|
|
8334
8592
|
return {
|
|
8335
|
-
relativeDirPath: (0,
|
|
8593
|
+
relativeDirPath: (0, import_node_path65.join)(".codex", "skills")
|
|
8336
8594
|
};
|
|
8337
8595
|
}
|
|
8338
8596
|
getFrontmatter() {
|
|
@@ -8421,9 +8679,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
8421
8679
|
});
|
|
8422
8680
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8423
8681
|
if (!result.success) {
|
|
8424
|
-
const skillDirPath = (0,
|
|
8682
|
+
const skillDirPath = (0, import_node_path65.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8425
8683
|
throw new Error(
|
|
8426
|
-
`Invalid frontmatter in ${(0,
|
|
8684
|
+
`Invalid frontmatter in ${(0, import_node_path65.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8427
8685
|
);
|
|
8428
8686
|
}
|
|
8429
8687
|
return new _CodexCliSkill({
|
|
@@ -8457,17 +8715,17 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
8457
8715
|
};
|
|
8458
8716
|
|
|
8459
8717
|
// src/features/skills/copilot-skill.ts
|
|
8460
|
-
var
|
|
8461
|
-
var
|
|
8462
|
-
var CopilotSkillFrontmatterSchema =
|
|
8463
|
-
name:
|
|
8464
|
-
description:
|
|
8465
|
-
license:
|
|
8718
|
+
var import_node_path66 = require("path");
|
|
8719
|
+
var import_mini29 = require("zod/mini");
|
|
8720
|
+
var CopilotSkillFrontmatterSchema = import_mini29.z.looseObject({
|
|
8721
|
+
name: import_mini29.z.string(),
|
|
8722
|
+
description: import_mini29.z.string(),
|
|
8723
|
+
license: import_mini29.z.optional(import_mini29.z.string())
|
|
8466
8724
|
});
|
|
8467
8725
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
8468
8726
|
constructor({
|
|
8469
8727
|
baseDir = process.cwd(),
|
|
8470
|
-
relativeDirPath = (0,
|
|
8728
|
+
relativeDirPath = (0, import_node_path66.join)(".github", "skills"),
|
|
8471
8729
|
dirName,
|
|
8472
8730
|
frontmatter,
|
|
8473
8731
|
body,
|
|
@@ -8499,7 +8757,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
8499
8757
|
throw new Error("CopilotSkill does not support global mode.");
|
|
8500
8758
|
}
|
|
8501
8759
|
return {
|
|
8502
|
-
relativeDirPath: (0,
|
|
8760
|
+
relativeDirPath: (0, import_node_path66.join)(".github", "skills")
|
|
8503
8761
|
};
|
|
8504
8762
|
}
|
|
8505
8763
|
getFrontmatter() {
|
|
@@ -8584,9 +8842,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
8584
8842
|
});
|
|
8585
8843
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8586
8844
|
if (!result.success) {
|
|
8587
|
-
const skillDirPath = (0,
|
|
8845
|
+
const skillDirPath = (0, import_node_path66.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8588
8846
|
throw new Error(
|
|
8589
|
-
`Invalid frontmatter in ${(0,
|
|
8847
|
+
`Invalid frontmatter in ${(0, import_node_path66.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8590
8848
|
);
|
|
8591
8849
|
}
|
|
8592
8850
|
return new _CopilotSkill({
|
|
@@ -8621,16 +8879,16 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
8621
8879
|
};
|
|
8622
8880
|
|
|
8623
8881
|
// src/features/skills/cursor-skill.ts
|
|
8624
|
-
var
|
|
8625
|
-
var
|
|
8626
|
-
var CursorSkillFrontmatterSchema =
|
|
8627
|
-
name:
|
|
8628
|
-
description:
|
|
8882
|
+
var import_node_path67 = require("path");
|
|
8883
|
+
var import_mini30 = require("zod/mini");
|
|
8884
|
+
var CursorSkillFrontmatterSchema = import_mini30.z.looseObject({
|
|
8885
|
+
name: import_mini30.z.string(),
|
|
8886
|
+
description: import_mini30.z.string()
|
|
8629
8887
|
});
|
|
8630
8888
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
8631
8889
|
constructor({
|
|
8632
8890
|
baseDir = process.cwd(),
|
|
8633
|
-
relativeDirPath = (0,
|
|
8891
|
+
relativeDirPath = (0, import_node_path67.join)(".cursor", "skills"),
|
|
8634
8892
|
dirName,
|
|
8635
8893
|
frontmatter,
|
|
8636
8894
|
body,
|
|
@@ -8659,7 +8917,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
8659
8917
|
}
|
|
8660
8918
|
static getSettablePaths(_options) {
|
|
8661
8919
|
return {
|
|
8662
|
-
relativeDirPath: (0,
|
|
8920
|
+
relativeDirPath: (0, import_node_path67.join)(".cursor", "skills")
|
|
8663
8921
|
};
|
|
8664
8922
|
}
|
|
8665
8923
|
getFrontmatter() {
|
|
@@ -8738,9 +8996,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
8738
8996
|
});
|
|
8739
8997
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8740
8998
|
if (!result.success) {
|
|
8741
|
-
const skillDirPath = (0,
|
|
8999
|
+
const skillDirPath = (0, import_node_path67.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8742
9000
|
throw new Error(
|
|
8743
|
-
`Invalid frontmatter in ${(0,
|
|
9001
|
+
`Invalid frontmatter in ${(0, import_node_path67.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8744
9002
|
);
|
|
8745
9003
|
}
|
|
8746
9004
|
return new _CursorSkill({
|
|
@@ -8775,11 +9033,11 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
8775
9033
|
};
|
|
8776
9034
|
|
|
8777
9035
|
// src/features/skills/geminicli-skill.ts
|
|
8778
|
-
var
|
|
8779
|
-
var
|
|
8780
|
-
var GeminiCliSkillFrontmatterSchema =
|
|
8781
|
-
name:
|
|
8782
|
-
description:
|
|
9036
|
+
var import_node_path68 = require("path");
|
|
9037
|
+
var import_mini31 = require("zod/mini");
|
|
9038
|
+
var GeminiCliSkillFrontmatterSchema = import_mini31.z.looseObject({
|
|
9039
|
+
name: import_mini31.z.string(),
|
|
9040
|
+
description: import_mini31.z.string()
|
|
8783
9041
|
});
|
|
8784
9042
|
var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
8785
9043
|
constructor({
|
|
@@ -8815,7 +9073,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
8815
9073
|
global: _global = false
|
|
8816
9074
|
} = {}) {
|
|
8817
9075
|
return {
|
|
8818
|
-
relativeDirPath: (0,
|
|
9076
|
+
relativeDirPath: (0, import_node_path68.join)(".gemini", "skills")
|
|
8819
9077
|
};
|
|
8820
9078
|
}
|
|
8821
9079
|
getFrontmatter() {
|
|
@@ -8894,9 +9152,9 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
8894
9152
|
});
|
|
8895
9153
|
const result = GeminiCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8896
9154
|
if (!result.success) {
|
|
8897
|
-
const skillDirPath = (0,
|
|
9155
|
+
const skillDirPath = (0, import_node_path68.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8898
9156
|
throw new Error(
|
|
8899
|
-
`Invalid frontmatter in ${(0,
|
|
9157
|
+
`Invalid frontmatter in ${(0, import_node_path68.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8900
9158
|
);
|
|
8901
9159
|
}
|
|
8902
9160
|
return new _GeminiCliSkill({
|
|
@@ -8931,16 +9189,16 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
8931
9189
|
};
|
|
8932
9190
|
|
|
8933
9191
|
// src/features/skills/kilo-skill.ts
|
|
8934
|
-
var
|
|
8935
|
-
var
|
|
8936
|
-
var KiloSkillFrontmatterSchema =
|
|
8937
|
-
name:
|
|
8938
|
-
description:
|
|
9192
|
+
var import_node_path69 = require("path");
|
|
9193
|
+
var import_mini32 = require("zod/mini");
|
|
9194
|
+
var KiloSkillFrontmatterSchema = import_mini32.z.looseObject({
|
|
9195
|
+
name: import_mini32.z.string(),
|
|
9196
|
+
description: import_mini32.z.string()
|
|
8939
9197
|
});
|
|
8940
9198
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
8941
9199
|
constructor({
|
|
8942
9200
|
baseDir = process.cwd(),
|
|
8943
|
-
relativeDirPath = (0,
|
|
9201
|
+
relativeDirPath = (0, import_node_path69.join)(".kilocode", "skills"),
|
|
8944
9202
|
dirName,
|
|
8945
9203
|
frontmatter,
|
|
8946
9204
|
body,
|
|
@@ -8971,7 +9229,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
8971
9229
|
global: _global = false
|
|
8972
9230
|
} = {}) {
|
|
8973
9231
|
return {
|
|
8974
|
-
relativeDirPath: (0,
|
|
9232
|
+
relativeDirPath: (0, import_node_path69.join)(".kilocode", "skills")
|
|
8975
9233
|
};
|
|
8976
9234
|
}
|
|
8977
9235
|
getFrontmatter() {
|
|
@@ -9058,13 +9316,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
9058
9316
|
});
|
|
9059
9317
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9060
9318
|
if (!result.success) {
|
|
9061
|
-
const skillDirPath = (0,
|
|
9319
|
+
const skillDirPath = (0, import_node_path69.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9062
9320
|
throw new Error(
|
|
9063
|
-
`Invalid frontmatter in ${(0,
|
|
9321
|
+
`Invalid frontmatter in ${(0, import_node_path69.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9064
9322
|
);
|
|
9065
9323
|
}
|
|
9066
9324
|
if (result.data.name !== loaded.dirName) {
|
|
9067
|
-
const skillFilePath = (0,
|
|
9325
|
+
const skillFilePath = (0, import_node_path69.join)(
|
|
9068
9326
|
loaded.baseDir,
|
|
9069
9327
|
loaded.relativeDirPath,
|
|
9070
9328
|
loaded.dirName,
|
|
@@ -9105,16 +9363,16 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
9105
9363
|
};
|
|
9106
9364
|
|
|
9107
9365
|
// src/features/skills/kiro-skill.ts
|
|
9108
|
-
var
|
|
9109
|
-
var
|
|
9110
|
-
var KiroSkillFrontmatterSchema =
|
|
9111
|
-
name:
|
|
9112
|
-
description:
|
|
9366
|
+
var import_node_path70 = require("path");
|
|
9367
|
+
var import_mini33 = require("zod/mini");
|
|
9368
|
+
var KiroSkillFrontmatterSchema = import_mini33.z.looseObject({
|
|
9369
|
+
name: import_mini33.z.string(),
|
|
9370
|
+
description: import_mini33.z.string()
|
|
9113
9371
|
});
|
|
9114
9372
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
9115
9373
|
constructor({
|
|
9116
9374
|
baseDir = process.cwd(),
|
|
9117
|
-
relativeDirPath = (0,
|
|
9375
|
+
relativeDirPath = (0, import_node_path70.join)(".kiro", "skills"),
|
|
9118
9376
|
dirName,
|
|
9119
9377
|
frontmatter,
|
|
9120
9378
|
body,
|
|
@@ -9146,7 +9404,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
9146
9404
|
throw new Error("KiroSkill does not support global mode.");
|
|
9147
9405
|
}
|
|
9148
9406
|
return {
|
|
9149
|
-
relativeDirPath: (0,
|
|
9407
|
+
relativeDirPath: (0, import_node_path70.join)(".kiro", "skills")
|
|
9150
9408
|
};
|
|
9151
9409
|
}
|
|
9152
9410
|
getFrontmatter() {
|
|
@@ -9233,13 +9491,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
9233
9491
|
});
|
|
9234
9492
|
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9235
9493
|
if (!result.success) {
|
|
9236
|
-
const skillDirPath = (0,
|
|
9494
|
+
const skillDirPath = (0, import_node_path70.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9237
9495
|
throw new Error(
|
|
9238
|
-
`Invalid frontmatter in ${(0,
|
|
9496
|
+
`Invalid frontmatter in ${(0, import_node_path70.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9239
9497
|
);
|
|
9240
9498
|
}
|
|
9241
9499
|
if (result.data.name !== loaded.dirName) {
|
|
9242
|
-
const skillFilePath = (0,
|
|
9500
|
+
const skillFilePath = (0, import_node_path70.join)(
|
|
9243
9501
|
loaded.baseDir,
|
|
9244
9502
|
loaded.relativeDirPath,
|
|
9245
9503
|
loaded.dirName,
|
|
@@ -9281,17 +9539,17 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
9281
9539
|
};
|
|
9282
9540
|
|
|
9283
9541
|
// src/features/skills/opencode-skill.ts
|
|
9284
|
-
var
|
|
9285
|
-
var
|
|
9286
|
-
var OpenCodeSkillFrontmatterSchema =
|
|
9287
|
-
name:
|
|
9288
|
-
description:
|
|
9289
|
-
"allowed-tools":
|
|
9542
|
+
var import_node_path71 = require("path");
|
|
9543
|
+
var import_mini34 = require("zod/mini");
|
|
9544
|
+
var OpenCodeSkillFrontmatterSchema = import_mini34.z.looseObject({
|
|
9545
|
+
name: import_mini34.z.string(),
|
|
9546
|
+
description: import_mini34.z.string(),
|
|
9547
|
+
"allowed-tools": import_mini34.z.optional(import_mini34.z.array(import_mini34.z.string()))
|
|
9290
9548
|
});
|
|
9291
9549
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
9292
9550
|
constructor({
|
|
9293
9551
|
baseDir = process.cwd(),
|
|
9294
|
-
relativeDirPath = (0,
|
|
9552
|
+
relativeDirPath = (0, import_node_path71.join)(".opencode", "skill"),
|
|
9295
9553
|
dirName,
|
|
9296
9554
|
frontmatter,
|
|
9297
9555
|
body,
|
|
@@ -9320,7 +9578,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9320
9578
|
}
|
|
9321
9579
|
static getSettablePaths({ global = false } = {}) {
|
|
9322
9580
|
return {
|
|
9323
|
-
relativeDirPath: global ? (0,
|
|
9581
|
+
relativeDirPath: global ? (0, import_node_path71.join)(".config", "opencode", "skill") : (0, import_node_path71.join)(".opencode", "skill")
|
|
9324
9582
|
};
|
|
9325
9583
|
}
|
|
9326
9584
|
getFrontmatter() {
|
|
@@ -9405,9 +9663,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9405
9663
|
});
|
|
9406
9664
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9407
9665
|
if (!result.success) {
|
|
9408
|
-
const skillDirPath = (0,
|
|
9666
|
+
const skillDirPath = (0, import_node_path71.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9409
9667
|
throw new Error(
|
|
9410
|
-
`Invalid frontmatter in ${(0,
|
|
9668
|
+
`Invalid frontmatter in ${(0, import_node_path71.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9411
9669
|
);
|
|
9412
9670
|
}
|
|
9413
9671
|
return new _OpenCodeSkill({
|
|
@@ -9441,16 +9699,16 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9441
9699
|
};
|
|
9442
9700
|
|
|
9443
9701
|
// src/features/skills/replit-skill.ts
|
|
9444
|
-
var
|
|
9445
|
-
var
|
|
9446
|
-
var ReplitSkillFrontmatterSchema =
|
|
9447
|
-
name:
|
|
9448
|
-
description:
|
|
9702
|
+
var import_node_path72 = require("path");
|
|
9703
|
+
var import_mini35 = require("zod/mini");
|
|
9704
|
+
var ReplitSkillFrontmatterSchema = import_mini35.z.looseObject({
|
|
9705
|
+
name: import_mini35.z.string(),
|
|
9706
|
+
description: import_mini35.z.string()
|
|
9449
9707
|
});
|
|
9450
9708
|
var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
9451
9709
|
constructor({
|
|
9452
9710
|
baseDir = process.cwd(),
|
|
9453
|
-
relativeDirPath = (0,
|
|
9711
|
+
relativeDirPath = (0, import_node_path72.join)(".agents", "skills"),
|
|
9454
9712
|
dirName,
|
|
9455
9713
|
frontmatter,
|
|
9456
9714
|
body,
|
|
@@ -9482,7 +9740,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
9482
9740
|
throw new Error("ReplitSkill does not support global mode.");
|
|
9483
9741
|
}
|
|
9484
9742
|
return {
|
|
9485
|
-
relativeDirPath: (0,
|
|
9743
|
+
relativeDirPath: (0, import_node_path72.join)(".agents", "skills")
|
|
9486
9744
|
};
|
|
9487
9745
|
}
|
|
9488
9746
|
getFrontmatter() {
|
|
@@ -9561,9 +9819,9 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
9561
9819
|
});
|
|
9562
9820
|
const result = ReplitSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9563
9821
|
if (!result.success) {
|
|
9564
|
-
const skillDirPath = (0,
|
|
9822
|
+
const skillDirPath = (0, import_node_path72.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9565
9823
|
throw new Error(
|
|
9566
|
-
`Invalid frontmatter in ${(0,
|
|
9824
|
+
`Invalid frontmatter in ${(0, import_node_path72.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9567
9825
|
);
|
|
9568
9826
|
}
|
|
9569
9827
|
return new _ReplitSkill({
|
|
@@ -9598,16 +9856,16 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
9598
9856
|
};
|
|
9599
9857
|
|
|
9600
9858
|
// src/features/skills/roo-skill.ts
|
|
9601
|
-
var
|
|
9602
|
-
var
|
|
9603
|
-
var RooSkillFrontmatterSchema =
|
|
9604
|
-
name:
|
|
9605
|
-
description:
|
|
9859
|
+
var import_node_path73 = require("path");
|
|
9860
|
+
var import_mini36 = require("zod/mini");
|
|
9861
|
+
var RooSkillFrontmatterSchema = import_mini36.z.looseObject({
|
|
9862
|
+
name: import_mini36.z.string(),
|
|
9863
|
+
description: import_mini36.z.string()
|
|
9606
9864
|
});
|
|
9607
9865
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
9608
9866
|
constructor({
|
|
9609
9867
|
baseDir = process.cwd(),
|
|
9610
|
-
relativeDirPath = (0,
|
|
9868
|
+
relativeDirPath = (0, import_node_path73.join)(".roo", "skills"),
|
|
9611
9869
|
dirName,
|
|
9612
9870
|
frontmatter,
|
|
9613
9871
|
body,
|
|
@@ -9638,7 +9896,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
9638
9896
|
global: _global = false
|
|
9639
9897
|
} = {}) {
|
|
9640
9898
|
return {
|
|
9641
|
-
relativeDirPath: (0,
|
|
9899
|
+
relativeDirPath: (0, import_node_path73.join)(".roo", "skills")
|
|
9642
9900
|
};
|
|
9643
9901
|
}
|
|
9644
9902
|
getFrontmatter() {
|
|
@@ -9725,13 +9983,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
9725
9983
|
});
|
|
9726
9984
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9727
9985
|
if (!result.success) {
|
|
9728
|
-
const skillDirPath = (0,
|
|
9986
|
+
const skillDirPath = (0, import_node_path73.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9729
9987
|
throw new Error(
|
|
9730
|
-
`Invalid frontmatter in ${(0,
|
|
9988
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9731
9989
|
);
|
|
9732
9990
|
}
|
|
9733
9991
|
if (result.data.name !== loaded.dirName) {
|
|
9734
|
-
const skillFilePath = (0,
|
|
9992
|
+
const skillFilePath = (0, import_node_path73.join)(
|
|
9735
9993
|
loaded.baseDir,
|
|
9736
9994
|
loaded.relativeDirPath,
|
|
9737
9995
|
loaded.dirName,
|
|
@@ -9772,17 +10030,17 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
9772
10030
|
};
|
|
9773
10031
|
|
|
9774
10032
|
// src/features/skills/skills-utils.ts
|
|
9775
|
-
var
|
|
10033
|
+
var import_node_path74 = require("path");
|
|
9776
10034
|
async function getLocalSkillDirNames(baseDir) {
|
|
9777
|
-
const skillsDir = (0,
|
|
10035
|
+
const skillsDir = (0, import_node_path74.join)(baseDir, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
9778
10036
|
const names = /* @__PURE__ */ new Set();
|
|
9779
10037
|
if (!await directoryExists(skillsDir)) {
|
|
9780
10038
|
return names;
|
|
9781
10039
|
}
|
|
9782
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
10040
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path74.join)(skillsDir, "*"), { type: "dir" });
|
|
9783
10041
|
for (const dirPath of dirPaths) {
|
|
9784
|
-
const name = (0,
|
|
9785
|
-
if (name === (0,
|
|
10042
|
+
const name = (0, import_node_path74.basename)(dirPath);
|
|
10043
|
+
if (name === (0, import_node_path74.basename)(RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH)) continue;
|
|
9786
10044
|
names.add(name);
|
|
9787
10045
|
}
|
|
9788
10046
|
return names;
|
|
@@ -9807,7 +10065,7 @@ var skillsProcessorToolTargetTuple = [
|
|
|
9807
10065
|
"replit",
|
|
9808
10066
|
"roo"
|
|
9809
10067
|
];
|
|
9810
|
-
var SkillsProcessorToolTargetSchema =
|
|
10068
|
+
var SkillsProcessorToolTargetSchema = import_mini37.z.enum(skillsProcessorToolTargetTuple);
|
|
9811
10069
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
9812
10070
|
[
|
|
9813
10071
|
"agentsmd",
|
|
@@ -10008,11 +10266,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10008
10266
|
)
|
|
10009
10267
|
);
|
|
10010
10268
|
const localSkillNames = new Set(localDirNames);
|
|
10011
|
-
const curatedDirPath = (0,
|
|
10269
|
+
const curatedDirPath = (0, import_node_path75.join)(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
10012
10270
|
let curatedSkills = [];
|
|
10013
10271
|
if (await directoryExists(curatedDirPath)) {
|
|
10014
|
-
const curatedDirPaths = await findFilesByGlobs((0,
|
|
10015
|
-
const curatedDirNames = curatedDirPaths.map((path4) => (0,
|
|
10272
|
+
const curatedDirPaths = await findFilesByGlobs((0, import_node_path75.join)(curatedDirPath, "*"), { type: "dir" });
|
|
10273
|
+
const curatedDirNames = curatedDirPaths.map((path4) => (0, import_node_path75.basename)(path4));
|
|
10016
10274
|
const nonConflicting = curatedDirNames.filter((name) => {
|
|
10017
10275
|
if (localSkillNames.has(name)) {
|
|
10018
10276
|
logger.debug(`Skipping curated skill "${name}": local skill takes precedence.`);
|
|
@@ -10045,9 +10303,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10045
10303
|
async loadToolDirs() {
|
|
10046
10304
|
const factory = this.getFactory(this.toolTarget);
|
|
10047
10305
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
10048
|
-
const skillsDirPath = (0,
|
|
10049
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
10050
|
-
const dirNames = dirPaths.map((path4) => (0,
|
|
10306
|
+
const skillsDirPath = (0, import_node_path75.join)(this.baseDir, paths.relativeDirPath);
|
|
10307
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path75.join)(skillsDirPath, "*"), { type: "dir" });
|
|
10308
|
+
const dirNames = dirPaths.map((path4) => (0, import_node_path75.basename)(path4));
|
|
10051
10309
|
const toolSkills = await Promise.all(
|
|
10052
10310
|
dirNames.map(
|
|
10053
10311
|
(dirName) => factory.class.fromDir({
|
|
@@ -10063,9 +10321,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10063
10321
|
async loadToolDirsToDelete() {
|
|
10064
10322
|
const factory = this.getFactory(this.toolTarget);
|
|
10065
10323
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
10066
|
-
const skillsDirPath = (0,
|
|
10067
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
10068
|
-
const dirNames = dirPaths.map((path4) => (0,
|
|
10324
|
+
const skillsDirPath = (0, import_node_path75.join)(this.baseDir, paths.relativeDirPath);
|
|
10325
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path75.join)(skillsDirPath, "*"), { type: "dir" });
|
|
10326
|
+
const dirNames = dirPaths.map((path4) => (0, import_node_path75.basename)(path4));
|
|
10069
10327
|
const toolSkills = dirNames.map(
|
|
10070
10328
|
(dirName) => factory.class.forDeletion({
|
|
10071
10329
|
baseDir: this.baseDir,
|
|
@@ -10126,11 +10384,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10126
10384
|
};
|
|
10127
10385
|
|
|
10128
10386
|
// src/features/subagents/agentsmd-subagent.ts
|
|
10129
|
-
var
|
|
10387
|
+
var import_node_path77 = require("path");
|
|
10130
10388
|
|
|
10131
10389
|
// src/features/subagents/simulated-subagent.ts
|
|
10132
|
-
var
|
|
10133
|
-
var
|
|
10390
|
+
var import_node_path76 = require("path");
|
|
10391
|
+
var import_mini38 = require("zod/mini");
|
|
10134
10392
|
|
|
10135
10393
|
// src/features/subagents/tool-subagent.ts
|
|
10136
10394
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -10182,9 +10440,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
10182
10440
|
};
|
|
10183
10441
|
|
|
10184
10442
|
// src/features/subagents/simulated-subagent.ts
|
|
10185
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
10186
|
-
name:
|
|
10187
|
-
description:
|
|
10443
|
+
var SimulatedSubagentFrontmatterSchema = import_mini38.z.object({
|
|
10444
|
+
name: import_mini38.z.string(),
|
|
10445
|
+
description: import_mini38.z.string()
|
|
10188
10446
|
});
|
|
10189
10447
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
10190
10448
|
frontmatter;
|
|
@@ -10194,7 +10452,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10194
10452
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10195
10453
|
if (!result.success) {
|
|
10196
10454
|
throw new Error(
|
|
10197
|
-
`Invalid frontmatter in ${(0,
|
|
10455
|
+
`Invalid frontmatter in ${(0, import_node_path76.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10198
10456
|
);
|
|
10199
10457
|
}
|
|
10200
10458
|
}
|
|
@@ -10245,7 +10503,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10245
10503
|
return {
|
|
10246
10504
|
success: false,
|
|
10247
10505
|
error: new Error(
|
|
10248
|
-
`Invalid frontmatter in ${(0,
|
|
10506
|
+
`Invalid frontmatter in ${(0, import_node_path76.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10249
10507
|
)
|
|
10250
10508
|
};
|
|
10251
10509
|
}
|
|
@@ -10255,7 +10513,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10255
10513
|
relativeFilePath,
|
|
10256
10514
|
validate = true
|
|
10257
10515
|
}) {
|
|
10258
|
-
const filePath = (0,
|
|
10516
|
+
const filePath = (0, import_node_path76.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
10259
10517
|
const fileContent = await readFileContent(filePath);
|
|
10260
10518
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10261
10519
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -10265,7 +10523,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10265
10523
|
return {
|
|
10266
10524
|
baseDir,
|
|
10267
10525
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
10268
|
-
relativeFilePath: (0,
|
|
10526
|
+
relativeFilePath: (0, import_node_path76.basename)(relativeFilePath),
|
|
10269
10527
|
frontmatter: result.data,
|
|
10270
10528
|
body: content.trim(),
|
|
10271
10529
|
validate
|
|
@@ -10291,7 +10549,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10291
10549
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
10292
10550
|
static getSettablePaths() {
|
|
10293
10551
|
return {
|
|
10294
|
-
relativeDirPath: (0,
|
|
10552
|
+
relativeDirPath: (0, import_node_path77.join)(".agents", "subagents")
|
|
10295
10553
|
};
|
|
10296
10554
|
}
|
|
10297
10555
|
static async fromFile(params) {
|
|
@@ -10314,11 +10572,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
10314
10572
|
};
|
|
10315
10573
|
|
|
10316
10574
|
// src/features/subagents/factorydroid-subagent.ts
|
|
10317
|
-
var
|
|
10575
|
+
var import_node_path78 = require("path");
|
|
10318
10576
|
var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
|
|
10319
10577
|
static getSettablePaths(_options) {
|
|
10320
10578
|
return {
|
|
10321
|
-
relativeDirPath: (0,
|
|
10579
|
+
relativeDirPath: (0, import_node_path78.join)(".factory", "droids")
|
|
10322
10580
|
};
|
|
10323
10581
|
}
|
|
10324
10582
|
static async fromFile(params) {
|
|
@@ -10341,11 +10599,11 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
10341
10599
|
};
|
|
10342
10600
|
|
|
10343
10601
|
// src/features/subagents/geminicli-subagent.ts
|
|
10344
|
-
var
|
|
10602
|
+
var import_node_path79 = require("path");
|
|
10345
10603
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
10346
10604
|
static getSettablePaths() {
|
|
10347
10605
|
return {
|
|
10348
|
-
relativeDirPath: (0,
|
|
10606
|
+
relativeDirPath: (0, import_node_path79.join)(".gemini", "subagents")
|
|
10349
10607
|
};
|
|
10350
10608
|
}
|
|
10351
10609
|
static async fromFile(params) {
|
|
@@ -10368,11 +10626,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
10368
10626
|
};
|
|
10369
10627
|
|
|
10370
10628
|
// src/features/subagents/roo-subagent.ts
|
|
10371
|
-
var
|
|
10629
|
+
var import_node_path80 = require("path");
|
|
10372
10630
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
10373
10631
|
static getSettablePaths() {
|
|
10374
10632
|
return {
|
|
10375
|
-
relativeDirPath: (0,
|
|
10633
|
+
relativeDirPath: (0, import_node_path80.join)(".roo", "subagents")
|
|
10376
10634
|
};
|
|
10377
10635
|
}
|
|
10378
10636
|
static async fromFile(params) {
|
|
@@ -10395,20 +10653,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
10395
10653
|
};
|
|
10396
10654
|
|
|
10397
10655
|
// src/features/subagents/subagents-processor.ts
|
|
10398
|
-
var
|
|
10399
|
-
var
|
|
10656
|
+
var import_node_path88 = require("path");
|
|
10657
|
+
var import_mini46 = require("zod/mini");
|
|
10400
10658
|
|
|
10401
10659
|
// src/features/subagents/claudecode-subagent.ts
|
|
10402
|
-
var
|
|
10403
|
-
var
|
|
10660
|
+
var import_node_path82 = require("path");
|
|
10661
|
+
var import_mini40 = require("zod/mini");
|
|
10404
10662
|
|
|
10405
10663
|
// src/features/subagents/rulesync-subagent.ts
|
|
10406
|
-
var
|
|
10407
|
-
var
|
|
10408
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
10409
|
-
targets:
|
|
10410
|
-
name:
|
|
10411
|
-
description:
|
|
10664
|
+
var import_node_path81 = require("path");
|
|
10665
|
+
var import_mini39 = require("zod/mini");
|
|
10666
|
+
var RulesyncSubagentFrontmatterSchema = import_mini39.z.looseObject({
|
|
10667
|
+
targets: import_mini39.z._default(RulesyncTargetsSchema, ["*"]),
|
|
10668
|
+
name: import_mini39.z.string(),
|
|
10669
|
+
description: import_mini39.z.string()
|
|
10412
10670
|
});
|
|
10413
10671
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
10414
10672
|
frontmatter;
|
|
@@ -10417,7 +10675,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10417
10675
|
const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10418
10676
|
if (!parseResult.success && rest.validate !== false) {
|
|
10419
10677
|
throw new Error(
|
|
10420
|
-
`Invalid frontmatter in ${(0,
|
|
10678
|
+
`Invalid frontmatter in ${(0, import_node_path81.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
10421
10679
|
);
|
|
10422
10680
|
}
|
|
10423
10681
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
|
|
@@ -10450,7 +10708,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10450
10708
|
return {
|
|
10451
10709
|
success: false,
|
|
10452
10710
|
error: new Error(
|
|
10453
|
-
`Invalid frontmatter in ${(0,
|
|
10711
|
+
`Invalid frontmatter in ${(0, import_node_path81.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10454
10712
|
)
|
|
10455
10713
|
};
|
|
10456
10714
|
}
|
|
@@ -10458,14 +10716,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10458
10716
|
static async fromFile({
|
|
10459
10717
|
relativeFilePath
|
|
10460
10718
|
}) {
|
|
10461
|
-
const filePath = (0,
|
|
10719
|
+
const filePath = (0, import_node_path81.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
|
|
10462
10720
|
const fileContent = await readFileContent(filePath);
|
|
10463
10721
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10464
10722
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10465
10723
|
if (!result.success) {
|
|
10466
10724
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
10467
10725
|
}
|
|
10468
|
-
const filename = (0,
|
|
10726
|
+
const filename = (0, import_node_path81.basename)(relativeFilePath);
|
|
10469
10727
|
return new _RulesyncSubagent({
|
|
10470
10728
|
baseDir: process.cwd(),
|
|
10471
10729
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -10477,13 +10735,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10477
10735
|
};
|
|
10478
10736
|
|
|
10479
10737
|
// src/features/subagents/claudecode-subagent.ts
|
|
10480
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
10481
|
-
name:
|
|
10482
|
-
description:
|
|
10483
|
-
model:
|
|
10484
|
-
tools:
|
|
10485
|
-
permissionMode:
|
|
10486
|
-
skills:
|
|
10738
|
+
var ClaudecodeSubagentFrontmatterSchema = import_mini40.z.looseObject({
|
|
10739
|
+
name: import_mini40.z.string(),
|
|
10740
|
+
description: import_mini40.z.string(),
|
|
10741
|
+
model: import_mini40.z.optional(import_mini40.z.string()),
|
|
10742
|
+
tools: import_mini40.z.optional(import_mini40.z.union([import_mini40.z.string(), import_mini40.z.array(import_mini40.z.string())])),
|
|
10743
|
+
permissionMode: import_mini40.z.optional(import_mini40.z.string()),
|
|
10744
|
+
skills: import_mini40.z.optional(import_mini40.z.union([import_mini40.z.string(), import_mini40.z.array(import_mini40.z.string())]))
|
|
10487
10745
|
});
|
|
10488
10746
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
10489
10747
|
frontmatter;
|
|
@@ -10493,7 +10751,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10493
10751
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10494
10752
|
if (!result.success) {
|
|
10495
10753
|
throw new Error(
|
|
10496
|
-
`Invalid frontmatter in ${(0,
|
|
10754
|
+
`Invalid frontmatter in ${(0, import_node_path82.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10497
10755
|
);
|
|
10498
10756
|
}
|
|
10499
10757
|
}
|
|
@@ -10505,7 +10763,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10505
10763
|
}
|
|
10506
10764
|
static getSettablePaths(_options = {}) {
|
|
10507
10765
|
return {
|
|
10508
|
-
relativeDirPath: (0,
|
|
10766
|
+
relativeDirPath: (0, import_node_path82.join)(".claude", "agents")
|
|
10509
10767
|
};
|
|
10510
10768
|
}
|
|
10511
10769
|
getFrontmatter() {
|
|
@@ -10581,7 +10839,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10581
10839
|
return {
|
|
10582
10840
|
success: false,
|
|
10583
10841
|
error: new Error(
|
|
10584
|
-
`Invalid frontmatter in ${(0,
|
|
10842
|
+
`Invalid frontmatter in ${(0, import_node_path82.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10585
10843
|
)
|
|
10586
10844
|
};
|
|
10587
10845
|
}
|
|
@@ -10599,7 +10857,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10599
10857
|
global = false
|
|
10600
10858
|
}) {
|
|
10601
10859
|
const paths = this.getSettablePaths({ global });
|
|
10602
|
-
const filePath = (0,
|
|
10860
|
+
const filePath = (0, import_node_path82.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10603
10861
|
const fileContent = await readFileContent(filePath);
|
|
10604
10862
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10605
10863
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -10634,16 +10892,16 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10634
10892
|
};
|
|
10635
10893
|
|
|
10636
10894
|
// src/features/subagents/codexcli-subagent.ts
|
|
10637
|
-
var
|
|
10895
|
+
var import_node_path83 = require("path");
|
|
10638
10896
|
var smolToml2 = __toESM(require("smol-toml"), 1);
|
|
10639
|
-
var
|
|
10640
|
-
var CodexCliSubagentTomlSchema =
|
|
10641
|
-
name:
|
|
10642
|
-
description:
|
|
10643
|
-
developer_instructions:
|
|
10644
|
-
model:
|
|
10645
|
-
model_reasoning_effort:
|
|
10646
|
-
sandbox_mode:
|
|
10897
|
+
var import_mini41 = require("zod/mini");
|
|
10898
|
+
var CodexCliSubagentTomlSchema = import_mini41.z.looseObject({
|
|
10899
|
+
name: import_mini41.z.string(),
|
|
10900
|
+
description: import_mini41.z.optional(import_mini41.z.string()),
|
|
10901
|
+
developer_instructions: import_mini41.z.optional(import_mini41.z.string()),
|
|
10902
|
+
model: import_mini41.z.optional(import_mini41.z.string()),
|
|
10903
|
+
model_reasoning_effort: import_mini41.z.optional(import_mini41.z.string()),
|
|
10904
|
+
sandbox_mode: import_mini41.z.optional(import_mini41.z.string())
|
|
10647
10905
|
});
|
|
10648
10906
|
var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
10649
10907
|
body;
|
|
@@ -10654,7 +10912,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
10654
10912
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
10655
10913
|
} catch (error) {
|
|
10656
10914
|
throw new Error(
|
|
10657
|
-
`Invalid TOML in ${(0,
|
|
10915
|
+
`Invalid TOML in ${(0, import_node_path83.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
10658
10916
|
{ cause: error }
|
|
10659
10917
|
);
|
|
10660
10918
|
}
|
|
@@ -10666,7 +10924,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
10666
10924
|
}
|
|
10667
10925
|
static getSettablePaths(_options = {}) {
|
|
10668
10926
|
return {
|
|
10669
|
-
relativeDirPath: (0,
|
|
10927
|
+
relativeDirPath: (0, import_node_path83.join)(".codex", "agents")
|
|
10670
10928
|
};
|
|
10671
10929
|
}
|
|
10672
10930
|
getBody() {
|
|
@@ -10678,7 +10936,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
10678
10936
|
parsed = CodexCliSubagentTomlSchema.parse(smolToml2.parse(this.body));
|
|
10679
10937
|
} catch (error) {
|
|
10680
10938
|
throw new Error(
|
|
10681
|
-
`Failed to parse TOML in ${(0,
|
|
10939
|
+
`Failed to parse TOML in ${(0, import_node_path83.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
10682
10940
|
{ cause: error }
|
|
10683
10941
|
);
|
|
10684
10942
|
}
|
|
@@ -10759,7 +11017,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
10759
11017
|
global = false
|
|
10760
11018
|
}) {
|
|
10761
11019
|
const paths = this.getSettablePaths({ global });
|
|
10762
|
-
const filePath = (0,
|
|
11020
|
+
const filePath = (0, import_node_path83.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10763
11021
|
const fileContent = await readFileContent(filePath);
|
|
10764
11022
|
const subagent = new _CodexCliSubagent({
|
|
10765
11023
|
baseDir,
|
|
@@ -10797,13 +11055,13 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
10797
11055
|
};
|
|
10798
11056
|
|
|
10799
11057
|
// src/features/subagents/copilot-subagent.ts
|
|
10800
|
-
var
|
|
10801
|
-
var
|
|
11058
|
+
var import_node_path84 = require("path");
|
|
11059
|
+
var import_mini42 = require("zod/mini");
|
|
10802
11060
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
10803
|
-
var CopilotSubagentFrontmatterSchema =
|
|
10804
|
-
name:
|
|
10805
|
-
description:
|
|
10806
|
-
tools:
|
|
11061
|
+
var CopilotSubagentFrontmatterSchema = import_mini42.z.looseObject({
|
|
11062
|
+
name: import_mini42.z.string(),
|
|
11063
|
+
description: import_mini42.z.string(),
|
|
11064
|
+
tools: import_mini42.z.optional(import_mini42.z.union([import_mini42.z.string(), import_mini42.z.array(import_mini42.z.string())]))
|
|
10807
11065
|
});
|
|
10808
11066
|
var normalizeTools = (tools) => {
|
|
10809
11067
|
if (!tools) {
|
|
@@ -10823,7 +11081,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
10823
11081
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10824
11082
|
if (!result.success) {
|
|
10825
11083
|
throw new Error(
|
|
10826
|
-
`Invalid frontmatter in ${(0,
|
|
11084
|
+
`Invalid frontmatter in ${(0, import_node_path84.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10827
11085
|
);
|
|
10828
11086
|
}
|
|
10829
11087
|
}
|
|
@@ -10835,7 +11093,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
10835
11093
|
}
|
|
10836
11094
|
static getSettablePaths(_options = {}) {
|
|
10837
11095
|
return {
|
|
10838
|
-
relativeDirPath: (0,
|
|
11096
|
+
relativeDirPath: (0, import_node_path84.join)(".github", "agents")
|
|
10839
11097
|
};
|
|
10840
11098
|
}
|
|
10841
11099
|
getFrontmatter() {
|
|
@@ -10909,7 +11167,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
10909
11167
|
return {
|
|
10910
11168
|
success: false,
|
|
10911
11169
|
error: new Error(
|
|
10912
|
-
`Invalid frontmatter in ${(0,
|
|
11170
|
+
`Invalid frontmatter in ${(0, import_node_path84.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10913
11171
|
)
|
|
10914
11172
|
};
|
|
10915
11173
|
}
|
|
@@ -10927,7 +11185,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
10927
11185
|
global = false
|
|
10928
11186
|
}) {
|
|
10929
11187
|
const paths = this.getSettablePaths({ global });
|
|
10930
|
-
const filePath = (0,
|
|
11188
|
+
const filePath = (0, import_node_path84.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10931
11189
|
const fileContent = await readFileContent(filePath);
|
|
10932
11190
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10933
11191
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -10963,11 +11221,11 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
10963
11221
|
};
|
|
10964
11222
|
|
|
10965
11223
|
// src/features/subagents/cursor-subagent.ts
|
|
10966
|
-
var
|
|
10967
|
-
var
|
|
10968
|
-
var CursorSubagentFrontmatterSchema =
|
|
10969
|
-
name:
|
|
10970
|
-
description:
|
|
11224
|
+
var import_node_path85 = require("path");
|
|
11225
|
+
var import_mini43 = require("zod/mini");
|
|
11226
|
+
var CursorSubagentFrontmatterSchema = import_mini43.z.looseObject({
|
|
11227
|
+
name: import_mini43.z.string(),
|
|
11228
|
+
description: import_mini43.z.string()
|
|
10971
11229
|
});
|
|
10972
11230
|
var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
10973
11231
|
frontmatter;
|
|
@@ -10977,7 +11235,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
10977
11235
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10978
11236
|
if (!result.success) {
|
|
10979
11237
|
throw new Error(
|
|
10980
|
-
`Invalid frontmatter in ${(0,
|
|
11238
|
+
`Invalid frontmatter in ${(0, import_node_path85.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10981
11239
|
);
|
|
10982
11240
|
}
|
|
10983
11241
|
}
|
|
@@ -10989,7 +11247,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
10989
11247
|
}
|
|
10990
11248
|
static getSettablePaths(_options = {}) {
|
|
10991
11249
|
return {
|
|
10992
|
-
relativeDirPath: (0,
|
|
11250
|
+
relativeDirPath: (0, import_node_path85.join)(".cursor", "agents")
|
|
10993
11251
|
};
|
|
10994
11252
|
}
|
|
10995
11253
|
getFrontmatter() {
|
|
@@ -11056,7 +11314,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11056
11314
|
return {
|
|
11057
11315
|
success: false,
|
|
11058
11316
|
error: new Error(
|
|
11059
|
-
`Invalid frontmatter in ${(0,
|
|
11317
|
+
`Invalid frontmatter in ${(0, import_node_path85.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11060
11318
|
)
|
|
11061
11319
|
};
|
|
11062
11320
|
}
|
|
@@ -11074,7 +11332,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11074
11332
|
global = false
|
|
11075
11333
|
}) {
|
|
11076
11334
|
const paths = this.getSettablePaths({ global });
|
|
11077
|
-
const filePath = (0,
|
|
11335
|
+
const filePath = (0, import_node_path85.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11078
11336
|
const fileContent = await readFileContent(filePath);
|
|
11079
11337
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11080
11338
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11110,23 +11368,23 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11110
11368
|
};
|
|
11111
11369
|
|
|
11112
11370
|
// src/features/subagents/kiro-subagent.ts
|
|
11113
|
-
var
|
|
11114
|
-
var
|
|
11115
|
-
var KiroCliSubagentJsonSchema =
|
|
11116
|
-
name:
|
|
11117
|
-
description:
|
|
11118
|
-
prompt:
|
|
11119
|
-
tools:
|
|
11120
|
-
toolAliases:
|
|
11121
|
-
toolSettings:
|
|
11122
|
-
toolSchema:
|
|
11123
|
-
hooks:
|
|
11124
|
-
model:
|
|
11125
|
-
mcpServers:
|
|
11126
|
-
useLegacyMcpJson:
|
|
11127
|
-
resources:
|
|
11128
|
-
allowedTools:
|
|
11129
|
-
includeMcpJson:
|
|
11371
|
+
var import_node_path86 = require("path");
|
|
11372
|
+
var import_mini44 = require("zod/mini");
|
|
11373
|
+
var KiroCliSubagentJsonSchema = import_mini44.z.looseObject({
|
|
11374
|
+
name: import_mini44.z.string(),
|
|
11375
|
+
description: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.string())),
|
|
11376
|
+
prompt: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.string())),
|
|
11377
|
+
tools: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.array(import_mini44.z.string()))),
|
|
11378
|
+
toolAliases: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.record(import_mini44.z.string(), import_mini44.z.string()))),
|
|
11379
|
+
toolSettings: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.unknown())),
|
|
11380
|
+
toolSchema: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.unknown())),
|
|
11381
|
+
hooks: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.record(import_mini44.z.string(), import_mini44.z.array(import_mini44.z.unknown())))),
|
|
11382
|
+
model: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.string())),
|
|
11383
|
+
mcpServers: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.record(import_mini44.z.string(), import_mini44.z.unknown()))),
|
|
11384
|
+
useLegacyMcpJson: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.boolean())),
|
|
11385
|
+
resources: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.array(import_mini44.z.string()))),
|
|
11386
|
+
allowedTools: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.array(import_mini44.z.string()))),
|
|
11387
|
+
includeMcpJson: import_mini44.z.optional(import_mini44.z.nullable(import_mini44.z.boolean()))
|
|
11130
11388
|
});
|
|
11131
11389
|
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
11132
11390
|
body;
|
|
@@ -11137,7 +11395,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11137
11395
|
KiroCliSubagentJsonSchema.parse(parsed);
|
|
11138
11396
|
} catch (error) {
|
|
11139
11397
|
throw new Error(
|
|
11140
|
-
`Invalid JSON in ${(0,
|
|
11398
|
+
`Invalid JSON in ${(0, import_node_path86.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11141
11399
|
{ cause: error }
|
|
11142
11400
|
);
|
|
11143
11401
|
}
|
|
@@ -11149,7 +11407,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11149
11407
|
}
|
|
11150
11408
|
static getSettablePaths(_options = {}) {
|
|
11151
11409
|
return {
|
|
11152
|
-
relativeDirPath: (0,
|
|
11410
|
+
relativeDirPath: (0, import_node_path86.join)(".kiro", "agents")
|
|
11153
11411
|
};
|
|
11154
11412
|
}
|
|
11155
11413
|
getBody() {
|
|
@@ -11161,7 +11419,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11161
11419
|
parsed = JSON.parse(this.body);
|
|
11162
11420
|
} catch (error) {
|
|
11163
11421
|
throw new Error(
|
|
11164
|
-
`Failed to parse JSON in ${(0,
|
|
11422
|
+
`Failed to parse JSON in ${(0, import_node_path86.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11165
11423
|
{ cause: error }
|
|
11166
11424
|
);
|
|
11167
11425
|
}
|
|
@@ -11242,7 +11500,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11242
11500
|
global = false
|
|
11243
11501
|
}) {
|
|
11244
11502
|
const paths = this.getSettablePaths({ global });
|
|
11245
|
-
const filePath = (0,
|
|
11503
|
+
const filePath = (0, import_node_path86.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11246
11504
|
const fileContent = await readFileContent(filePath);
|
|
11247
11505
|
const subagent = new _KiroSubagent({
|
|
11248
11506
|
baseDir,
|
|
@@ -11280,12 +11538,12 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11280
11538
|
};
|
|
11281
11539
|
|
|
11282
11540
|
// src/features/subagents/opencode-subagent.ts
|
|
11283
|
-
var
|
|
11284
|
-
var
|
|
11285
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
11286
|
-
description:
|
|
11287
|
-
mode:
|
|
11288
|
-
name:
|
|
11541
|
+
var import_node_path87 = require("path");
|
|
11542
|
+
var import_mini45 = require("zod/mini");
|
|
11543
|
+
var OpenCodeSubagentFrontmatterSchema = import_mini45.z.looseObject({
|
|
11544
|
+
description: import_mini45.z.string(),
|
|
11545
|
+
mode: import_mini45.z._default(import_mini45.z.string(), "subagent"),
|
|
11546
|
+
name: import_mini45.z.optional(import_mini45.z.string())
|
|
11289
11547
|
});
|
|
11290
11548
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
11291
11549
|
frontmatter;
|
|
@@ -11295,7 +11553,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11295
11553
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11296
11554
|
if (!result.success) {
|
|
11297
11555
|
throw new Error(
|
|
11298
|
-
`Invalid frontmatter in ${(0,
|
|
11556
|
+
`Invalid frontmatter in ${(0, import_node_path87.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11299
11557
|
);
|
|
11300
11558
|
}
|
|
11301
11559
|
}
|
|
@@ -11309,7 +11567,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11309
11567
|
global = false
|
|
11310
11568
|
} = {}) {
|
|
11311
11569
|
return {
|
|
11312
|
-
relativeDirPath: global ? (0,
|
|
11570
|
+
relativeDirPath: global ? (0, import_node_path87.join)(".config", "opencode", "agent") : (0, import_node_path87.join)(".opencode", "agent")
|
|
11313
11571
|
};
|
|
11314
11572
|
}
|
|
11315
11573
|
getFrontmatter() {
|
|
@@ -11322,7 +11580,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11322
11580
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
11323
11581
|
const rulesyncFrontmatter = {
|
|
11324
11582
|
targets: ["*"],
|
|
11325
|
-
name: name ?? (0,
|
|
11583
|
+
name: name ?? (0, import_node_path87.basename)(this.getRelativeFilePath(), ".md"),
|
|
11326
11584
|
description,
|
|
11327
11585
|
opencode: { mode, ...opencodeSection }
|
|
11328
11586
|
};
|
|
@@ -11347,7 +11605,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11347
11605
|
const opencodeFrontmatter = {
|
|
11348
11606
|
...opencodeSection,
|
|
11349
11607
|
description: rulesyncFrontmatter.description,
|
|
11350
|
-
mode: "subagent",
|
|
11608
|
+
mode: typeof opencodeSection.mode === "string" ? opencodeSection.mode : "subagent",
|
|
11351
11609
|
...rulesyncFrontmatter.name && { name: rulesyncFrontmatter.name }
|
|
11352
11610
|
};
|
|
11353
11611
|
const body = rulesyncSubagent.getBody();
|
|
@@ -11375,7 +11633,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11375
11633
|
return {
|
|
11376
11634
|
success: false,
|
|
11377
11635
|
error: new Error(
|
|
11378
|
-
`Invalid frontmatter in ${(0,
|
|
11636
|
+
`Invalid frontmatter in ${(0, import_node_path87.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11379
11637
|
)
|
|
11380
11638
|
};
|
|
11381
11639
|
}
|
|
@@ -11392,7 +11650,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11392
11650
|
global = false
|
|
11393
11651
|
}) {
|
|
11394
11652
|
const paths = this.getSettablePaths({ global });
|
|
11395
|
-
const filePath = (0,
|
|
11653
|
+
const filePath = (0, import_node_path87.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11396
11654
|
const fileContent = await readFileContent(filePath);
|
|
11397
11655
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11398
11656
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11441,7 +11699,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
11441
11699
|
"opencode",
|
|
11442
11700
|
"roo"
|
|
11443
11701
|
];
|
|
11444
|
-
var SubagentsProcessorToolTargetSchema =
|
|
11702
|
+
var SubagentsProcessorToolTargetSchema = import_mini46.z.enum(subagentsProcessorToolTargetTuple);
|
|
11445
11703
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
11446
11704
|
[
|
|
11447
11705
|
"agentsmd",
|
|
@@ -11603,7 +11861,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
11603
11861
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
11604
11862
|
*/
|
|
11605
11863
|
async loadRulesyncFiles() {
|
|
11606
|
-
const subagentsDir = (0,
|
|
11864
|
+
const subagentsDir = (0, import_node_path88.join)(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
11607
11865
|
const dirExists = await directoryExists(subagentsDir);
|
|
11608
11866
|
if (!dirExists) {
|
|
11609
11867
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -11618,7 +11876,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
11618
11876
|
logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
11619
11877
|
const rulesyncSubagents = [];
|
|
11620
11878
|
for (const mdFile of mdFiles) {
|
|
11621
|
-
const filepath = (0,
|
|
11879
|
+
const filepath = (0, import_node_path88.join)(subagentsDir, mdFile);
|
|
11622
11880
|
try {
|
|
11623
11881
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
11624
11882
|
relativeFilePath: mdFile,
|
|
@@ -11648,14 +11906,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
11648
11906
|
const factory = this.getFactory(this.toolTarget);
|
|
11649
11907
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
11650
11908
|
const subagentFilePaths = await findFilesByGlobs(
|
|
11651
|
-
(0,
|
|
11909
|
+
(0, import_node_path88.join)(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
11652
11910
|
);
|
|
11653
11911
|
if (forDeletion) {
|
|
11654
11912
|
const toolSubagents2 = subagentFilePaths.map(
|
|
11655
11913
|
(path4) => factory.class.forDeletion({
|
|
11656
11914
|
baseDir: this.baseDir,
|
|
11657
11915
|
relativeDirPath: paths.relativeDirPath,
|
|
11658
|
-
relativeFilePath: (0,
|
|
11916
|
+
relativeFilePath: (0, import_node_path88.basename)(path4),
|
|
11659
11917
|
global: this.global
|
|
11660
11918
|
})
|
|
11661
11919
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -11668,7 +11926,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
11668
11926
|
subagentFilePaths.map(
|
|
11669
11927
|
(path4) => factory.class.fromFile({
|
|
11670
11928
|
baseDir: this.baseDir,
|
|
11671
|
-
relativeFilePath: (0,
|
|
11929
|
+
relativeFilePath: (0, import_node_path88.basename)(path4),
|
|
11672
11930
|
global: this.global
|
|
11673
11931
|
})
|
|
11674
11932
|
)
|
|
@@ -11713,49 +11971,49 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
11713
11971
|
};
|
|
11714
11972
|
|
|
11715
11973
|
// src/features/rules/agentsmd-rule.ts
|
|
11716
|
-
var
|
|
11974
|
+
var import_node_path91 = require("path");
|
|
11717
11975
|
|
|
11718
11976
|
// src/features/rules/tool-rule.ts
|
|
11719
|
-
var
|
|
11977
|
+
var import_node_path90 = require("path");
|
|
11720
11978
|
|
|
11721
11979
|
// src/features/rules/rulesync-rule.ts
|
|
11722
|
-
var
|
|
11723
|
-
var
|
|
11724
|
-
var RulesyncRuleFrontmatterSchema =
|
|
11725
|
-
root:
|
|
11726
|
-
localRoot:
|
|
11727
|
-
targets:
|
|
11728
|
-
description:
|
|
11729
|
-
globs:
|
|
11730
|
-
agentsmd:
|
|
11731
|
-
|
|
11980
|
+
var import_node_path89 = require("path");
|
|
11981
|
+
var import_mini47 = require("zod/mini");
|
|
11982
|
+
var RulesyncRuleFrontmatterSchema = import_mini47.z.object({
|
|
11983
|
+
root: import_mini47.z.optional(import_mini47.z.boolean()),
|
|
11984
|
+
localRoot: import_mini47.z.optional(import_mini47.z.boolean()),
|
|
11985
|
+
targets: import_mini47.z._default(RulesyncTargetsSchema, ["*"]),
|
|
11986
|
+
description: import_mini47.z.optional(import_mini47.z.string()),
|
|
11987
|
+
globs: import_mini47.z.optional(import_mini47.z.array(import_mini47.z.string())),
|
|
11988
|
+
agentsmd: import_mini47.z.optional(
|
|
11989
|
+
import_mini47.z.object({
|
|
11732
11990
|
// @example "path/to/subproject"
|
|
11733
|
-
subprojectPath:
|
|
11991
|
+
subprojectPath: import_mini47.z.optional(import_mini47.z.string())
|
|
11734
11992
|
})
|
|
11735
11993
|
),
|
|
11736
|
-
claudecode:
|
|
11737
|
-
|
|
11994
|
+
claudecode: import_mini47.z.optional(
|
|
11995
|
+
import_mini47.z.object({
|
|
11738
11996
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
11739
11997
|
// @example ["src/**/*.ts", "tests/**/*.test.ts"]
|
|
11740
|
-
paths:
|
|
11998
|
+
paths: import_mini47.z.optional(import_mini47.z.array(import_mini47.z.string()))
|
|
11741
11999
|
})
|
|
11742
12000
|
),
|
|
11743
|
-
cursor:
|
|
11744
|
-
|
|
11745
|
-
alwaysApply:
|
|
11746
|
-
description:
|
|
11747
|
-
globs:
|
|
12001
|
+
cursor: import_mini47.z.optional(
|
|
12002
|
+
import_mini47.z.object({
|
|
12003
|
+
alwaysApply: import_mini47.z.optional(import_mini47.z.boolean()),
|
|
12004
|
+
description: import_mini47.z.optional(import_mini47.z.string()),
|
|
12005
|
+
globs: import_mini47.z.optional(import_mini47.z.array(import_mini47.z.string()))
|
|
11748
12006
|
})
|
|
11749
12007
|
),
|
|
11750
|
-
copilot:
|
|
11751
|
-
|
|
11752
|
-
excludeAgent:
|
|
12008
|
+
copilot: import_mini47.z.optional(
|
|
12009
|
+
import_mini47.z.object({
|
|
12010
|
+
excludeAgent: import_mini47.z.optional(import_mini47.z.union([import_mini47.z.literal("code-review"), import_mini47.z.literal("coding-agent")]))
|
|
11753
12011
|
})
|
|
11754
12012
|
),
|
|
11755
|
-
antigravity:
|
|
11756
|
-
|
|
11757
|
-
trigger:
|
|
11758
|
-
globs:
|
|
12013
|
+
antigravity: import_mini47.z.optional(
|
|
12014
|
+
import_mini47.z.looseObject({
|
|
12015
|
+
trigger: import_mini47.z.optional(import_mini47.z.string()),
|
|
12016
|
+
globs: import_mini47.z.optional(import_mini47.z.array(import_mini47.z.string()))
|
|
11759
12017
|
})
|
|
11760
12018
|
)
|
|
11761
12019
|
});
|
|
@@ -11766,7 +12024,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
11766
12024
|
const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
11767
12025
|
if (!parseResult.success && rest.validate !== false) {
|
|
11768
12026
|
throw new Error(
|
|
11769
|
-
`Invalid frontmatter in ${(0,
|
|
12027
|
+
`Invalid frontmatter in ${(0, import_node_path89.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
11770
12028
|
);
|
|
11771
12029
|
}
|
|
11772
12030
|
const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
|
|
@@ -11801,7 +12059,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
11801
12059
|
return {
|
|
11802
12060
|
success: false,
|
|
11803
12061
|
error: new Error(
|
|
11804
|
-
`Invalid frontmatter in ${(0,
|
|
12062
|
+
`Invalid frontmatter in ${(0, import_node_path89.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11805
12063
|
)
|
|
11806
12064
|
};
|
|
11807
12065
|
}
|
|
@@ -11810,7 +12068,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
11810
12068
|
relativeFilePath,
|
|
11811
12069
|
validate = true
|
|
11812
12070
|
}) {
|
|
11813
|
-
const filePath = (0,
|
|
12071
|
+
const filePath = (0, import_node_path89.join)(
|
|
11814
12072
|
process.cwd(),
|
|
11815
12073
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
11816
12074
|
relativeFilePath
|
|
@@ -11912,7 +12170,7 @@ var ToolRule = class extends ToolFile {
|
|
|
11912
12170
|
rulesyncRule,
|
|
11913
12171
|
validate = true,
|
|
11914
12172
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
11915
|
-
nonRootPath = { relativeDirPath: (0,
|
|
12173
|
+
nonRootPath = { relativeDirPath: (0, import_node_path90.join)(".agents", "memories") }
|
|
11916
12174
|
}) {
|
|
11917
12175
|
const params = this.buildToolRuleParamsDefault({
|
|
11918
12176
|
baseDir,
|
|
@@ -11923,7 +12181,7 @@ var ToolRule = class extends ToolFile {
|
|
|
11923
12181
|
});
|
|
11924
12182
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
11925
12183
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
11926
|
-
params.relativeDirPath = (0,
|
|
12184
|
+
params.relativeDirPath = (0, import_node_path90.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
11927
12185
|
params.relativeFilePath = "AGENTS.md";
|
|
11928
12186
|
}
|
|
11929
12187
|
return params;
|
|
@@ -11972,7 +12230,7 @@ var ToolRule = class extends ToolFile {
|
|
|
11972
12230
|
}
|
|
11973
12231
|
};
|
|
11974
12232
|
function buildToolPath(toolDir, subDir, excludeToolDir) {
|
|
11975
|
-
return excludeToolDir ? subDir : (0,
|
|
12233
|
+
return excludeToolDir ? subDir : (0, import_node_path90.join)(toolDir, subDir);
|
|
11976
12234
|
}
|
|
11977
12235
|
|
|
11978
12236
|
// src/features/rules/agentsmd-rule.ts
|
|
@@ -12001,8 +12259,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
12001
12259
|
validate = true
|
|
12002
12260
|
}) {
|
|
12003
12261
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
12004
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
12005
|
-
const fileContent = await readFileContent((0,
|
|
12262
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path91.join)(".agents", "memories", relativeFilePath);
|
|
12263
|
+
const fileContent = await readFileContent((0, import_node_path91.join)(baseDir, relativePath));
|
|
12006
12264
|
return new _AgentsMdRule({
|
|
12007
12265
|
baseDir,
|
|
12008
12266
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -12057,21 +12315,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
12057
12315
|
};
|
|
12058
12316
|
|
|
12059
12317
|
// src/features/rules/antigravity-rule.ts
|
|
12060
|
-
var
|
|
12061
|
-
var
|
|
12062
|
-
var AntigravityRuleFrontmatterSchema =
|
|
12063
|
-
trigger:
|
|
12064
|
-
|
|
12065
|
-
|
|
12066
|
-
|
|
12067
|
-
|
|
12068
|
-
|
|
12069
|
-
|
|
12318
|
+
var import_node_path92 = require("path");
|
|
12319
|
+
var import_mini48 = require("zod/mini");
|
|
12320
|
+
var AntigravityRuleFrontmatterSchema = import_mini48.z.looseObject({
|
|
12321
|
+
trigger: import_mini48.z.optional(
|
|
12322
|
+
import_mini48.z.union([
|
|
12323
|
+
import_mini48.z.literal("always_on"),
|
|
12324
|
+
import_mini48.z.literal("glob"),
|
|
12325
|
+
import_mini48.z.literal("manual"),
|
|
12326
|
+
import_mini48.z.literal("model_decision"),
|
|
12327
|
+
import_mini48.z.string()
|
|
12070
12328
|
// accepts any string for forward compatibility
|
|
12071
12329
|
])
|
|
12072
12330
|
),
|
|
12073
|
-
globs:
|
|
12074
|
-
description:
|
|
12331
|
+
globs: import_mini48.z.optional(import_mini48.z.string()),
|
|
12332
|
+
description: import_mini48.z.optional(import_mini48.z.string())
|
|
12075
12333
|
});
|
|
12076
12334
|
function parseGlobsString(globs) {
|
|
12077
12335
|
if (!globs) {
|
|
@@ -12216,7 +12474,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
12216
12474
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12217
12475
|
if (!result.success) {
|
|
12218
12476
|
throw new Error(
|
|
12219
|
-
`Invalid frontmatter in ${(0,
|
|
12477
|
+
`Invalid frontmatter in ${(0, import_node_path92.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12220
12478
|
);
|
|
12221
12479
|
}
|
|
12222
12480
|
}
|
|
@@ -12240,7 +12498,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
12240
12498
|
relativeFilePath,
|
|
12241
12499
|
validate = true
|
|
12242
12500
|
}) {
|
|
12243
|
-
const filePath = (0,
|
|
12501
|
+
const filePath = (0, import_node_path92.join)(
|
|
12244
12502
|
baseDir,
|
|
12245
12503
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
12246
12504
|
relativeFilePath
|
|
@@ -12381,7 +12639,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
12381
12639
|
};
|
|
12382
12640
|
|
|
12383
12641
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
12384
|
-
var
|
|
12642
|
+
var import_node_path93 = require("path");
|
|
12385
12643
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
12386
12644
|
toRulesyncRule() {
|
|
12387
12645
|
const rulesyncFrontmatter = {
|
|
@@ -12442,8 +12700,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
12442
12700
|
}) {
|
|
12443
12701
|
const settablePaths = this.getSettablePaths();
|
|
12444
12702
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
12445
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
12446
|
-
const fileContent = await readFileContent((0,
|
|
12703
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path93.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
12704
|
+
const fileContent = await readFileContent((0, import_node_path93.join)(baseDir, relativePath));
|
|
12447
12705
|
return new _AugmentcodeLegacyRule({
|
|
12448
12706
|
baseDir,
|
|
12449
12707
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -12472,7 +12730,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
12472
12730
|
};
|
|
12473
12731
|
|
|
12474
12732
|
// src/features/rules/augmentcode-rule.ts
|
|
12475
|
-
var
|
|
12733
|
+
var import_node_path94 = require("path");
|
|
12476
12734
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
12477
12735
|
toRulesyncRule() {
|
|
12478
12736
|
return this.toRulesyncRuleDefault();
|
|
@@ -12503,7 +12761,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
12503
12761
|
relativeFilePath,
|
|
12504
12762
|
validate = true
|
|
12505
12763
|
}) {
|
|
12506
|
-
const filePath = (0,
|
|
12764
|
+
const filePath = (0, import_node_path94.join)(
|
|
12507
12765
|
baseDir,
|
|
12508
12766
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
12509
12767
|
relativeFilePath
|
|
@@ -12543,7 +12801,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
12543
12801
|
};
|
|
12544
12802
|
|
|
12545
12803
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
12546
|
-
var
|
|
12804
|
+
var import_node_path95 = require("path");
|
|
12547
12805
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
12548
12806
|
static getSettablePaths({
|
|
12549
12807
|
global,
|
|
@@ -12578,7 +12836,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
12578
12836
|
if (isRoot) {
|
|
12579
12837
|
const relativePath2 = paths.root.relativeFilePath;
|
|
12580
12838
|
const fileContent2 = await readFileContent(
|
|
12581
|
-
(0,
|
|
12839
|
+
(0, import_node_path95.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
12582
12840
|
);
|
|
12583
12841
|
return new _ClaudecodeLegacyRule({
|
|
12584
12842
|
baseDir,
|
|
@@ -12592,8 +12850,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
12592
12850
|
if (!paths.nonRoot) {
|
|
12593
12851
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
12594
12852
|
}
|
|
12595
|
-
const relativePath = (0,
|
|
12596
|
-
const fileContent = await readFileContent((0,
|
|
12853
|
+
const relativePath = (0, import_node_path95.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
12854
|
+
const fileContent = await readFileContent((0, import_node_path95.join)(baseDir, relativePath));
|
|
12597
12855
|
return new _ClaudecodeLegacyRule({
|
|
12598
12856
|
baseDir,
|
|
12599
12857
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -12652,10 +12910,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
12652
12910
|
};
|
|
12653
12911
|
|
|
12654
12912
|
// src/features/rules/claudecode-rule.ts
|
|
12655
|
-
var
|
|
12656
|
-
var
|
|
12657
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
12658
|
-
paths:
|
|
12913
|
+
var import_node_path96 = require("path");
|
|
12914
|
+
var import_mini49 = require("zod/mini");
|
|
12915
|
+
var ClaudecodeRuleFrontmatterSchema = import_mini49.z.object({
|
|
12916
|
+
paths: import_mini49.z.optional(import_mini49.z.array(import_mini49.z.string()))
|
|
12659
12917
|
});
|
|
12660
12918
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
12661
12919
|
frontmatter;
|
|
@@ -12687,7 +12945,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
12687
12945
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12688
12946
|
if (!result.success) {
|
|
12689
12947
|
throw new Error(
|
|
12690
|
-
`Invalid frontmatter in ${(0,
|
|
12948
|
+
`Invalid frontmatter in ${(0, import_node_path96.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12691
12949
|
);
|
|
12692
12950
|
}
|
|
12693
12951
|
}
|
|
@@ -12715,7 +12973,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
12715
12973
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
12716
12974
|
if (isRoot) {
|
|
12717
12975
|
const fileContent2 = await readFileContent(
|
|
12718
|
-
(0,
|
|
12976
|
+
(0, import_node_path96.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
12719
12977
|
);
|
|
12720
12978
|
return new _ClaudecodeRule({
|
|
12721
12979
|
baseDir,
|
|
@@ -12730,16 +12988,16 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
12730
12988
|
if (!paths.nonRoot) {
|
|
12731
12989
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
12732
12990
|
}
|
|
12733
|
-
const relativePath = (0,
|
|
12734
|
-
const fileContent = await readFileContent((0,
|
|
12991
|
+
const relativePath = (0, import_node_path96.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
12992
|
+
const fileContent = await readFileContent((0, import_node_path96.join)(baseDir, relativePath));
|
|
12735
12993
|
const { frontmatter, body: content } = parseFrontmatter(
|
|
12736
12994
|
fileContent,
|
|
12737
|
-
(0,
|
|
12995
|
+
(0, import_node_path96.join)(baseDir, relativePath)
|
|
12738
12996
|
);
|
|
12739
12997
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12740
12998
|
if (!result.success) {
|
|
12741
12999
|
throw new Error(
|
|
12742
|
-
`Invalid frontmatter in ${(0,
|
|
13000
|
+
`Invalid frontmatter in ${(0, import_node_path96.join)(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
12743
13001
|
);
|
|
12744
13002
|
}
|
|
12745
13003
|
return new _ClaudecodeRule({
|
|
@@ -12846,7 +13104,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
12846
13104
|
return {
|
|
12847
13105
|
success: false,
|
|
12848
13106
|
error: new Error(
|
|
12849
|
-
`Invalid frontmatter in ${(0,
|
|
13107
|
+
`Invalid frontmatter in ${(0, import_node_path96.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12850
13108
|
)
|
|
12851
13109
|
};
|
|
12852
13110
|
}
|
|
@@ -12866,10 +13124,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
12866
13124
|
};
|
|
12867
13125
|
|
|
12868
13126
|
// src/features/rules/cline-rule.ts
|
|
12869
|
-
var
|
|
12870
|
-
var
|
|
12871
|
-
var ClineRuleFrontmatterSchema =
|
|
12872
|
-
description:
|
|
13127
|
+
var import_node_path97 = require("path");
|
|
13128
|
+
var import_mini50 = require("zod/mini");
|
|
13129
|
+
var ClineRuleFrontmatterSchema = import_mini50.z.object({
|
|
13130
|
+
description: import_mini50.z.string()
|
|
12873
13131
|
});
|
|
12874
13132
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
12875
13133
|
static getSettablePaths(_options = {}) {
|
|
@@ -12912,7 +13170,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
12912
13170
|
validate = true
|
|
12913
13171
|
}) {
|
|
12914
13172
|
const fileContent = await readFileContent(
|
|
12915
|
-
(0,
|
|
13173
|
+
(0, import_node_path97.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
12916
13174
|
);
|
|
12917
13175
|
return new _ClineRule({
|
|
12918
13176
|
baseDir,
|
|
@@ -12938,7 +13196,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
12938
13196
|
};
|
|
12939
13197
|
|
|
12940
13198
|
// src/features/rules/codexcli-rule.ts
|
|
12941
|
-
var
|
|
13199
|
+
var import_node_path98 = require("path");
|
|
12942
13200
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
12943
13201
|
static getSettablePaths({
|
|
12944
13202
|
global,
|
|
@@ -12973,7 +13231,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
12973
13231
|
if (isRoot) {
|
|
12974
13232
|
const relativePath2 = paths.root.relativeFilePath;
|
|
12975
13233
|
const fileContent2 = await readFileContent(
|
|
12976
|
-
(0,
|
|
13234
|
+
(0, import_node_path98.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
12977
13235
|
);
|
|
12978
13236
|
return new _CodexcliRule({
|
|
12979
13237
|
baseDir,
|
|
@@ -12987,8 +13245,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
12987
13245
|
if (!paths.nonRoot) {
|
|
12988
13246
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
12989
13247
|
}
|
|
12990
|
-
const relativePath = (0,
|
|
12991
|
-
const fileContent = await readFileContent((0,
|
|
13248
|
+
const relativePath = (0, import_node_path98.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13249
|
+
const fileContent = await readFileContent((0, import_node_path98.join)(baseDir, relativePath));
|
|
12992
13250
|
return new _CodexcliRule({
|
|
12993
13251
|
baseDir,
|
|
12994
13252
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13047,12 +13305,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
13047
13305
|
};
|
|
13048
13306
|
|
|
13049
13307
|
// src/features/rules/copilot-rule.ts
|
|
13050
|
-
var
|
|
13051
|
-
var
|
|
13052
|
-
var CopilotRuleFrontmatterSchema =
|
|
13053
|
-
description:
|
|
13054
|
-
applyTo:
|
|
13055
|
-
excludeAgent:
|
|
13308
|
+
var import_node_path99 = require("path");
|
|
13309
|
+
var import_mini51 = require("zod/mini");
|
|
13310
|
+
var CopilotRuleFrontmatterSchema = import_mini51.z.object({
|
|
13311
|
+
description: import_mini51.z.optional(import_mini51.z.string()),
|
|
13312
|
+
applyTo: import_mini51.z.optional(import_mini51.z.string()),
|
|
13313
|
+
excludeAgent: import_mini51.z.optional(import_mini51.z.union([import_mini51.z.literal("code-review"), import_mini51.z.literal("coding-agent")]))
|
|
13056
13314
|
});
|
|
13057
13315
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
13058
13316
|
frontmatter;
|
|
@@ -13081,7 +13339,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13081
13339
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13082
13340
|
if (!result.success) {
|
|
13083
13341
|
throw new Error(
|
|
13084
|
-
`Invalid frontmatter in ${(0,
|
|
13342
|
+
`Invalid frontmatter in ${(0, import_node_path99.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13085
13343
|
);
|
|
13086
13344
|
}
|
|
13087
13345
|
}
|
|
@@ -13171,8 +13429,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13171
13429
|
const paths = this.getSettablePaths({ global });
|
|
13172
13430
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
13173
13431
|
if (isRoot) {
|
|
13174
|
-
const relativePath2 = (0,
|
|
13175
|
-
const fileContent2 = await readFileContent((0,
|
|
13432
|
+
const relativePath2 = (0, import_node_path99.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
13433
|
+
const fileContent2 = await readFileContent((0, import_node_path99.join)(baseDir, relativePath2));
|
|
13176
13434
|
return new _CopilotRule({
|
|
13177
13435
|
baseDir,
|
|
13178
13436
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -13186,16 +13444,16 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13186
13444
|
if (!paths.nonRoot) {
|
|
13187
13445
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13188
13446
|
}
|
|
13189
|
-
const relativePath = (0,
|
|
13190
|
-
const fileContent = await readFileContent((0,
|
|
13447
|
+
const relativePath = (0, import_node_path99.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13448
|
+
const fileContent = await readFileContent((0, import_node_path99.join)(baseDir, relativePath));
|
|
13191
13449
|
const { frontmatter, body: content } = parseFrontmatter(
|
|
13192
13450
|
fileContent,
|
|
13193
|
-
(0,
|
|
13451
|
+
(0, import_node_path99.join)(baseDir, relativePath)
|
|
13194
13452
|
);
|
|
13195
13453
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13196
13454
|
if (!result.success) {
|
|
13197
13455
|
throw new Error(
|
|
13198
|
-
`Invalid frontmatter in ${(0,
|
|
13456
|
+
`Invalid frontmatter in ${(0, import_node_path99.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
13199
13457
|
);
|
|
13200
13458
|
}
|
|
13201
13459
|
return new _CopilotRule({
|
|
@@ -13237,7 +13495,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13237
13495
|
return {
|
|
13238
13496
|
success: false,
|
|
13239
13497
|
error: new Error(
|
|
13240
|
-
`Invalid frontmatter in ${(0,
|
|
13498
|
+
`Invalid frontmatter in ${(0, import_node_path99.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13241
13499
|
)
|
|
13242
13500
|
};
|
|
13243
13501
|
}
|
|
@@ -13257,12 +13515,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13257
13515
|
};
|
|
13258
13516
|
|
|
13259
13517
|
// src/features/rules/cursor-rule.ts
|
|
13260
|
-
var
|
|
13261
|
-
var
|
|
13262
|
-
var CursorRuleFrontmatterSchema =
|
|
13263
|
-
description:
|
|
13264
|
-
globs:
|
|
13265
|
-
alwaysApply:
|
|
13518
|
+
var import_node_path100 = require("path");
|
|
13519
|
+
var import_mini52 = require("zod/mini");
|
|
13520
|
+
var CursorRuleFrontmatterSchema = import_mini52.z.object({
|
|
13521
|
+
description: import_mini52.z.optional(import_mini52.z.string()),
|
|
13522
|
+
globs: import_mini52.z.optional(import_mini52.z.string()),
|
|
13523
|
+
alwaysApply: import_mini52.z.optional(import_mini52.z.boolean())
|
|
13266
13524
|
});
|
|
13267
13525
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
13268
13526
|
frontmatter;
|
|
@@ -13279,7 +13537,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13279
13537
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13280
13538
|
if (!result.success) {
|
|
13281
13539
|
throw new Error(
|
|
13282
|
-
`Invalid frontmatter in ${(0,
|
|
13540
|
+
`Invalid frontmatter in ${(0, import_node_path100.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13283
13541
|
);
|
|
13284
13542
|
}
|
|
13285
13543
|
}
|
|
@@ -13395,7 +13653,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13395
13653
|
relativeFilePath,
|
|
13396
13654
|
validate = true
|
|
13397
13655
|
}) {
|
|
13398
|
-
const filePath = (0,
|
|
13656
|
+
const filePath = (0, import_node_path100.join)(
|
|
13399
13657
|
baseDir,
|
|
13400
13658
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13401
13659
|
relativeFilePath
|
|
@@ -13405,7 +13663,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13405
13663
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13406
13664
|
if (!result.success) {
|
|
13407
13665
|
throw new Error(
|
|
13408
|
-
`Invalid frontmatter in ${(0,
|
|
13666
|
+
`Invalid frontmatter in ${(0, import_node_path100.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
13409
13667
|
);
|
|
13410
13668
|
}
|
|
13411
13669
|
return new _CursorRule({
|
|
@@ -13442,7 +13700,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13442
13700
|
return {
|
|
13443
13701
|
success: false,
|
|
13444
13702
|
error: new Error(
|
|
13445
|
-
`Invalid frontmatter in ${(0,
|
|
13703
|
+
`Invalid frontmatter in ${(0, import_node_path100.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13446
13704
|
)
|
|
13447
13705
|
};
|
|
13448
13706
|
}
|
|
@@ -13462,7 +13720,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13462
13720
|
};
|
|
13463
13721
|
|
|
13464
13722
|
// src/features/rules/factorydroid-rule.ts
|
|
13465
|
-
var
|
|
13723
|
+
var import_node_path101 = require("path");
|
|
13466
13724
|
var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
13467
13725
|
constructor({ fileContent, root, ...rest }) {
|
|
13468
13726
|
super({
|
|
@@ -13502,8 +13760,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
13502
13760
|
const paths = this.getSettablePaths({ global });
|
|
13503
13761
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
13504
13762
|
if (isRoot) {
|
|
13505
|
-
const relativePath2 = (0,
|
|
13506
|
-
const fileContent2 = await readFileContent((0,
|
|
13763
|
+
const relativePath2 = (0, import_node_path101.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
13764
|
+
const fileContent2 = await readFileContent((0, import_node_path101.join)(baseDir, relativePath2));
|
|
13507
13765
|
return new _FactorydroidRule({
|
|
13508
13766
|
baseDir,
|
|
13509
13767
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -13516,8 +13774,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
13516
13774
|
if (!paths.nonRoot) {
|
|
13517
13775
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13518
13776
|
}
|
|
13519
|
-
const relativePath = (0,
|
|
13520
|
-
const fileContent = await readFileContent((0,
|
|
13777
|
+
const relativePath = (0, import_node_path101.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13778
|
+
const fileContent = await readFileContent((0, import_node_path101.join)(baseDir, relativePath));
|
|
13521
13779
|
return new _FactorydroidRule({
|
|
13522
13780
|
baseDir,
|
|
13523
13781
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13576,7 +13834,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
13576
13834
|
};
|
|
13577
13835
|
|
|
13578
13836
|
// src/features/rules/geminicli-rule.ts
|
|
13579
|
-
var
|
|
13837
|
+
var import_node_path102 = require("path");
|
|
13580
13838
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
13581
13839
|
static getSettablePaths({
|
|
13582
13840
|
global,
|
|
@@ -13611,7 +13869,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
13611
13869
|
if (isRoot) {
|
|
13612
13870
|
const relativePath2 = paths.root.relativeFilePath;
|
|
13613
13871
|
const fileContent2 = await readFileContent(
|
|
13614
|
-
(0,
|
|
13872
|
+
(0, import_node_path102.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
13615
13873
|
);
|
|
13616
13874
|
return new _GeminiCliRule({
|
|
13617
13875
|
baseDir,
|
|
@@ -13625,8 +13883,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
13625
13883
|
if (!paths.nonRoot) {
|
|
13626
13884
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13627
13885
|
}
|
|
13628
|
-
const relativePath = (0,
|
|
13629
|
-
const fileContent = await readFileContent((0,
|
|
13886
|
+
const relativePath = (0, import_node_path102.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13887
|
+
const fileContent = await readFileContent((0, import_node_path102.join)(baseDir, relativePath));
|
|
13630
13888
|
return new _GeminiCliRule({
|
|
13631
13889
|
baseDir,
|
|
13632
13890
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13685,7 +13943,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
13685
13943
|
};
|
|
13686
13944
|
|
|
13687
13945
|
// src/features/rules/goose-rule.ts
|
|
13688
|
-
var
|
|
13946
|
+
var import_node_path103 = require("path");
|
|
13689
13947
|
var GooseRule = class _GooseRule extends ToolRule {
|
|
13690
13948
|
static getSettablePaths({
|
|
13691
13949
|
global,
|
|
@@ -13720,7 +13978,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
13720
13978
|
if (isRoot) {
|
|
13721
13979
|
const relativePath2 = paths.root.relativeFilePath;
|
|
13722
13980
|
const fileContent2 = await readFileContent(
|
|
13723
|
-
(0,
|
|
13981
|
+
(0, import_node_path103.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
13724
13982
|
);
|
|
13725
13983
|
return new _GooseRule({
|
|
13726
13984
|
baseDir,
|
|
@@ -13734,8 +13992,8 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
13734
13992
|
if (!paths.nonRoot) {
|
|
13735
13993
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13736
13994
|
}
|
|
13737
|
-
const relativePath = (0,
|
|
13738
|
-
const fileContent = await readFileContent((0,
|
|
13995
|
+
const relativePath = (0, import_node_path103.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13996
|
+
const fileContent = await readFileContent((0, import_node_path103.join)(baseDir, relativePath));
|
|
13739
13997
|
return new _GooseRule({
|
|
13740
13998
|
baseDir,
|
|
13741
13999
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13794,7 +14052,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
13794
14052
|
};
|
|
13795
14053
|
|
|
13796
14054
|
// src/features/rules/junie-rule.ts
|
|
13797
|
-
var
|
|
14055
|
+
var import_node_path104 = require("path");
|
|
13798
14056
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
13799
14057
|
static getSettablePaths(_options = {}) {
|
|
13800
14058
|
return {
|
|
@@ -13813,8 +14071,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
13813
14071
|
validate = true
|
|
13814
14072
|
}) {
|
|
13815
14073
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
13816
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
13817
|
-
const fileContent = await readFileContent((0,
|
|
14074
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path104.join)(".junie", "memories", relativeFilePath);
|
|
14075
|
+
const fileContent = await readFileContent((0, import_node_path104.join)(baseDir, relativePath));
|
|
13818
14076
|
return new _JunieRule({
|
|
13819
14077
|
baseDir,
|
|
13820
14078
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -13869,7 +14127,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
13869
14127
|
};
|
|
13870
14128
|
|
|
13871
14129
|
// src/features/rules/kilo-rule.ts
|
|
13872
|
-
var
|
|
14130
|
+
var import_node_path105 = require("path");
|
|
13873
14131
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
13874
14132
|
static getSettablePaths(_options = {}) {
|
|
13875
14133
|
return {
|
|
@@ -13884,7 +14142,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
13884
14142
|
validate = true
|
|
13885
14143
|
}) {
|
|
13886
14144
|
const fileContent = await readFileContent(
|
|
13887
|
-
(0,
|
|
14145
|
+
(0, import_node_path105.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
13888
14146
|
);
|
|
13889
14147
|
return new _KiloRule({
|
|
13890
14148
|
baseDir,
|
|
@@ -13936,7 +14194,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
13936
14194
|
};
|
|
13937
14195
|
|
|
13938
14196
|
// src/features/rules/kiro-rule.ts
|
|
13939
|
-
var
|
|
14197
|
+
var import_node_path106 = require("path");
|
|
13940
14198
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
13941
14199
|
static getSettablePaths(_options = {}) {
|
|
13942
14200
|
return {
|
|
@@ -13951,7 +14209,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
13951
14209
|
validate = true
|
|
13952
14210
|
}) {
|
|
13953
14211
|
const fileContent = await readFileContent(
|
|
13954
|
-
(0,
|
|
14212
|
+
(0, import_node_path106.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
13955
14213
|
);
|
|
13956
14214
|
return new _KiroRule({
|
|
13957
14215
|
baseDir,
|
|
@@ -14005,7 +14263,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
14005
14263
|
};
|
|
14006
14264
|
|
|
14007
14265
|
// src/features/rules/opencode-rule.ts
|
|
14008
|
-
var
|
|
14266
|
+
var import_node_path107 = require("path");
|
|
14009
14267
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
14010
14268
|
static getSettablePaths({
|
|
14011
14269
|
global,
|
|
@@ -14040,7 +14298,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
14040
14298
|
if (isRoot) {
|
|
14041
14299
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14042
14300
|
const fileContent2 = await readFileContent(
|
|
14043
|
-
(0,
|
|
14301
|
+
(0, import_node_path107.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14044
14302
|
);
|
|
14045
14303
|
return new _OpenCodeRule({
|
|
14046
14304
|
baseDir,
|
|
@@ -14054,8 +14312,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
14054
14312
|
if (!paths.nonRoot) {
|
|
14055
14313
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14056
14314
|
}
|
|
14057
|
-
const relativePath = (0,
|
|
14058
|
-
const fileContent = await readFileContent((0,
|
|
14315
|
+
const relativePath = (0, import_node_path107.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14316
|
+
const fileContent = await readFileContent((0, import_node_path107.join)(baseDir, relativePath));
|
|
14059
14317
|
return new _OpenCodeRule({
|
|
14060
14318
|
baseDir,
|
|
14061
14319
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14114,7 +14372,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
14114
14372
|
};
|
|
14115
14373
|
|
|
14116
14374
|
// src/features/rules/qwencode-rule.ts
|
|
14117
|
-
var
|
|
14375
|
+
var import_node_path108 = require("path");
|
|
14118
14376
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
14119
14377
|
static getSettablePaths(_options = {}) {
|
|
14120
14378
|
return {
|
|
@@ -14133,8 +14391,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
14133
14391
|
validate = true
|
|
14134
14392
|
}) {
|
|
14135
14393
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
14136
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
14137
|
-
const fileContent = await readFileContent((0,
|
|
14394
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path108.join)(".qwen", "memories", relativeFilePath);
|
|
14395
|
+
const fileContent = await readFileContent((0, import_node_path108.join)(baseDir, relativePath));
|
|
14138
14396
|
return new _QwencodeRule({
|
|
14139
14397
|
baseDir,
|
|
14140
14398
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -14186,7 +14444,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
14186
14444
|
};
|
|
14187
14445
|
|
|
14188
14446
|
// src/features/rules/replit-rule.ts
|
|
14189
|
-
var
|
|
14447
|
+
var import_node_path109 = require("path");
|
|
14190
14448
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
14191
14449
|
static getSettablePaths(_options = {}) {
|
|
14192
14450
|
return {
|
|
@@ -14208,7 +14466,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
14208
14466
|
}
|
|
14209
14467
|
const relativePath = paths.root.relativeFilePath;
|
|
14210
14468
|
const fileContent = await readFileContent(
|
|
14211
|
-
(0,
|
|
14469
|
+
(0, import_node_path109.join)(baseDir, paths.root.relativeDirPath, relativePath)
|
|
14212
14470
|
);
|
|
14213
14471
|
return new _ReplitRule({
|
|
14214
14472
|
baseDir,
|
|
@@ -14274,7 +14532,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
14274
14532
|
};
|
|
14275
14533
|
|
|
14276
14534
|
// src/features/rules/roo-rule.ts
|
|
14277
|
-
var
|
|
14535
|
+
var import_node_path110 = require("path");
|
|
14278
14536
|
var RooRule = class _RooRule extends ToolRule {
|
|
14279
14537
|
static getSettablePaths(_options = {}) {
|
|
14280
14538
|
return {
|
|
@@ -14289,7 +14547,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
14289
14547
|
validate = true
|
|
14290
14548
|
}) {
|
|
14291
14549
|
const fileContent = await readFileContent(
|
|
14292
|
-
(0,
|
|
14550
|
+
(0, import_node_path110.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14293
14551
|
);
|
|
14294
14552
|
return new _RooRule({
|
|
14295
14553
|
baseDir,
|
|
@@ -14358,7 +14616,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
14358
14616
|
};
|
|
14359
14617
|
|
|
14360
14618
|
// src/features/rules/warp-rule.ts
|
|
14361
|
-
var
|
|
14619
|
+
var import_node_path111 = require("path");
|
|
14362
14620
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
14363
14621
|
constructor({ fileContent, root, ...rest }) {
|
|
14364
14622
|
super({
|
|
@@ -14384,8 +14642,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
14384
14642
|
validate = true
|
|
14385
14643
|
}) {
|
|
14386
14644
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
14387
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
14388
|
-
const fileContent = await readFileContent((0,
|
|
14645
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path111.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
14646
|
+
const fileContent = await readFileContent((0, import_node_path111.join)(baseDir, relativePath));
|
|
14389
14647
|
return new _WarpRule({
|
|
14390
14648
|
baseDir,
|
|
14391
14649
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -14440,7 +14698,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
14440
14698
|
};
|
|
14441
14699
|
|
|
14442
14700
|
// src/features/rules/windsurf-rule.ts
|
|
14443
|
-
var
|
|
14701
|
+
var import_node_path112 = require("path");
|
|
14444
14702
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
14445
14703
|
static getSettablePaths(_options = {}) {
|
|
14446
14704
|
return {
|
|
@@ -14455,7 +14713,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
14455
14713
|
validate = true
|
|
14456
14714
|
}) {
|
|
14457
14715
|
const fileContent = await readFileContent(
|
|
14458
|
-
(0,
|
|
14716
|
+
(0, import_node_path112.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14459
14717
|
);
|
|
14460
14718
|
return new _WindsurfRule({
|
|
14461
14719
|
baseDir,
|
|
@@ -14531,8 +14789,8 @@ var rulesProcessorToolTargets = [
|
|
|
14531
14789
|
"warp",
|
|
14532
14790
|
"windsurf"
|
|
14533
14791
|
];
|
|
14534
|
-
var RulesProcessorToolTargetSchema =
|
|
14535
|
-
var formatRulePaths = (rules) => rules.map((r) => (0,
|
|
14792
|
+
var RulesProcessorToolTargetSchema = import_mini53.z.enum(rulesProcessorToolTargets);
|
|
14793
|
+
var formatRulePaths = (rules) => rules.map((r) => (0, import_node_path113.join)(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
14536
14794
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
14537
14795
|
[
|
|
14538
14796
|
"agentsmd",
|
|
@@ -14907,7 +15165,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14907
15165
|
}).relativeDirPath;
|
|
14908
15166
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
14909
15167
|
const frontmatter = skill.getFrontmatter();
|
|
14910
|
-
const relativePath = (0,
|
|
15168
|
+
const relativePath = (0, import_node_path113.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
14911
15169
|
return {
|
|
14912
15170
|
name: frontmatter.name,
|
|
14913
15171
|
description: frontmatter.description,
|
|
@@ -15020,12 +15278,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15020
15278
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
15021
15279
|
*/
|
|
15022
15280
|
async loadRulesyncFiles() {
|
|
15023
|
-
const rulesyncBaseDir = (0,
|
|
15024
|
-
const files = await findFilesByGlobs((0,
|
|
15281
|
+
const rulesyncBaseDir = (0, import_node_path113.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
15282
|
+
const files = await findFilesByGlobs((0, import_node_path113.join)(rulesyncBaseDir, "**", "*.md"));
|
|
15025
15283
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
15026
15284
|
const rulesyncRules = await Promise.all(
|
|
15027
15285
|
files.map((file) => {
|
|
15028
|
-
const relativeFilePath = (0,
|
|
15286
|
+
const relativeFilePath = (0, import_node_path113.relative)(rulesyncBaseDir, file);
|
|
15029
15287
|
checkPathTraversal({
|
|
15030
15288
|
relativePath: relativeFilePath,
|
|
15031
15289
|
intendedRootDir: rulesyncBaseDir
|
|
@@ -15088,7 +15346,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15088
15346
|
return [];
|
|
15089
15347
|
}
|
|
15090
15348
|
const rootFilePaths = await findFilesByGlobs(
|
|
15091
|
-
(0,
|
|
15349
|
+
(0, import_node_path113.join)(
|
|
15092
15350
|
this.baseDir,
|
|
15093
15351
|
settablePaths.root.relativeDirPath ?? ".",
|
|
15094
15352
|
settablePaths.root.relativeFilePath
|
|
@@ -15099,7 +15357,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15099
15357
|
(filePath) => factory.class.forDeletion({
|
|
15100
15358
|
baseDir: this.baseDir,
|
|
15101
15359
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
15102
|
-
relativeFilePath: (0,
|
|
15360
|
+
relativeFilePath: (0, import_node_path113.basename)(filePath),
|
|
15103
15361
|
global: this.global
|
|
15104
15362
|
})
|
|
15105
15363
|
).filter((rule) => rule.isDeletable());
|
|
@@ -15108,7 +15366,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15108
15366
|
rootFilePaths.map(
|
|
15109
15367
|
(filePath) => factory.class.fromFile({
|
|
15110
15368
|
baseDir: this.baseDir,
|
|
15111
|
-
relativeFilePath: (0,
|
|
15369
|
+
relativeFilePath: (0, import_node_path113.basename)(filePath),
|
|
15112
15370
|
global: this.global
|
|
15113
15371
|
})
|
|
15114
15372
|
)
|
|
@@ -15126,13 +15384,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15126
15384
|
return [];
|
|
15127
15385
|
}
|
|
15128
15386
|
const localRootFilePaths = await findFilesByGlobs(
|
|
15129
|
-
(0,
|
|
15387
|
+
(0, import_node_path113.join)(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md")
|
|
15130
15388
|
);
|
|
15131
15389
|
return localRootFilePaths.map(
|
|
15132
15390
|
(filePath) => factory.class.forDeletion({
|
|
15133
15391
|
baseDir: this.baseDir,
|
|
15134
15392
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
15135
|
-
relativeFilePath: (0,
|
|
15393
|
+
relativeFilePath: (0, import_node_path113.basename)(filePath),
|
|
15136
15394
|
global: this.global
|
|
15137
15395
|
})
|
|
15138
15396
|
).filter((rule) => rule.isDeletable());
|
|
@@ -15142,13 +15400,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15142
15400
|
if (!settablePaths.nonRoot) {
|
|
15143
15401
|
return [];
|
|
15144
15402
|
}
|
|
15145
|
-
const nonRootBaseDir = (0,
|
|
15403
|
+
const nonRootBaseDir = (0, import_node_path113.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
15146
15404
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
15147
|
-
(0,
|
|
15405
|
+
(0, import_node_path113.join)(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
15148
15406
|
);
|
|
15149
15407
|
if (forDeletion) {
|
|
15150
15408
|
return nonRootFilePaths.map((filePath) => {
|
|
15151
|
-
const relativeFilePath = (0,
|
|
15409
|
+
const relativeFilePath = (0, import_node_path113.relative)(nonRootBaseDir, filePath);
|
|
15152
15410
|
checkPathTraversal({
|
|
15153
15411
|
relativePath: relativeFilePath,
|
|
15154
15412
|
intendedRootDir: nonRootBaseDir
|
|
@@ -15163,7 +15421,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15163
15421
|
}
|
|
15164
15422
|
return await Promise.all(
|
|
15165
15423
|
nonRootFilePaths.map((filePath) => {
|
|
15166
|
-
const relativeFilePath = (0,
|
|
15424
|
+
const relativeFilePath = (0, import_node_path113.relative)(nonRootBaseDir, filePath);
|
|
15167
15425
|
checkPathTraversal({
|
|
15168
15426
|
relativePath: relativeFilePath,
|
|
15169
15427
|
intendedRootDir: nonRootBaseDir
|
|
@@ -15276,14 +15534,14 @@ s/<command> [arguments]
|
|
|
15276
15534
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
15277
15535
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
15278
15536
|
|
|
15279
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
15537
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path113.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
15280
15538
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
15281
15539
|
|
|
15282
15540
|
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.
|
|
15283
15541
|
|
|
15284
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
15542
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path113.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
15285
15543
|
|
|
15286
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
15544
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path113.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
15287
15545
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
15288
15546
|
const result = [
|
|
15289
15547
|
overview,
|
|
@@ -15315,51 +15573,51 @@ var import_request_error = require("@octokit/request-error");
|
|
|
15315
15573
|
var import_rest = require("@octokit/rest");
|
|
15316
15574
|
|
|
15317
15575
|
// src/types/fetch.ts
|
|
15318
|
-
var
|
|
15576
|
+
var import_mini55 = require("zod/mini");
|
|
15319
15577
|
|
|
15320
15578
|
// src/types/fetch-targets.ts
|
|
15321
|
-
var
|
|
15579
|
+
var import_mini54 = require("zod/mini");
|
|
15322
15580
|
var ALL_FETCH_TARGETS = ["rulesync", ...ALL_TOOL_TARGETS];
|
|
15323
|
-
var FetchTargetSchema =
|
|
15581
|
+
var FetchTargetSchema = import_mini54.z.enum(ALL_FETCH_TARGETS);
|
|
15324
15582
|
|
|
15325
15583
|
// src/types/fetch.ts
|
|
15326
|
-
var ConflictStrategySchema =
|
|
15327
|
-
var GitHubFileTypeSchema =
|
|
15328
|
-
var GitHubFileEntrySchema =
|
|
15329
|
-
name:
|
|
15330
|
-
path:
|
|
15331
|
-
sha:
|
|
15332
|
-
size:
|
|
15584
|
+
var ConflictStrategySchema = import_mini55.z.enum(["skip", "overwrite"]);
|
|
15585
|
+
var GitHubFileTypeSchema = import_mini55.z.enum(["file", "dir", "symlink", "submodule"]);
|
|
15586
|
+
var GitHubFileEntrySchema = import_mini55.z.looseObject({
|
|
15587
|
+
name: import_mini55.z.string(),
|
|
15588
|
+
path: import_mini55.z.string(),
|
|
15589
|
+
sha: import_mini55.z.string(),
|
|
15590
|
+
size: import_mini55.z.number(),
|
|
15333
15591
|
type: GitHubFileTypeSchema,
|
|
15334
|
-
download_url:
|
|
15592
|
+
download_url: import_mini55.z.nullable(import_mini55.z.string())
|
|
15335
15593
|
});
|
|
15336
|
-
var FetchOptionsSchema =
|
|
15337
|
-
target:
|
|
15338
|
-
features:
|
|
15339
|
-
ref:
|
|
15340
|
-
path:
|
|
15341
|
-
output:
|
|
15342
|
-
conflict:
|
|
15343
|
-
token:
|
|
15344
|
-
verbose:
|
|
15345
|
-
silent:
|
|
15594
|
+
var FetchOptionsSchema = import_mini55.z.looseObject({
|
|
15595
|
+
target: import_mini55.z.optional(FetchTargetSchema),
|
|
15596
|
+
features: import_mini55.z.optional(import_mini55.z.array(import_mini55.z.enum(ALL_FEATURES_WITH_WILDCARD))),
|
|
15597
|
+
ref: import_mini55.z.optional(import_mini55.z.string()),
|
|
15598
|
+
path: import_mini55.z.optional(import_mini55.z.string()),
|
|
15599
|
+
output: import_mini55.z.optional(import_mini55.z.string()),
|
|
15600
|
+
conflict: import_mini55.z.optional(ConflictStrategySchema),
|
|
15601
|
+
token: import_mini55.z.optional(import_mini55.z.string()),
|
|
15602
|
+
verbose: import_mini55.z.optional(import_mini55.z.boolean()),
|
|
15603
|
+
silent: import_mini55.z.optional(import_mini55.z.boolean())
|
|
15346
15604
|
});
|
|
15347
|
-
var FetchFileStatusSchema =
|
|
15348
|
-
var GitHubRepoInfoSchema =
|
|
15349
|
-
default_branch:
|
|
15350
|
-
private:
|
|
15605
|
+
var FetchFileStatusSchema = import_mini55.z.enum(["created", "overwritten", "skipped"]);
|
|
15606
|
+
var GitHubRepoInfoSchema = import_mini55.z.looseObject({
|
|
15607
|
+
default_branch: import_mini55.z.string(),
|
|
15608
|
+
private: import_mini55.z.boolean()
|
|
15351
15609
|
});
|
|
15352
|
-
var GitHubReleaseAssetSchema =
|
|
15353
|
-
name:
|
|
15354
|
-
browser_download_url:
|
|
15355
|
-
size:
|
|
15610
|
+
var GitHubReleaseAssetSchema = import_mini55.z.looseObject({
|
|
15611
|
+
name: import_mini55.z.string(),
|
|
15612
|
+
browser_download_url: import_mini55.z.string(),
|
|
15613
|
+
size: import_mini55.z.number()
|
|
15356
15614
|
});
|
|
15357
|
-
var GitHubReleaseSchema =
|
|
15358
|
-
tag_name:
|
|
15359
|
-
name:
|
|
15360
|
-
prerelease:
|
|
15361
|
-
draft:
|
|
15362
|
-
assets:
|
|
15615
|
+
var GitHubReleaseSchema = import_mini55.z.looseObject({
|
|
15616
|
+
tag_name: import_mini55.z.string(),
|
|
15617
|
+
name: import_mini55.z.nullable(import_mini55.z.string()),
|
|
15618
|
+
prerelease: import_mini55.z.boolean(),
|
|
15619
|
+
draft: import_mini55.z.boolean(),
|
|
15620
|
+
assets: import_mini55.z.array(GitHubReleaseAssetSchema)
|
|
15363
15621
|
});
|
|
15364
15622
|
|
|
15365
15623
|
// src/lib/github-client.ts
|
|
@@ -15659,9 +15917,9 @@ async function listDirectoryRecursive(params) {
|
|
|
15659
15917
|
}
|
|
15660
15918
|
|
|
15661
15919
|
// src/types/git-provider.ts
|
|
15662
|
-
var
|
|
15920
|
+
var import_mini56 = require("zod/mini");
|
|
15663
15921
|
var ALL_GIT_PROVIDERS = ["github", "gitlab"];
|
|
15664
|
-
var GitProviderSchema =
|
|
15922
|
+
var GitProviderSchema = import_mini56.z.enum(ALL_GIT_PROVIDERS);
|
|
15665
15923
|
|
|
15666
15924
|
// src/lib/source-parser.ts
|
|
15667
15925
|
var GITHUB_HOSTS = /* @__PURE__ */ new Set(["github.com", "www.github.com"]);
|
|
@@ -15786,8 +16044,8 @@ async function processFeatureConversion(params) {
|
|
|
15786
16044
|
}
|
|
15787
16045
|
const rulesyncFiles = await processor.convertToolFilesToRulesyncFiles(toolFiles);
|
|
15788
16046
|
for (const file of rulesyncFiles) {
|
|
15789
|
-
const relativePath = (0,
|
|
15790
|
-
const outputPath = (0,
|
|
16047
|
+
const relativePath = (0, import_node_path114.join)(file.getRelativeDirPath(), file.getRelativeFilePath());
|
|
16048
|
+
const outputPath = (0, import_node_path114.join)(outputDir, relativePath);
|
|
15791
16049
|
await writeFileContent(outputPath, file.getFileContent());
|
|
15792
16050
|
paths.push(relativePath);
|
|
15793
16051
|
}
|
|
@@ -15933,7 +16191,7 @@ async function fetchFiles(params) {
|
|
|
15933
16191
|
skipped: 0
|
|
15934
16192
|
};
|
|
15935
16193
|
}
|
|
15936
|
-
const outputBasePath = (0,
|
|
16194
|
+
const outputBasePath = (0, import_node_path114.join)(baseDir, outputDir);
|
|
15937
16195
|
for (const { relativePath, size } of filesToFetch) {
|
|
15938
16196
|
checkPathTraversal({
|
|
15939
16197
|
relativePath,
|
|
@@ -15943,7 +16201,7 @@ async function fetchFiles(params) {
|
|
|
15943
16201
|
}
|
|
15944
16202
|
const results = await Promise.all(
|
|
15945
16203
|
filesToFetch.map(async ({ remotePath, relativePath }) => {
|
|
15946
|
-
const localPath = (0,
|
|
16204
|
+
const localPath = (0, import_node_path114.join)(outputBasePath, relativePath);
|
|
15947
16205
|
const exists = await fileExists(localPath);
|
|
15948
16206
|
if (exists && conflictStrategy === "skip") {
|
|
15949
16207
|
logger.debug(`Skipping existing file: ${relativePath}`);
|
|
@@ -15985,7 +16243,7 @@ async function collectFeatureFiles(params) {
|
|
|
15985
16243
|
);
|
|
15986
16244
|
const results = await Promise.all(
|
|
15987
16245
|
tasks.map(async ({ featurePath }) => {
|
|
15988
|
-
const fullPath = basePath === "." || basePath === "" ? featurePath : (0,
|
|
16246
|
+
const fullPath = basePath === "." || basePath === "" ? featurePath : (0, import_node_path114.join)(basePath, featurePath);
|
|
15989
16247
|
const collected = [];
|
|
15990
16248
|
try {
|
|
15991
16249
|
if (featurePath.includes(".")) {
|
|
@@ -16085,7 +16343,7 @@ async function fetchAndConvertToolFiles(params) {
|
|
|
16085
16343
|
relativePath: toolRelativePath,
|
|
16086
16344
|
intendedRootDir: tempDir
|
|
16087
16345
|
});
|
|
16088
|
-
const localPath = (0,
|
|
16346
|
+
const localPath = (0, import_node_path114.join)(tempDir, toolRelativePath);
|
|
16089
16347
|
const content = await withSemaphore(
|
|
16090
16348
|
semaphore,
|
|
16091
16349
|
() => client.getFileContent(parsed.owner, parsed.repo, remotePath, ref)
|
|
@@ -16094,7 +16352,7 @@ async function fetchAndConvertToolFiles(params) {
|
|
|
16094
16352
|
logger.debug(`Fetched to temp: ${toolRelativePath}`);
|
|
16095
16353
|
})
|
|
16096
16354
|
);
|
|
16097
|
-
const outputBasePath = (0,
|
|
16355
|
+
const outputBasePath = (0, import_node_path114.join)(baseDir, outputDir);
|
|
16098
16356
|
const { converted, convertedPaths } = await convertFetchedFilesToRulesync({
|
|
16099
16357
|
tempDir,
|
|
16100
16358
|
outputDir: outputBasePath,
|
|
@@ -16167,7 +16425,7 @@ function mapToToolPath(relativePath, toolPaths) {
|
|
|
16167
16425
|
if (relativePath.startsWith("rules/")) {
|
|
16168
16426
|
const restPath = relativePath.substring("rules/".length);
|
|
16169
16427
|
if (toolPaths.rules?.nonRoot) {
|
|
16170
|
-
return (0,
|
|
16428
|
+
return (0, import_node_path114.join)(toolPaths.rules.nonRoot, restPath);
|
|
16171
16429
|
}
|
|
16172
16430
|
}
|
|
16173
16431
|
if (toolPaths.rules?.root && relativePath === toolPaths.rules.root) {
|
|
@@ -16176,19 +16434,19 @@ function mapToToolPath(relativePath, toolPaths) {
|
|
|
16176
16434
|
if (relativePath.startsWith("commands/")) {
|
|
16177
16435
|
const restPath = relativePath.substring("commands/".length);
|
|
16178
16436
|
if (toolPaths.commands) {
|
|
16179
|
-
return (0,
|
|
16437
|
+
return (0, import_node_path114.join)(toolPaths.commands, restPath);
|
|
16180
16438
|
}
|
|
16181
16439
|
}
|
|
16182
16440
|
if (relativePath.startsWith("subagents/")) {
|
|
16183
16441
|
const restPath = relativePath.substring("subagents/".length);
|
|
16184
16442
|
if (toolPaths.subagents) {
|
|
16185
|
-
return (0,
|
|
16443
|
+
return (0, import_node_path114.join)(toolPaths.subagents, restPath);
|
|
16186
16444
|
}
|
|
16187
16445
|
}
|
|
16188
16446
|
if (relativePath.startsWith("skills/")) {
|
|
16189
16447
|
const restPath = relativePath.substring("skills/".length);
|
|
16190
16448
|
if (toolPaths.skills) {
|
|
16191
|
-
return (0,
|
|
16449
|
+
return (0, import_node_path114.join)(toolPaths.skills, restPath);
|
|
16192
16450
|
}
|
|
16193
16451
|
}
|
|
16194
16452
|
return relativePath;
|
|
@@ -16240,38 +16498,38 @@ async function fetchCommand(options) {
|
|
|
16240
16498
|
}
|
|
16241
16499
|
|
|
16242
16500
|
// src/config/config-resolver.ts
|
|
16243
|
-
var
|
|
16244
|
-
var
|
|
16501
|
+
var import_node_path115 = require("path");
|
|
16502
|
+
var import_jsonc_parser2 = require("jsonc-parser");
|
|
16245
16503
|
|
|
16246
16504
|
// src/config/config.ts
|
|
16247
|
-
var
|
|
16248
|
-
var SourceEntrySchema =
|
|
16249
|
-
source:
|
|
16250
|
-
skills: (0,
|
|
16505
|
+
var import_mini57 = require("zod/mini");
|
|
16506
|
+
var SourceEntrySchema = import_mini57.z.object({
|
|
16507
|
+
source: import_mini57.z.string().check((0, import_mini57.minLength)(1, "source must be a non-empty string")),
|
|
16508
|
+
skills: (0, import_mini57.optional)(import_mini57.z.array(import_mini57.z.string()))
|
|
16251
16509
|
});
|
|
16252
|
-
var ConfigParamsSchema =
|
|
16253
|
-
baseDirs:
|
|
16510
|
+
var ConfigParamsSchema = import_mini57.z.object({
|
|
16511
|
+
baseDirs: import_mini57.z.array(import_mini57.z.string()),
|
|
16254
16512
|
targets: RulesyncTargetsSchema,
|
|
16255
16513
|
features: RulesyncFeaturesSchema,
|
|
16256
|
-
verbose:
|
|
16257
|
-
delete:
|
|
16514
|
+
verbose: import_mini57.z.boolean(),
|
|
16515
|
+
delete: import_mini57.z.boolean(),
|
|
16258
16516
|
// New non-experimental options
|
|
16259
|
-
global: (0,
|
|
16260
|
-
silent: (0,
|
|
16261
|
-
simulateCommands: (0,
|
|
16262
|
-
simulateSubagents: (0,
|
|
16263
|
-
simulateSkills: (0,
|
|
16264
|
-
dryRun: (0,
|
|
16265
|
-
check: (0,
|
|
16517
|
+
global: (0, import_mini57.optional)(import_mini57.z.boolean()),
|
|
16518
|
+
silent: (0, import_mini57.optional)(import_mini57.z.boolean()),
|
|
16519
|
+
simulateCommands: (0, import_mini57.optional)(import_mini57.z.boolean()),
|
|
16520
|
+
simulateSubagents: (0, import_mini57.optional)(import_mini57.z.boolean()),
|
|
16521
|
+
simulateSkills: (0, import_mini57.optional)(import_mini57.z.boolean()),
|
|
16522
|
+
dryRun: (0, import_mini57.optional)(import_mini57.z.boolean()),
|
|
16523
|
+
check: (0, import_mini57.optional)(import_mini57.z.boolean()),
|
|
16266
16524
|
// Declarative skill sources
|
|
16267
|
-
sources: (0,
|
|
16525
|
+
sources: (0, import_mini57.optional)(import_mini57.z.array(SourceEntrySchema))
|
|
16268
16526
|
});
|
|
16269
|
-
var PartialConfigParamsSchema =
|
|
16270
|
-
var ConfigFileSchema =
|
|
16271
|
-
$schema: (0,
|
|
16272
|
-
...
|
|
16527
|
+
var PartialConfigParamsSchema = import_mini57.z.partial(ConfigParamsSchema);
|
|
16528
|
+
var ConfigFileSchema = import_mini57.z.object({
|
|
16529
|
+
$schema: (0, import_mini57.optional)(import_mini57.z.string()),
|
|
16530
|
+
...import_mini57.z.partial(ConfigParamsSchema).shape
|
|
16273
16531
|
});
|
|
16274
|
-
var RequiredConfigParamsSchema =
|
|
16532
|
+
var RequiredConfigParamsSchema = import_mini57.z.required(ConfigParamsSchema);
|
|
16275
16533
|
var CONFLICTING_TARGET_PAIRS = [
|
|
16276
16534
|
["augmentcode", "augmentcode-legacy"],
|
|
16277
16535
|
["claudecode", "claudecode-legacy"]
|
|
@@ -16448,7 +16706,7 @@ var loadConfigFromFile = async (filePath) => {
|
|
|
16448
16706
|
}
|
|
16449
16707
|
try {
|
|
16450
16708
|
const fileContent = await readFileContent(filePath);
|
|
16451
|
-
const jsonData = (0,
|
|
16709
|
+
const jsonData = (0, import_jsonc_parser2.parse)(fileContent);
|
|
16452
16710
|
const parsed = ConfigFileSchema.parse(jsonData);
|
|
16453
16711
|
const { $schema: _schema, ...configParams } = parsed;
|
|
16454
16712
|
return configParams;
|
|
@@ -16492,8 +16750,8 @@ var ConfigResolver = class {
|
|
|
16492
16750
|
}) {
|
|
16493
16751
|
const validatedConfigPath = resolvePath(configPath, process.cwd());
|
|
16494
16752
|
const baseConfig = await loadConfigFromFile(validatedConfigPath);
|
|
16495
|
-
const configDir = (0,
|
|
16496
|
-
const localConfigPath = (0,
|
|
16753
|
+
const configDir = (0, import_node_path115.dirname)(validatedConfigPath);
|
|
16754
|
+
const localConfigPath = (0, import_node_path115.join)(configDir, RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH);
|
|
16497
16755
|
const localConfig = await loadConfigFromFile(localConfigPath);
|
|
16498
16756
|
const configByFile = mergeConfigs(baseConfig, localConfig);
|
|
16499
16757
|
const resolvedGlobal = global ?? configByFile.global ?? getDefaults().global;
|
|
@@ -16528,7 +16786,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
16528
16786
|
if (global) {
|
|
16529
16787
|
return [getHomeDirectory()];
|
|
16530
16788
|
}
|
|
16531
|
-
const resolvedBaseDirs = baseDirs.map((baseDir) => (0,
|
|
16789
|
+
const resolvedBaseDirs = baseDirs.map((baseDir) => (0, import_node_path115.resolve)(baseDir));
|
|
16532
16790
|
resolvedBaseDirs.forEach((baseDir) => {
|
|
16533
16791
|
validateBaseDir(baseDir);
|
|
16534
16792
|
});
|
|
@@ -16536,7 +16794,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
16536
16794
|
}
|
|
16537
16795
|
|
|
16538
16796
|
// src/lib/generate.ts
|
|
16539
|
-
var
|
|
16797
|
+
var import_node_path116 = require("path");
|
|
16540
16798
|
var import_es_toolkit4 = require("es-toolkit");
|
|
16541
16799
|
async function processFeatureGeneration(params) {
|
|
16542
16800
|
const { config, processor, toolFiles } = params;
|
|
@@ -16582,7 +16840,7 @@ async function processEmptyFeatureGeneration(params) {
|
|
|
16582
16840
|
return { count: totalCount, paths: [], hasDiff };
|
|
16583
16841
|
}
|
|
16584
16842
|
async function checkRulesyncDirExists(params) {
|
|
16585
|
-
return fileExists((0,
|
|
16843
|
+
return fileExists((0, import_node_path116.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
16586
16844
|
}
|
|
16587
16845
|
async function generate(params) {
|
|
16588
16846
|
const { config } = params;
|
|
@@ -17028,7 +17286,7 @@ async function generateCommand(options) {
|
|
|
17028
17286
|
}
|
|
17029
17287
|
|
|
17030
17288
|
// src/cli/commands/gitignore.ts
|
|
17031
|
-
var
|
|
17289
|
+
var import_node_path117 = require("path");
|
|
17032
17290
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
17033
17291
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
17034
17292
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -17091,6 +17349,7 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
17091
17349
|
"**/.github/prompts/",
|
|
17092
17350
|
"**/.github/agents/",
|
|
17093
17351
|
"**/.github/skills/",
|
|
17352
|
+
"**/.github/hooks/",
|
|
17094
17353
|
"**/.vscode/mcp.json",
|
|
17095
17354
|
// Junie
|
|
17096
17355
|
"**/.junie/guidelines.md",
|
|
@@ -17183,7 +17442,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
17183
17442
|
return result;
|
|
17184
17443
|
};
|
|
17185
17444
|
var gitignoreCommand = async () => {
|
|
17186
|
-
const gitignorePath = (0,
|
|
17445
|
+
const gitignorePath = (0, import_node_path117.join)(process.cwd(), ".gitignore");
|
|
17187
17446
|
let gitignoreContent = "";
|
|
17188
17447
|
if (await fileExists(gitignorePath)) {
|
|
17189
17448
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -17463,7 +17722,7 @@ async function importCommand(options) {
|
|
|
17463
17722
|
}
|
|
17464
17723
|
|
|
17465
17724
|
// src/lib/init.ts
|
|
17466
|
-
var
|
|
17725
|
+
var import_node_path118 = require("path");
|
|
17467
17726
|
async function init() {
|
|
17468
17727
|
const sampleFiles = await createSampleFiles();
|
|
17469
17728
|
const configFile = await createConfigFile();
|
|
@@ -17653,27 +17912,27 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
17653
17912
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
17654
17913
|
await ensureDir(skillPaths.relativeDirPath);
|
|
17655
17914
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
17656
|
-
const ruleFilepath = (0,
|
|
17915
|
+
const ruleFilepath = (0, import_node_path118.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
17657
17916
|
results.push(await writeIfNotExists(ruleFilepath, sampleRuleFile.content));
|
|
17658
|
-
const mcpFilepath = (0,
|
|
17917
|
+
const mcpFilepath = (0, import_node_path118.join)(
|
|
17659
17918
|
mcpPaths.recommended.relativeDirPath,
|
|
17660
17919
|
mcpPaths.recommended.relativeFilePath
|
|
17661
17920
|
);
|
|
17662
17921
|
results.push(await writeIfNotExists(mcpFilepath, sampleMcpFile.content));
|
|
17663
|
-
const commandFilepath = (0,
|
|
17922
|
+
const commandFilepath = (0, import_node_path118.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
17664
17923
|
results.push(await writeIfNotExists(commandFilepath, sampleCommandFile.content));
|
|
17665
|
-
const subagentFilepath = (0,
|
|
17924
|
+
const subagentFilepath = (0, import_node_path118.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
17666
17925
|
results.push(await writeIfNotExists(subagentFilepath, sampleSubagentFile.content));
|
|
17667
|
-
const skillDirPath = (0,
|
|
17926
|
+
const skillDirPath = (0, import_node_path118.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
17668
17927
|
await ensureDir(skillDirPath);
|
|
17669
|
-
const skillFilepath = (0,
|
|
17928
|
+
const skillFilepath = (0, import_node_path118.join)(skillDirPath, SKILL_FILE_NAME);
|
|
17670
17929
|
results.push(await writeIfNotExists(skillFilepath, sampleSkillFile.content));
|
|
17671
|
-
const ignoreFilepath = (0,
|
|
17930
|
+
const ignoreFilepath = (0, import_node_path118.join)(
|
|
17672
17931
|
ignorePaths.recommended.relativeDirPath,
|
|
17673
17932
|
ignorePaths.recommended.relativeFilePath
|
|
17674
17933
|
);
|
|
17675
17934
|
results.push(await writeIfNotExists(ignoreFilepath, sampleIgnoreFile.content));
|
|
17676
|
-
const hooksFilepath = (0,
|
|
17935
|
+
const hooksFilepath = (0, import_node_path118.join)(hooksPaths.relativeDirPath, hooksPaths.relativeFilePath);
|
|
17677
17936
|
results.push(await writeIfNotExists(hooksFilepath, sampleHooksFile.content));
|
|
17678
17937
|
return results;
|
|
17679
17938
|
}
|
|
@@ -17711,33 +17970,33 @@ async function initCommand() {
|
|
|
17711
17970
|
}
|
|
17712
17971
|
|
|
17713
17972
|
// src/lib/sources.ts
|
|
17714
|
-
var
|
|
17973
|
+
var import_node_path120 = require("path");
|
|
17715
17974
|
var import_promise2 = require("es-toolkit/promise");
|
|
17716
17975
|
|
|
17717
17976
|
// src/lib/sources-lock.ts
|
|
17718
17977
|
var import_node_crypto = require("crypto");
|
|
17719
|
-
var
|
|
17720
|
-
var
|
|
17978
|
+
var import_node_path119 = require("path");
|
|
17979
|
+
var import_mini58 = require("zod/mini");
|
|
17721
17980
|
var LOCKFILE_VERSION = 1;
|
|
17722
|
-
var LockedSkillSchema =
|
|
17723
|
-
integrity:
|
|
17981
|
+
var LockedSkillSchema = import_mini58.z.object({
|
|
17982
|
+
integrity: import_mini58.z.string()
|
|
17724
17983
|
});
|
|
17725
|
-
var LockedSourceSchema =
|
|
17726
|
-
requestedRef: (0,
|
|
17727
|
-
resolvedRef:
|
|
17728
|
-
resolvedAt: (0,
|
|
17729
|
-
skills:
|
|
17984
|
+
var LockedSourceSchema = import_mini58.z.object({
|
|
17985
|
+
requestedRef: (0, import_mini58.optional)(import_mini58.z.string()),
|
|
17986
|
+
resolvedRef: import_mini58.z.string(),
|
|
17987
|
+
resolvedAt: (0, import_mini58.optional)(import_mini58.z.string()),
|
|
17988
|
+
skills: import_mini58.z.record(import_mini58.z.string(), LockedSkillSchema)
|
|
17730
17989
|
});
|
|
17731
|
-
var SourcesLockSchema =
|
|
17732
|
-
lockfileVersion:
|
|
17733
|
-
sources:
|
|
17990
|
+
var SourcesLockSchema = import_mini58.z.object({
|
|
17991
|
+
lockfileVersion: import_mini58.z.number(),
|
|
17992
|
+
sources: import_mini58.z.record(import_mini58.z.string(), LockedSourceSchema)
|
|
17734
17993
|
});
|
|
17735
|
-
var LegacyLockedSourceSchema =
|
|
17736
|
-
resolvedRef:
|
|
17737
|
-
skills:
|
|
17994
|
+
var LegacyLockedSourceSchema = import_mini58.z.object({
|
|
17995
|
+
resolvedRef: import_mini58.z.string(),
|
|
17996
|
+
skills: import_mini58.z.array(import_mini58.z.string())
|
|
17738
17997
|
});
|
|
17739
|
-
var LegacySourcesLockSchema =
|
|
17740
|
-
sources:
|
|
17998
|
+
var LegacySourcesLockSchema = import_mini58.z.object({
|
|
17999
|
+
sources: import_mini58.z.record(import_mini58.z.string(), LegacyLockedSourceSchema)
|
|
17741
18000
|
});
|
|
17742
18001
|
function migrateLegacyLock(legacy) {
|
|
17743
18002
|
const sources = {};
|
|
@@ -17760,7 +18019,7 @@ function createEmptyLock() {
|
|
|
17760
18019
|
return { lockfileVersion: LOCKFILE_VERSION, sources: {} };
|
|
17761
18020
|
}
|
|
17762
18021
|
async function readLockFile(params) {
|
|
17763
|
-
const lockPath = (0,
|
|
18022
|
+
const lockPath = (0, import_node_path119.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
|
|
17764
18023
|
if (!await fileExists(lockPath)) {
|
|
17765
18024
|
logger.debug("No sources lockfile found, starting fresh.");
|
|
17766
18025
|
return createEmptyLock();
|
|
@@ -17788,7 +18047,7 @@ async function readLockFile(params) {
|
|
|
17788
18047
|
}
|
|
17789
18048
|
}
|
|
17790
18049
|
async function writeLockFile(params) {
|
|
17791
|
-
const lockPath = (0,
|
|
18050
|
+
const lockPath = (0, import_node_path119.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
|
|
17792
18051
|
const content = JSON.stringify(params.lock, null, 2) + "\n";
|
|
17793
18052
|
await writeFileContent(lockPath, content);
|
|
17794
18053
|
logger.debug(`Wrote sources lockfile to ${lockPath}`);
|
|
@@ -17929,7 +18188,7 @@ async function resolveAndFetchSources(params) {
|
|
|
17929
18188
|
async function checkLockedSkillsExist(curatedDir, skillNames) {
|
|
17930
18189
|
if (skillNames.length === 0) return true;
|
|
17931
18190
|
for (const name of skillNames) {
|
|
17932
|
-
if (!await directoryExists((0,
|
|
18191
|
+
if (!await directoryExists((0, import_node_path120.join)(curatedDir, name))) {
|
|
17933
18192
|
return false;
|
|
17934
18193
|
}
|
|
17935
18194
|
}
|
|
@@ -17959,7 +18218,7 @@ async function fetchSource(params) {
|
|
|
17959
18218
|
ref = resolvedSha;
|
|
17960
18219
|
logger.debug(`Resolved ${sourceKey} ref "${requestedRef}" to SHA: ${resolvedSha}`);
|
|
17961
18220
|
}
|
|
17962
|
-
const curatedDir = (0,
|
|
18221
|
+
const curatedDir = (0, import_node_path120.join)(baseDir, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
17963
18222
|
if (locked && resolvedSha === locked.resolvedRef && !updateSources) {
|
|
17964
18223
|
const allExist = await checkLockedSkillsExist(curatedDir, lockedSkillNames);
|
|
17965
18224
|
if (allExist) {
|
|
@@ -17989,10 +18248,10 @@ async function fetchSource(params) {
|
|
|
17989
18248
|
const semaphore = new import_promise2.Semaphore(FETCH_CONCURRENCY_LIMIT);
|
|
17990
18249
|
const fetchedSkills = {};
|
|
17991
18250
|
if (locked) {
|
|
17992
|
-
const resolvedCuratedDir = (0,
|
|
18251
|
+
const resolvedCuratedDir = (0, import_node_path120.resolve)(curatedDir);
|
|
17993
18252
|
for (const prevSkill of lockedSkillNames) {
|
|
17994
|
-
const prevDir = (0,
|
|
17995
|
-
if (!(0,
|
|
18253
|
+
const prevDir = (0, import_node_path120.join)(curatedDir, prevSkill);
|
|
18254
|
+
if (!(0, import_node_path120.resolve)(prevDir).startsWith(resolvedCuratedDir + import_node_path120.sep)) {
|
|
17996
18255
|
logger.warn(
|
|
17997
18256
|
`Skipping removal of "${prevSkill}": resolved path is outside the curated directory.`
|
|
17998
18257
|
);
|
|
@@ -18042,10 +18301,10 @@ async function fetchSource(params) {
|
|
|
18042
18301
|
const skillFiles = [];
|
|
18043
18302
|
for (const file of files) {
|
|
18044
18303
|
const relativeToSkill = file.path.substring(skillDir.path.length + 1);
|
|
18045
|
-
const localFilePath = (0,
|
|
18304
|
+
const localFilePath = (0, import_node_path120.join)(curatedDir, skillDir.name, relativeToSkill);
|
|
18046
18305
|
checkPathTraversal({
|
|
18047
18306
|
relativePath: relativeToSkill,
|
|
18048
|
-
intendedRootDir: (0,
|
|
18307
|
+
intendedRootDir: (0, import_node_path120.join)(curatedDir, skillDir.name)
|
|
18049
18308
|
});
|
|
18050
18309
|
const content = await withSemaphore(
|
|
18051
18310
|
semaphore,
|
|
@@ -18128,15 +18387,15 @@ async function installCommand(options) {
|
|
|
18128
18387
|
var import_fastmcp = require("fastmcp");
|
|
18129
18388
|
|
|
18130
18389
|
// src/mcp/tools.ts
|
|
18131
|
-
var
|
|
18390
|
+
var import_mini67 = require("zod/mini");
|
|
18132
18391
|
|
|
18133
18392
|
// src/mcp/commands.ts
|
|
18134
|
-
var
|
|
18135
|
-
var
|
|
18393
|
+
var import_node_path121 = require("path");
|
|
18394
|
+
var import_mini59 = require("zod/mini");
|
|
18136
18395
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
18137
18396
|
var maxCommandsCount = 1e3;
|
|
18138
18397
|
async function listCommands() {
|
|
18139
|
-
const commandsDir = (0,
|
|
18398
|
+
const commandsDir = (0, import_node_path121.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
18140
18399
|
try {
|
|
18141
18400
|
const files = await listDirectoryFiles(commandsDir);
|
|
18142
18401
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -18152,7 +18411,7 @@ async function listCommands() {
|
|
|
18152
18411
|
});
|
|
18153
18412
|
const frontmatter = command.getFrontmatter();
|
|
18154
18413
|
return {
|
|
18155
|
-
relativePathFromCwd: (0,
|
|
18414
|
+
relativePathFromCwd: (0, import_node_path121.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
18156
18415
|
frontmatter
|
|
18157
18416
|
};
|
|
18158
18417
|
} catch (error) {
|
|
@@ -18174,13 +18433,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
18174
18433
|
relativePath: relativePathFromCwd,
|
|
18175
18434
|
intendedRootDir: process.cwd()
|
|
18176
18435
|
});
|
|
18177
|
-
const filename = (0,
|
|
18436
|
+
const filename = (0, import_node_path121.basename)(relativePathFromCwd);
|
|
18178
18437
|
try {
|
|
18179
18438
|
const command = await RulesyncCommand.fromFile({
|
|
18180
18439
|
relativeFilePath: filename
|
|
18181
18440
|
});
|
|
18182
18441
|
return {
|
|
18183
|
-
relativePathFromCwd: (0,
|
|
18442
|
+
relativePathFromCwd: (0, import_node_path121.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
18184
18443
|
frontmatter: command.getFrontmatter(),
|
|
18185
18444
|
body: command.getBody()
|
|
18186
18445
|
};
|
|
@@ -18199,7 +18458,7 @@ async function putCommand({
|
|
|
18199
18458
|
relativePath: relativePathFromCwd,
|
|
18200
18459
|
intendedRootDir: process.cwd()
|
|
18201
18460
|
});
|
|
18202
|
-
const filename = (0,
|
|
18461
|
+
const filename = (0, import_node_path121.basename)(relativePathFromCwd);
|
|
18203
18462
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
18204
18463
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
18205
18464
|
throw new Error(
|
|
@@ -18209,7 +18468,7 @@ async function putCommand({
|
|
|
18209
18468
|
try {
|
|
18210
18469
|
const existingCommands = await listCommands();
|
|
18211
18470
|
const isUpdate = existingCommands.some(
|
|
18212
|
-
(command2) => command2.relativePathFromCwd === (0,
|
|
18471
|
+
(command2) => command2.relativePathFromCwd === (0, import_node_path121.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
18213
18472
|
);
|
|
18214
18473
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
18215
18474
|
throw new Error(
|
|
@@ -18226,11 +18485,11 @@ async function putCommand({
|
|
|
18226
18485
|
fileContent,
|
|
18227
18486
|
validate: true
|
|
18228
18487
|
});
|
|
18229
|
-
const commandsDir = (0,
|
|
18488
|
+
const commandsDir = (0, import_node_path121.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
18230
18489
|
await ensureDir(commandsDir);
|
|
18231
18490
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
18232
18491
|
return {
|
|
18233
|
-
relativePathFromCwd: (0,
|
|
18492
|
+
relativePathFromCwd: (0, import_node_path121.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
18234
18493
|
frontmatter: command.getFrontmatter(),
|
|
18235
18494
|
body: command.getBody()
|
|
18236
18495
|
};
|
|
@@ -18245,12 +18504,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
18245
18504
|
relativePath: relativePathFromCwd,
|
|
18246
18505
|
intendedRootDir: process.cwd()
|
|
18247
18506
|
});
|
|
18248
|
-
const filename = (0,
|
|
18249
|
-
const fullPath = (0,
|
|
18507
|
+
const filename = (0, import_node_path121.basename)(relativePathFromCwd);
|
|
18508
|
+
const fullPath = (0, import_node_path121.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
18250
18509
|
try {
|
|
18251
18510
|
await removeFile(fullPath);
|
|
18252
18511
|
return {
|
|
18253
|
-
relativePathFromCwd: (0,
|
|
18512
|
+
relativePathFromCwd: (0, import_node_path121.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
18254
18513
|
};
|
|
18255
18514
|
} catch (error) {
|
|
18256
18515
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -18259,23 +18518,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
18259
18518
|
}
|
|
18260
18519
|
}
|
|
18261
18520
|
var commandToolSchemas = {
|
|
18262
|
-
listCommands:
|
|
18263
|
-
getCommand:
|
|
18264
|
-
relativePathFromCwd:
|
|
18521
|
+
listCommands: import_mini59.z.object({}),
|
|
18522
|
+
getCommand: import_mini59.z.object({
|
|
18523
|
+
relativePathFromCwd: import_mini59.z.string()
|
|
18265
18524
|
}),
|
|
18266
|
-
putCommand:
|
|
18267
|
-
relativePathFromCwd:
|
|
18525
|
+
putCommand: import_mini59.z.object({
|
|
18526
|
+
relativePathFromCwd: import_mini59.z.string(),
|
|
18268
18527
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
18269
|
-
body:
|
|
18528
|
+
body: import_mini59.z.string()
|
|
18270
18529
|
}),
|
|
18271
|
-
deleteCommand:
|
|
18272
|
-
relativePathFromCwd:
|
|
18530
|
+
deleteCommand: import_mini59.z.object({
|
|
18531
|
+
relativePathFromCwd: import_mini59.z.string()
|
|
18273
18532
|
})
|
|
18274
18533
|
};
|
|
18275
18534
|
var commandTools = {
|
|
18276
18535
|
listCommands: {
|
|
18277
18536
|
name: "listCommands",
|
|
18278
|
-
description: `List all commands from ${(0,
|
|
18537
|
+
description: `List all commands from ${(0, import_node_path121.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
18279
18538
|
parameters: commandToolSchemas.listCommands,
|
|
18280
18539
|
execute: async () => {
|
|
18281
18540
|
const commands = await listCommands();
|
|
@@ -18317,15 +18576,15 @@ var commandTools = {
|
|
|
18317
18576
|
};
|
|
18318
18577
|
|
|
18319
18578
|
// src/mcp/generate.ts
|
|
18320
|
-
var
|
|
18321
|
-
var generateOptionsSchema =
|
|
18322
|
-
targets:
|
|
18323
|
-
features:
|
|
18324
|
-
delete:
|
|
18325
|
-
global:
|
|
18326
|
-
simulateCommands:
|
|
18327
|
-
simulateSubagents:
|
|
18328
|
-
simulateSkills:
|
|
18579
|
+
var import_mini60 = require("zod/mini");
|
|
18580
|
+
var generateOptionsSchema = import_mini60.z.object({
|
|
18581
|
+
targets: import_mini60.z.optional(import_mini60.z.array(import_mini60.z.string())),
|
|
18582
|
+
features: import_mini60.z.optional(import_mini60.z.array(import_mini60.z.string())),
|
|
18583
|
+
delete: import_mini60.z.optional(import_mini60.z.boolean()),
|
|
18584
|
+
global: import_mini60.z.optional(import_mini60.z.boolean()),
|
|
18585
|
+
simulateCommands: import_mini60.z.optional(import_mini60.z.boolean()),
|
|
18586
|
+
simulateSubagents: import_mini60.z.optional(import_mini60.z.boolean()),
|
|
18587
|
+
simulateSkills: import_mini60.z.optional(import_mini60.z.boolean())
|
|
18329
18588
|
});
|
|
18330
18589
|
async function executeGenerate(options = {}) {
|
|
18331
18590
|
try {
|
|
@@ -18402,11 +18661,11 @@ var generateTools = {
|
|
|
18402
18661
|
};
|
|
18403
18662
|
|
|
18404
18663
|
// src/mcp/ignore.ts
|
|
18405
|
-
var
|
|
18406
|
-
var
|
|
18664
|
+
var import_node_path122 = require("path");
|
|
18665
|
+
var import_mini61 = require("zod/mini");
|
|
18407
18666
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
18408
18667
|
async function getIgnoreFile() {
|
|
18409
|
-
const ignoreFilePath = (0,
|
|
18668
|
+
const ignoreFilePath = (0, import_node_path122.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
18410
18669
|
try {
|
|
18411
18670
|
const content = await readFileContent(ignoreFilePath);
|
|
18412
18671
|
return {
|
|
@@ -18423,7 +18682,7 @@ async function getIgnoreFile() {
|
|
|
18423
18682
|
}
|
|
18424
18683
|
}
|
|
18425
18684
|
async function putIgnoreFile({ content }) {
|
|
18426
|
-
const ignoreFilePath = (0,
|
|
18685
|
+
const ignoreFilePath = (0, import_node_path122.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
18427
18686
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
18428
18687
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
18429
18688
|
throw new Error(
|
|
@@ -18447,8 +18706,8 @@ async function putIgnoreFile({ content }) {
|
|
|
18447
18706
|
}
|
|
18448
18707
|
}
|
|
18449
18708
|
async function deleteIgnoreFile() {
|
|
18450
|
-
const aiignorePath = (0,
|
|
18451
|
-
const legacyIgnorePath = (0,
|
|
18709
|
+
const aiignorePath = (0, import_node_path122.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
18710
|
+
const legacyIgnorePath = (0, import_node_path122.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
18452
18711
|
try {
|
|
18453
18712
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
18454
18713
|
return {
|
|
@@ -18466,11 +18725,11 @@ async function deleteIgnoreFile() {
|
|
|
18466
18725
|
}
|
|
18467
18726
|
}
|
|
18468
18727
|
var ignoreToolSchemas = {
|
|
18469
|
-
getIgnoreFile:
|
|
18470
|
-
putIgnoreFile:
|
|
18471
|
-
content:
|
|
18728
|
+
getIgnoreFile: import_mini61.z.object({}),
|
|
18729
|
+
putIgnoreFile: import_mini61.z.object({
|
|
18730
|
+
content: import_mini61.z.string()
|
|
18472
18731
|
}),
|
|
18473
|
-
deleteIgnoreFile:
|
|
18732
|
+
deleteIgnoreFile: import_mini61.z.object({})
|
|
18474
18733
|
};
|
|
18475
18734
|
var ignoreTools = {
|
|
18476
18735
|
getIgnoreFile: {
|
|
@@ -18503,11 +18762,11 @@ var ignoreTools = {
|
|
|
18503
18762
|
};
|
|
18504
18763
|
|
|
18505
18764
|
// src/mcp/import.ts
|
|
18506
|
-
var
|
|
18507
|
-
var importOptionsSchema =
|
|
18508
|
-
target:
|
|
18509
|
-
features:
|
|
18510
|
-
global:
|
|
18765
|
+
var import_mini62 = require("zod/mini");
|
|
18766
|
+
var importOptionsSchema = import_mini62.z.object({
|
|
18767
|
+
target: import_mini62.z.string(),
|
|
18768
|
+
features: import_mini62.z.optional(import_mini62.z.array(import_mini62.z.string())),
|
|
18769
|
+
global: import_mini62.z.optional(import_mini62.z.boolean())
|
|
18511
18770
|
});
|
|
18512
18771
|
async function executeImport(options) {
|
|
18513
18772
|
try {
|
|
@@ -18576,15 +18835,15 @@ var importTools = {
|
|
|
18576
18835
|
};
|
|
18577
18836
|
|
|
18578
18837
|
// src/mcp/mcp.ts
|
|
18579
|
-
var
|
|
18580
|
-
var
|
|
18838
|
+
var import_node_path123 = require("path");
|
|
18839
|
+
var import_mini63 = require("zod/mini");
|
|
18581
18840
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
18582
18841
|
async function getMcpFile() {
|
|
18583
18842
|
try {
|
|
18584
18843
|
const rulesyncMcp = await RulesyncMcp.fromFile({
|
|
18585
18844
|
validate: true
|
|
18586
18845
|
});
|
|
18587
|
-
const relativePathFromCwd = (0,
|
|
18846
|
+
const relativePathFromCwd = (0, import_node_path123.join)(
|
|
18588
18847
|
rulesyncMcp.getRelativeDirPath(),
|
|
18589
18848
|
rulesyncMcp.getRelativeFilePath()
|
|
18590
18849
|
);
|
|
@@ -18622,7 +18881,7 @@ async function putMcpFile({ content }) {
|
|
|
18622
18881
|
const paths = RulesyncMcp.getSettablePaths();
|
|
18623
18882
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
18624
18883
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
18625
|
-
const fullPath = (0,
|
|
18884
|
+
const fullPath = (0, import_node_path123.join)(baseDir, relativeDirPath, relativeFilePath);
|
|
18626
18885
|
const rulesyncMcp = new RulesyncMcp({
|
|
18627
18886
|
baseDir,
|
|
18628
18887
|
relativeDirPath,
|
|
@@ -18630,9 +18889,9 @@ async function putMcpFile({ content }) {
|
|
|
18630
18889
|
fileContent: content,
|
|
18631
18890
|
validate: true
|
|
18632
18891
|
});
|
|
18633
|
-
await ensureDir((0,
|
|
18892
|
+
await ensureDir((0, import_node_path123.join)(baseDir, relativeDirPath));
|
|
18634
18893
|
await writeFileContent(fullPath, content);
|
|
18635
|
-
const relativePathFromCwd = (0,
|
|
18894
|
+
const relativePathFromCwd = (0, import_node_path123.join)(relativeDirPath, relativeFilePath);
|
|
18636
18895
|
return {
|
|
18637
18896
|
relativePathFromCwd,
|
|
18638
18897
|
content: rulesyncMcp.getFileContent()
|
|
@@ -18650,15 +18909,15 @@ async function deleteMcpFile() {
|
|
|
18650
18909
|
try {
|
|
18651
18910
|
const baseDir = process.cwd();
|
|
18652
18911
|
const paths = RulesyncMcp.getSettablePaths();
|
|
18653
|
-
const recommendedPath = (0,
|
|
18912
|
+
const recommendedPath = (0, import_node_path123.join)(
|
|
18654
18913
|
baseDir,
|
|
18655
18914
|
paths.recommended.relativeDirPath,
|
|
18656
18915
|
paths.recommended.relativeFilePath
|
|
18657
18916
|
);
|
|
18658
|
-
const legacyPath = (0,
|
|
18917
|
+
const legacyPath = (0, import_node_path123.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
18659
18918
|
await removeFile(recommendedPath);
|
|
18660
18919
|
await removeFile(legacyPath);
|
|
18661
|
-
const relativePathFromCwd = (0,
|
|
18920
|
+
const relativePathFromCwd = (0, import_node_path123.join)(
|
|
18662
18921
|
paths.recommended.relativeDirPath,
|
|
18663
18922
|
paths.recommended.relativeFilePath
|
|
18664
18923
|
);
|
|
@@ -18675,11 +18934,11 @@ async function deleteMcpFile() {
|
|
|
18675
18934
|
}
|
|
18676
18935
|
}
|
|
18677
18936
|
var mcpToolSchemas = {
|
|
18678
|
-
getMcpFile:
|
|
18679
|
-
putMcpFile:
|
|
18680
|
-
content:
|
|
18937
|
+
getMcpFile: import_mini63.z.object({}),
|
|
18938
|
+
putMcpFile: import_mini63.z.object({
|
|
18939
|
+
content: import_mini63.z.string()
|
|
18681
18940
|
}),
|
|
18682
|
-
deleteMcpFile:
|
|
18941
|
+
deleteMcpFile: import_mini63.z.object({})
|
|
18683
18942
|
};
|
|
18684
18943
|
var mcpTools = {
|
|
18685
18944
|
getMcpFile: {
|
|
@@ -18712,12 +18971,12 @@ var mcpTools = {
|
|
|
18712
18971
|
};
|
|
18713
18972
|
|
|
18714
18973
|
// src/mcp/rules.ts
|
|
18715
|
-
var
|
|
18716
|
-
var
|
|
18974
|
+
var import_node_path124 = require("path");
|
|
18975
|
+
var import_mini64 = require("zod/mini");
|
|
18717
18976
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
18718
18977
|
var maxRulesCount = 1e3;
|
|
18719
18978
|
async function listRules() {
|
|
18720
|
-
const rulesDir = (0,
|
|
18979
|
+
const rulesDir = (0, import_node_path124.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
18721
18980
|
try {
|
|
18722
18981
|
const files = await listDirectoryFiles(rulesDir);
|
|
18723
18982
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -18730,7 +18989,7 @@ async function listRules() {
|
|
|
18730
18989
|
});
|
|
18731
18990
|
const frontmatter = rule.getFrontmatter();
|
|
18732
18991
|
return {
|
|
18733
|
-
relativePathFromCwd: (0,
|
|
18992
|
+
relativePathFromCwd: (0, import_node_path124.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
18734
18993
|
frontmatter
|
|
18735
18994
|
};
|
|
18736
18995
|
} catch (error) {
|
|
@@ -18752,14 +19011,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
18752
19011
|
relativePath: relativePathFromCwd,
|
|
18753
19012
|
intendedRootDir: process.cwd()
|
|
18754
19013
|
});
|
|
18755
|
-
const filename = (0,
|
|
19014
|
+
const filename = (0, import_node_path124.basename)(relativePathFromCwd);
|
|
18756
19015
|
try {
|
|
18757
19016
|
const rule = await RulesyncRule.fromFile({
|
|
18758
19017
|
relativeFilePath: filename,
|
|
18759
19018
|
validate: true
|
|
18760
19019
|
});
|
|
18761
19020
|
return {
|
|
18762
|
-
relativePathFromCwd: (0,
|
|
19021
|
+
relativePathFromCwd: (0, import_node_path124.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
18763
19022
|
frontmatter: rule.getFrontmatter(),
|
|
18764
19023
|
body: rule.getBody()
|
|
18765
19024
|
};
|
|
@@ -18778,7 +19037,7 @@ async function putRule({
|
|
|
18778
19037
|
relativePath: relativePathFromCwd,
|
|
18779
19038
|
intendedRootDir: process.cwd()
|
|
18780
19039
|
});
|
|
18781
|
-
const filename = (0,
|
|
19040
|
+
const filename = (0, import_node_path124.basename)(relativePathFromCwd);
|
|
18782
19041
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
18783
19042
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
18784
19043
|
throw new Error(
|
|
@@ -18788,7 +19047,7 @@ async function putRule({
|
|
|
18788
19047
|
try {
|
|
18789
19048
|
const existingRules = await listRules();
|
|
18790
19049
|
const isUpdate = existingRules.some(
|
|
18791
|
-
(rule2) => rule2.relativePathFromCwd === (0,
|
|
19050
|
+
(rule2) => rule2.relativePathFromCwd === (0, import_node_path124.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
18792
19051
|
);
|
|
18793
19052
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
18794
19053
|
throw new Error(
|
|
@@ -18803,11 +19062,11 @@ async function putRule({
|
|
|
18803
19062
|
body,
|
|
18804
19063
|
validate: true
|
|
18805
19064
|
});
|
|
18806
|
-
const rulesDir = (0,
|
|
19065
|
+
const rulesDir = (0, import_node_path124.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
18807
19066
|
await ensureDir(rulesDir);
|
|
18808
19067
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
18809
19068
|
return {
|
|
18810
|
-
relativePathFromCwd: (0,
|
|
19069
|
+
relativePathFromCwd: (0, import_node_path124.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
18811
19070
|
frontmatter: rule.getFrontmatter(),
|
|
18812
19071
|
body: rule.getBody()
|
|
18813
19072
|
};
|
|
@@ -18822,12 +19081,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
18822
19081
|
relativePath: relativePathFromCwd,
|
|
18823
19082
|
intendedRootDir: process.cwd()
|
|
18824
19083
|
});
|
|
18825
|
-
const filename = (0,
|
|
18826
|
-
const fullPath = (0,
|
|
19084
|
+
const filename = (0, import_node_path124.basename)(relativePathFromCwd);
|
|
19085
|
+
const fullPath = (0, import_node_path124.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
18827
19086
|
try {
|
|
18828
19087
|
await removeFile(fullPath);
|
|
18829
19088
|
return {
|
|
18830
|
-
relativePathFromCwd: (0,
|
|
19089
|
+
relativePathFromCwd: (0, import_node_path124.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
18831
19090
|
};
|
|
18832
19091
|
} catch (error) {
|
|
18833
19092
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -18836,23 +19095,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
18836
19095
|
}
|
|
18837
19096
|
}
|
|
18838
19097
|
var ruleToolSchemas = {
|
|
18839
|
-
listRules:
|
|
18840
|
-
getRule:
|
|
18841
|
-
relativePathFromCwd:
|
|
19098
|
+
listRules: import_mini64.z.object({}),
|
|
19099
|
+
getRule: import_mini64.z.object({
|
|
19100
|
+
relativePathFromCwd: import_mini64.z.string()
|
|
18842
19101
|
}),
|
|
18843
|
-
putRule:
|
|
18844
|
-
relativePathFromCwd:
|
|
19102
|
+
putRule: import_mini64.z.object({
|
|
19103
|
+
relativePathFromCwd: import_mini64.z.string(),
|
|
18845
19104
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
18846
|
-
body:
|
|
19105
|
+
body: import_mini64.z.string()
|
|
18847
19106
|
}),
|
|
18848
|
-
deleteRule:
|
|
18849
|
-
relativePathFromCwd:
|
|
19107
|
+
deleteRule: import_mini64.z.object({
|
|
19108
|
+
relativePathFromCwd: import_mini64.z.string()
|
|
18850
19109
|
})
|
|
18851
19110
|
};
|
|
18852
19111
|
var ruleTools = {
|
|
18853
19112
|
listRules: {
|
|
18854
19113
|
name: "listRules",
|
|
18855
|
-
description: `List all rules from ${(0,
|
|
19114
|
+
description: `List all rules from ${(0, import_node_path124.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
18856
19115
|
parameters: ruleToolSchemas.listRules,
|
|
18857
19116
|
execute: async () => {
|
|
18858
19117
|
const rules = await listRules();
|
|
@@ -18894,8 +19153,8 @@ var ruleTools = {
|
|
|
18894
19153
|
};
|
|
18895
19154
|
|
|
18896
19155
|
// src/mcp/skills.ts
|
|
18897
|
-
var
|
|
18898
|
-
var
|
|
19156
|
+
var import_node_path125 = require("path");
|
|
19157
|
+
var import_mini65 = require("zod/mini");
|
|
18899
19158
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
18900
19159
|
var maxSkillsCount = 1e3;
|
|
18901
19160
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -18911,19 +19170,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
18911
19170
|
};
|
|
18912
19171
|
}
|
|
18913
19172
|
function extractDirName(relativeDirPathFromCwd) {
|
|
18914
|
-
const dirName = (0,
|
|
19173
|
+
const dirName = (0, import_node_path125.basename)(relativeDirPathFromCwd);
|
|
18915
19174
|
if (!dirName) {
|
|
18916
19175
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
18917
19176
|
}
|
|
18918
19177
|
return dirName;
|
|
18919
19178
|
}
|
|
18920
19179
|
async function listSkills() {
|
|
18921
|
-
const skillsDir = (0,
|
|
19180
|
+
const skillsDir = (0, import_node_path125.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
18922
19181
|
try {
|
|
18923
|
-
const skillDirPaths = await findFilesByGlobs((0,
|
|
19182
|
+
const skillDirPaths = await findFilesByGlobs((0, import_node_path125.join)(skillsDir, "*"), { type: "dir" });
|
|
18924
19183
|
const skills = await Promise.all(
|
|
18925
19184
|
skillDirPaths.map(async (dirPath) => {
|
|
18926
|
-
const dirName = (0,
|
|
19185
|
+
const dirName = (0, import_node_path125.basename)(dirPath);
|
|
18927
19186
|
if (!dirName) return null;
|
|
18928
19187
|
try {
|
|
18929
19188
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -18931,7 +19190,7 @@ async function listSkills() {
|
|
|
18931
19190
|
});
|
|
18932
19191
|
const frontmatter = skill.getFrontmatter();
|
|
18933
19192
|
return {
|
|
18934
|
-
relativeDirPathFromCwd: (0,
|
|
19193
|
+
relativeDirPathFromCwd: (0, import_node_path125.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
18935
19194
|
frontmatter
|
|
18936
19195
|
};
|
|
18937
19196
|
} catch (error) {
|
|
@@ -18959,7 +19218,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
18959
19218
|
dirName
|
|
18960
19219
|
});
|
|
18961
19220
|
return {
|
|
18962
|
-
relativeDirPathFromCwd: (0,
|
|
19221
|
+
relativeDirPathFromCwd: (0, import_node_path125.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
18963
19222
|
frontmatter: skill.getFrontmatter(),
|
|
18964
19223
|
body: skill.getBody(),
|
|
18965
19224
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -18993,7 +19252,7 @@ async function putSkill({
|
|
|
18993
19252
|
try {
|
|
18994
19253
|
const existingSkills = await listSkills();
|
|
18995
19254
|
const isUpdate = existingSkills.some(
|
|
18996
|
-
(skill2) => skill2.relativeDirPathFromCwd === (0,
|
|
19255
|
+
(skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path125.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
18997
19256
|
);
|
|
18998
19257
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
18999
19258
|
throw new Error(
|
|
@@ -19010,9 +19269,9 @@ async function putSkill({
|
|
|
19010
19269
|
otherFiles: aiDirFiles,
|
|
19011
19270
|
validate: true
|
|
19012
19271
|
});
|
|
19013
|
-
const skillDirPath = (0,
|
|
19272
|
+
const skillDirPath = (0, import_node_path125.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
19014
19273
|
await ensureDir(skillDirPath);
|
|
19015
|
-
const skillFilePath = (0,
|
|
19274
|
+
const skillFilePath = (0, import_node_path125.join)(skillDirPath, SKILL_FILE_NAME);
|
|
19016
19275
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
19017
19276
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
19018
19277
|
for (const file of otherFiles) {
|
|
@@ -19020,15 +19279,15 @@ async function putSkill({
|
|
|
19020
19279
|
relativePath: file.name,
|
|
19021
19280
|
intendedRootDir: skillDirPath
|
|
19022
19281
|
});
|
|
19023
|
-
const filePath = (0,
|
|
19024
|
-
const fileDir = (0,
|
|
19282
|
+
const filePath = (0, import_node_path125.join)(skillDirPath, file.name);
|
|
19283
|
+
const fileDir = (0, import_node_path125.join)(skillDirPath, (0, import_node_path125.dirname)(file.name));
|
|
19025
19284
|
if (fileDir !== skillDirPath) {
|
|
19026
19285
|
await ensureDir(fileDir);
|
|
19027
19286
|
}
|
|
19028
19287
|
await writeFileContent(filePath, file.body);
|
|
19029
19288
|
}
|
|
19030
19289
|
return {
|
|
19031
|
-
relativeDirPathFromCwd: (0,
|
|
19290
|
+
relativeDirPathFromCwd: (0, import_node_path125.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
19032
19291
|
frontmatter: skill.getFrontmatter(),
|
|
19033
19292
|
body: skill.getBody(),
|
|
19034
19293
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -19050,13 +19309,13 @@ async function deleteSkill({
|
|
|
19050
19309
|
intendedRootDir: process.cwd()
|
|
19051
19310
|
});
|
|
19052
19311
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
19053
|
-
const skillDirPath = (0,
|
|
19312
|
+
const skillDirPath = (0, import_node_path125.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
19054
19313
|
try {
|
|
19055
19314
|
if (await directoryExists(skillDirPath)) {
|
|
19056
19315
|
await removeDirectory(skillDirPath);
|
|
19057
19316
|
}
|
|
19058
19317
|
return {
|
|
19059
|
-
relativeDirPathFromCwd: (0,
|
|
19318
|
+
relativeDirPathFromCwd: (0, import_node_path125.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
19060
19319
|
};
|
|
19061
19320
|
} catch (error) {
|
|
19062
19321
|
throw new Error(
|
|
@@ -19067,29 +19326,29 @@ async function deleteSkill({
|
|
|
19067
19326
|
);
|
|
19068
19327
|
}
|
|
19069
19328
|
}
|
|
19070
|
-
var McpSkillFileSchema =
|
|
19071
|
-
name:
|
|
19072
|
-
body:
|
|
19329
|
+
var McpSkillFileSchema = import_mini65.z.object({
|
|
19330
|
+
name: import_mini65.z.string(),
|
|
19331
|
+
body: import_mini65.z.string()
|
|
19073
19332
|
});
|
|
19074
19333
|
var skillToolSchemas = {
|
|
19075
|
-
listSkills:
|
|
19076
|
-
getSkill:
|
|
19077
|
-
relativeDirPathFromCwd:
|
|
19334
|
+
listSkills: import_mini65.z.object({}),
|
|
19335
|
+
getSkill: import_mini65.z.object({
|
|
19336
|
+
relativeDirPathFromCwd: import_mini65.z.string()
|
|
19078
19337
|
}),
|
|
19079
|
-
putSkill:
|
|
19080
|
-
relativeDirPathFromCwd:
|
|
19338
|
+
putSkill: import_mini65.z.object({
|
|
19339
|
+
relativeDirPathFromCwd: import_mini65.z.string(),
|
|
19081
19340
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
19082
|
-
body:
|
|
19083
|
-
otherFiles:
|
|
19341
|
+
body: import_mini65.z.string(),
|
|
19342
|
+
otherFiles: import_mini65.z.optional(import_mini65.z.array(McpSkillFileSchema))
|
|
19084
19343
|
}),
|
|
19085
|
-
deleteSkill:
|
|
19086
|
-
relativeDirPathFromCwd:
|
|
19344
|
+
deleteSkill: import_mini65.z.object({
|
|
19345
|
+
relativeDirPathFromCwd: import_mini65.z.string()
|
|
19087
19346
|
})
|
|
19088
19347
|
};
|
|
19089
19348
|
var skillTools = {
|
|
19090
19349
|
listSkills: {
|
|
19091
19350
|
name: "listSkills",
|
|
19092
|
-
description: `List all skills from ${(0,
|
|
19351
|
+
description: `List all skills from ${(0, import_node_path125.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
19093
19352
|
parameters: skillToolSchemas.listSkills,
|
|
19094
19353
|
execute: async () => {
|
|
19095
19354
|
const skills = await listSkills();
|
|
@@ -19132,12 +19391,12 @@ var skillTools = {
|
|
|
19132
19391
|
};
|
|
19133
19392
|
|
|
19134
19393
|
// src/mcp/subagents.ts
|
|
19135
|
-
var
|
|
19136
|
-
var
|
|
19394
|
+
var import_node_path126 = require("path");
|
|
19395
|
+
var import_mini66 = require("zod/mini");
|
|
19137
19396
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
19138
19397
|
var maxSubagentsCount = 1e3;
|
|
19139
19398
|
async function listSubagents() {
|
|
19140
|
-
const subagentsDir = (0,
|
|
19399
|
+
const subagentsDir = (0, import_node_path126.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
19141
19400
|
try {
|
|
19142
19401
|
const files = await listDirectoryFiles(subagentsDir);
|
|
19143
19402
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -19150,7 +19409,7 @@ async function listSubagents() {
|
|
|
19150
19409
|
});
|
|
19151
19410
|
const frontmatter = subagent.getFrontmatter();
|
|
19152
19411
|
return {
|
|
19153
|
-
relativePathFromCwd: (0,
|
|
19412
|
+
relativePathFromCwd: (0, import_node_path126.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
19154
19413
|
frontmatter
|
|
19155
19414
|
};
|
|
19156
19415
|
} catch (error) {
|
|
@@ -19174,14 +19433,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
19174
19433
|
relativePath: relativePathFromCwd,
|
|
19175
19434
|
intendedRootDir: process.cwd()
|
|
19176
19435
|
});
|
|
19177
|
-
const filename = (0,
|
|
19436
|
+
const filename = (0, import_node_path126.basename)(relativePathFromCwd);
|
|
19178
19437
|
try {
|
|
19179
19438
|
const subagent = await RulesyncSubagent.fromFile({
|
|
19180
19439
|
relativeFilePath: filename,
|
|
19181
19440
|
validate: true
|
|
19182
19441
|
});
|
|
19183
19442
|
return {
|
|
19184
|
-
relativePathFromCwd: (0,
|
|
19443
|
+
relativePathFromCwd: (0, import_node_path126.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
19185
19444
|
frontmatter: subagent.getFrontmatter(),
|
|
19186
19445
|
body: subagent.getBody()
|
|
19187
19446
|
};
|
|
@@ -19200,7 +19459,7 @@ async function putSubagent({
|
|
|
19200
19459
|
relativePath: relativePathFromCwd,
|
|
19201
19460
|
intendedRootDir: process.cwd()
|
|
19202
19461
|
});
|
|
19203
|
-
const filename = (0,
|
|
19462
|
+
const filename = (0, import_node_path126.basename)(relativePathFromCwd);
|
|
19204
19463
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
19205
19464
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
19206
19465
|
throw new Error(
|
|
@@ -19210,7 +19469,7 @@ async function putSubagent({
|
|
|
19210
19469
|
try {
|
|
19211
19470
|
const existingSubagents = await listSubagents();
|
|
19212
19471
|
const isUpdate = existingSubagents.some(
|
|
19213
|
-
(subagent2) => subagent2.relativePathFromCwd === (0,
|
|
19472
|
+
(subagent2) => subagent2.relativePathFromCwd === (0, import_node_path126.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
19214
19473
|
);
|
|
19215
19474
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
19216
19475
|
throw new Error(
|
|
@@ -19225,11 +19484,11 @@ async function putSubagent({
|
|
|
19225
19484
|
body,
|
|
19226
19485
|
validate: true
|
|
19227
19486
|
});
|
|
19228
|
-
const subagentsDir = (0,
|
|
19487
|
+
const subagentsDir = (0, import_node_path126.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
19229
19488
|
await ensureDir(subagentsDir);
|
|
19230
19489
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
19231
19490
|
return {
|
|
19232
|
-
relativePathFromCwd: (0,
|
|
19491
|
+
relativePathFromCwd: (0, import_node_path126.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
19233
19492
|
frontmatter: subagent.getFrontmatter(),
|
|
19234
19493
|
body: subagent.getBody()
|
|
19235
19494
|
};
|
|
@@ -19244,12 +19503,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
19244
19503
|
relativePath: relativePathFromCwd,
|
|
19245
19504
|
intendedRootDir: process.cwd()
|
|
19246
19505
|
});
|
|
19247
|
-
const filename = (0,
|
|
19248
|
-
const fullPath = (0,
|
|
19506
|
+
const filename = (0, import_node_path126.basename)(relativePathFromCwd);
|
|
19507
|
+
const fullPath = (0, import_node_path126.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
19249
19508
|
try {
|
|
19250
19509
|
await removeFile(fullPath);
|
|
19251
19510
|
return {
|
|
19252
|
-
relativePathFromCwd: (0,
|
|
19511
|
+
relativePathFromCwd: (0, import_node_path126.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
19253
19512
|
};
|
|
19254
19513
|
} catch (error) {
|
|
19255
19514
|
throw new Error(
|
|
@@ -19261,23 +19520,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
19261
19520
|
}
|
|
19262
19521
|
}
|
|
19263
19522
|
var subagentToolSchemas = {
|
|
19264
|
-
listSubagents:
|
|
19265
|
-
getSubagent:
|
|
19266
|
-
relativePathFromCwd:
|
|
19523
|
+
listSubagents: import_mini66.z.object({}),
|
|
19524
|
+
getSubagent: import_mini66.z.object({
|
|
19525
|
+
relativePathFromCwd: import_mini66.z.string()
|
|
19267
19526
|
}),
|
|
19268
|
-
putSubagent:
|
|
19269
|
-
relativePathFromCwd:
|
|
19527
|
+
putSubagent: import_mini66.z.object({
|
|
19528
|
+
relativePathFromCwd: import_mini66.z.string(),
|
|
19270
19529
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
19271
|
-
body:
|
|
19530
|
+
body: import_mini66.z.string()
|
|
19272
19531
|
}),
|
|
19273
|
-
deleteSubagent:
|
|
19274
|
-
relativePathFromCwd:
|
|
19532
|
+
deleteSubagent: import_mini66.z.object({
|
|
19533
|
+
relativePathFromCwd: import_mini66.z.string()
|
|
19275
19534
|
})
|
|
19276
19535
|
};
|
|
19277
19536
|
var subagentTools = {
|
|
19278
19537
|
listSubagents: {
|
|
19279
19538
|
name: "listSubagents",
|
|
19280
|
-
description: `List all subagents from ${(0,
|
|
19539
|
+
description: `List all subagents from ${(0, import_node_path126.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
19281
19540
|
parameters: subagentToolSchemas.listSubagents,
|
|
19282
19541
|
execute: async () => {
|
|
19283
19542
|
const subagents = await listSubagents();
|
|
@@ -19319,7 +19578,7 @@ var subagentTools = {
|
|
|
19319
19578
|
};
|
|
19320
19579
|
|
|
19321
19580
|
// src/mcp/tools.ts
|
|
19322
|
-
var rulesyncFeatureSchema =
|
|
19581
|
+
var rulesyncFeatureSchema = import_mini67.z.enum([
|
|
19323
19582
|
"rule",
|
|
19324
19583
|
"command",
|
|
19325
19584
|
"subagent",
|
|
@@ -19329,21 +19588,21 @@ var rulesyncFeatureSchema = import_mini66.z.enum([
|
|
|
19329
19588
|
"generate",
|
|
19330
19589
|
"import"
|
|
19331
19590
|
]);
|
|
19332
|
-
var rulesyncOperationSchema =
|
|
19333
|
-
var skillFileSchema =
|
|
19334
|
-
name:
|
|
19335
|
-
body:
|
|
19591
|
+
var rulesyncOperationSchema = import_mini67.z.enum(["list", "get", "put", "delete", "run"]);
|
|
19592
|
+
var skillFileSchema = import_mini67.z.object({
|
|
19593
|
+
name: import_mini67.z.string(),
|
|
19594
|
+
body: import_mini67.z.string()
|
|
19336
19595
|
});
|
|
19337
|
-
var rulesyncToolSchema =
|
|
19596
|
+
var rulesyncToolSchema = import_mini67.z.object({
|
|
19338
19597
|
feature: rulesyncFeatureSchema,
|
|
19339
19598
|
operation: rulesyncOperationSchema,
|
|
19340
|
-
targetPathFromCwd:
|
|
19341
|
-
frontmatter:
|
|
19342
|
-
body:
|
|
19343
|
-
otherFiles:
|
|
19344
|
-
content:
|
|
19345
|
-
generateOptions:
|
|
19346
|
-
importOptions:
|
|
19599
|
+
targetPathFromCwd: import_mini67.z.optional(import_mini67.z.string()),
|
|
19600
|
+
frontmatter: import_mini67.z.optional(import_mini67.z.unknown()),
|
|
19601
|
+
body: import_mini67.z.optional(import_mini67.z.string()),
|
|
19602
|
+
otherFiles: import_mini67.z.optional(import_mini67.z.array(skillFileSchema)),
|
|
19603
|
+
content: import_mini67.z.optional(import_mini67.z.string()),
|
|
19604
|
+
generateOptions: import_mini67.z.optional(generateOptionsSchema),
|
|
19605
|
+
importOptions: import_mini67.z.optional(importOptionsSchema)
|
|
19347
19606
|
});
|
|
19348
19607
|
var supportedOperationsByFeature = {
|
|
19349
19608
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -19902,7 +20161,7 @@ async function updateCommand(currentVersion, options) {
|
|
|
19902
20161
|
}
|
|
19903
20162
|
|
|
19904
20163
|
// src/cli/index.ts
|
|
19905
|
-
var getVersion = () => "7.
|
|
20164
|
+
var getVersion = () => "7.11.0";
|
|
19906
20165
|
var main = async () => {
|
|
19907
20166
|
const program = new import_commander.Command();
|
|
19908
20167
|
const version = getVersion();
|
|
@@ -20007,7 +20266,10 @@ var main = async () => {
|
|
|
20007
20266
|
}
|
|
20008
20267
|
).option("--delete", "Delete all existing files in output directories before generating").option(
|
|
20009
20268
|
"-b, --base-dir <paths>",
|
|
20010
|
-
"Base directories to generate files (comma-separated for multiple paths)"
|
|
20269
|
+
"Base directories to generate files (comma-separated for multiple paths)",
|
|
20270
|
+
(value) => {
|
|
20271
|
+
return value.split(",").map((p) => p.trim());
|
|
20272
|
+
}
|
|
20011
20273
|
).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(
|
|
20012
20274
|
"--simulate-commands",
|
|
20013
20275
|
"Generate simulated commands. This feature is only available for copilot, cursor and codexcli."
|
|
@@ -20025,7 +20287,7 @@ var main = async () => {
|
|
|
20025
20287
|
verbose: options.verbose,
|
|
20026
20288
|
silent: options.silent,
|
|
20027
20289
|
delete: options.delete,
|
|
20028
|
-
baseDirs: options.
|
|
20290
|
+
baseDirs: options.baseDir,
|
|
20029
20291
|
configPath: options.config,
|
|
20030
20292
|
global: options.global,
|
|
20031
20293
|
simulateCommands: options.simulateCommands,
|