rulesync 6.2.0 → 6.3.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 +58 -21
- package/dist/index.cjs +1683 -842
- package/dist/index.js +1650 -809
- package/package.json +17 -17
package/dist/index.cjs
CHANGED
|
@@ -31,7 +31,15 @@ var ANNOUNCEMENT = "".trim();
|
|
|
31
31
|
|
|
32
32
|
// src/types/features.ts
|
|
33
33
|
var import_mini = require("zod/mini");
|
|
34
|
-
var ALL_FEATURES = [
|
|
34
|
+
var ALL_FEATURES = [
|
|
35
|
+
"rules",
|
|
36
|
+
"ignore",
|
|
37
|
+
"mcp",
|
|
38
|
+
"subagents",
|
|
39
|
+
"commands",
|
|
40
|
+
"skills",
|
|
41
|
+
"hooks"
|
|
42
|
+
];
|
|
35
43
|
var ALL_FEATURES_WITH_WILDCARD = [...ALL_FEATURES, "*"];
|
|
36
44
|
var FeatureSchema = import_mini.z.enum(ALL_FEATURES);
|
|
37
45
|
var FeaturesSchema = import_mini.z.array(FeatureSchema);
|
|
@@ -129,6 +137,7 @@ var RULESYNC_RULES_RELATIVE_DIR_PATH = (0, import_node_path.join)(RULESYNC_RELAT
|
|
|
129
137
|
var RULESYNC_COMMANDS_RELATIVE_DIR_PATH = (0, import_node_path.join)(RULESYNC_RELATIVE_DIR_PATH, "commands");
|
|
130
138
|
var RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH = (0, import_node_path.join)(RULESYNC_RELATIVE_DIR_PATH, "subagents");
|
|
131
139
|
var RULESYNC_MCP_RELATIVE_FILE_PATH = (0, import_node_path.join)(RULESYNC_RELATIVE_DIR_PATH, "mcp.json");
|
|
140
|
+
var RULESYNC_HOOKS_RELATIVE_FILE_PATH = (0, import_node_path.join)(RULESYNC_RELATIVE_DIR_PATH, "hooks.json");
|
|
132
141
|
var RULESYNC_AIIGNORE_FILE_NAME = ".aiignore";
|
|
133
142
|
var RULESYNC_AIIGNORE_RELATIVE_FILE_PATH = (0, import_node_path.join)(RULESYNC_RELATIVE_DIR_PATH, ".aiignore");
|
|
134
143
|
var RULESYNC_IGNORE_RELATIVE_FILE_PATH = ".rulesyncignore";
|
|
@@ -526,7 +535,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
526
535
|
|
|
527
536
|
// src/lib/generate.ts
|
|
528
537
|
var import_es_toolkit4 = require("es-toolkit");
|
|
529
|
-
var
|
|
538
|
+
var import_node_path102 = require("path");
|
|
530
539
|
|
|
531
540
|
// src/features/commands/commands-processor.ts
|
|
532
541
|
var import_node_path19 = require("path");
|
|
@@ -2603,80 +2612,140 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2603
2612
|
}
|
|
2604
2613
|
};
|
|
2605
2614
|
|
|
2606
|
-
// src/features/
|
|
2615
|
+
// src/features/hooks/hooks-processor.ts
|
|
2616
|
+
var import_mini14 = require("zod/mini");
|
|
2617
|
+
|
|
2618
|
+
// src/types/hooks.ts
|
|
2607
2619
|
var import_mini13 = require("zod/mini");
|
|
2620
|
+
var HookDefinitionSchema = import_mini13.z.object({
|
|
2621
|
+
command: import_mini13.z.optional(import_mini13.z.string()),
|
|
2622
|
+
type: import_mini13.z.optional(import_mini13.z.enum(["command", "prompt"])),
|
|
2623
|
+
timeout: import_mini13.z.optional(import_mini13.z.number()),
|
|
2624
|
+
matcher: import_mini13.z.optional(import_mini13.z.string()),
|
|
2625
|
+
prompt: import_mini13.z.optional(import_mini13.z.string()),
|
|
2626
|
+
loop_limit: import_mini13.z.optional(import_mini13.z.nullable(import_mini13.z.number()))
|
|
2627
|
+
});
|
|
2628
|
+
var COMMON_HOOK_EVENTS = [
|
|
2629
|
+
"sessionStart",
|
|
2630
|
+
"sessionEnd",
|
|
2631
|
+
"preToolUse",
|
|
2632
|
+
"postToolUse",
|
|
2633
|
+
"beforeSubmitPrompt",
|
|
2634
|
+
"stop",
|
|
2635
|
+
"subagentStop",
|
|
2636
|
+
"preCompact"
|
|
2637
|
+
];
|
|
2638
|
+
var CURSOR_ONLY_HOOK_EVENTS = [
|
|
2639
|
+
"postToolUseFailure",
|
|
2640
|
+
"subagentStart",
|
|
2641
|
+
"beforeShellExecution",
|
|
2642
|
+
"afterShellExecution",
|
|
2643
|
+
"beforeMCPExecution",
|
|
2644
|
+
"afterMCPExecution",
|
|
2645
|
+
"beforeReadFile",
|
|
2646
|
+
"afterFileEdit",
|
|
2647
|
+
"afterAgentResponse",
|
|
2648
|
+
"afterAgentThought",
|
|
2649
|
+
"beforeTabFileRead",
|
|
2650
|
+
"afterTabFileEdit"
|
|
2651
|
+
];
|
|
2652
|
+
var CLAUDE_ONLY_HOOK_EVENTS = ["permissionRequest", "notification", "setup"];
|
|
2653
|
+
var CURSOR_HOOK_EVENTS = [
|
|
2654
|
+
...COMMON_HOOK_EVENTS,
|
|
2655
|
+
...CURSOR_ONLY_HOOK_EVENTS
|
|
2656
|
+
];
|
|
2657
|
+
var CLAUDE_HOOK_EVENTS = [
|
|
2658
|
+
...COMMON_HOOK_EVENTS,
|
|
2659
|
+
...CLAUDE_ONLY_HOOK_EVENTS
|
|
2660
|
+
];
|
|
2661
|
+
var hooksRecordSchema = import_mini13.z.record(import_mini13.z.string(), import_mini13.z.array(HookDefinitionSchema));
|
|
2662
|
+
var HooksConfigSchema = import_mini13.z.object({
|
|
2663
|
+
version: import_mini13.z.optional(import_mini13.z.number()),
|
|
2664
|
+
hooks: hooksRecordSchema,
|
|
2665
|
+
cursor: import_mini13.z.optional(import_mini13.z.object({ hooks: import_mini13.z.optional(hooksRecordSchema) })),
|
|
2666
|
+
claudecode: import_mini13.z.optional(import_mini13.z.object({ hooks: import_mini13.z.optional(hooksRecordSchema) }))
|
|
2667
|
+
});
|
|
2668
|
+
var CURSOR_TO_CLAUDE_EVENT_NAMES = {
|
|
2669
|
+
sessionStart: "SessionStart",
|
|
2670
|
+
sessionEnd: "SessionEnd",
|
|
2671
|
+
preToolUse: "PreToolUse",
|
|
2672
|
+
postToolUse: "PostToolUse",
|
|
2673
|
+
beforeSubmitPrompt: "UserPromptSubmit",
|
|
2674
|
+
stop: "Stop",
|
|
2675
|
+
subagentStop: "SubagentStop",
|
|
2676
|
+
preCompact: "PreCompact",
|
|
2677
|
+
permissionRequest: "PermissionRequest",
|
|
2678
|
+
notification: "Notification",
|
|
2679
|
+
setup: "Setup"
|
|
2680
|
+
};
|
|
2681
|
+
var CLAUDE_TO_CURSOR_EVENT_NAMES = Object.fromEntries(
|
|
2682
|
+
Object.entries(CURSOR_TO_CLAUDE_EVENT_NAMES).map(([k, v]) => [v, k])
|
|
2683
|
+
);
|
|
2608
2684
|
|
|
2609
|
-
// src/features/
|
|
2685
|
+
// src/features/hooks/claudecode-hooks.ts
|
|
2610
2686
|
var import_node_path21 = require("path");
|
|
2611
2687
|
|
|
2612
2688
|
// src/types/tool-file.ts
|
|
2613
2689
|
var ToolFile = class extends AiFile {
|
|
2614
2690
|
};
|
|
2615
2691
|
|
|
2616
|
-
// src/features/
|
|
2692
|
+
// src/features/hooks/rulesync-hooks.ts
|
|
2617
2693
|
var import_node_path20 = require("path");
|
|
2618
|
-
var
|
|
2619
|
-
|
|
2620
|
-
|
|
2694
|
+
var RulesyncHooks = class _RulesyncHooks extends RulesyncFile {
|
|
2695
|
+
json;
|
|
2696
|
+
constructor(params) {
|
|
2697
|
+
super({ ...params });
|
|
2698
|
+
this.json = JSON.parse(this.fileContent);
|
|
2699
|
+
if (params.validate) {
|
|
2700
|
+
const result = this.validate();
|
|
2701
|
+
if (!result.success) {
|
|
2702
|
+
throw result.error;
|
|
2703
|
+
}
|
|
2704
|
+
}
|
|
2621
2705
|
}
|
|
2622
2706
|
static getSettablePaths() {
|
|
2623
2707
|
return {
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
relativeFilePath: RULESYNC_AIIGNORE_FILE_NAME
|
|
2627
|
-
},
|
|
2628
|
-
legacy: {
|
|
2629
|
-
relativeDirPath: ".",
|
|
2630
|
-
relativeFilePath: RULESYNC_IGNORE_RELATIVE_FILE_PATH
|
|
2631
|
-
}
|
|
2708
|
+
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
2709
|
+
relativeFilePath: "hooks.json"
|
|
2632
2710
|
};
|
|
2633
2711
|
}
|
|
2634
|
-
|
|
2635
|
-
const
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
baseDir,
|
|
2639
|
-
paths.recommended.relativeDirPath,
|
|
2640
|
-
paths.recommended.relativeFilePath
|
|
2641
|
-
);
|
|
2642
|
-
const legacyPath = (0, import_node_path20.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
2643
|
-
if (await fileExists(recommendedPath)) {
|
|
2644
|
-
const fileContent2 = await readFileContent(recommendedPath);
|
|
2645
|
-
return new _RulesyncIgnore({
|
|
2646
|
-
baseDir,
|
|
2647
|
-
relativeDirPath: paths.recommended.relativeDirPath,
|
|
2648
|
-
relativeFilePath: paths.recommended.relativeFilePath,
|
|
2649
|
-
fileContent: fileContent2
|
|
2650
|
-
});
|
|
2712
|
+
validate() {
|
|
2713
|
+
const result = HooksConfigSchema.safeParse(this.json);
|
|
2714
|
+
if (!result.success) {
|
|
2715
|
+
return { success: false, error: result.error };
|
|
2651
2716
|
}
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2717
|
+
return { success: true, error: null };
|
|
2718
|
+
}
|
|
2719
|
+
static async fromFile({
|
|
2720
|
+
baseDir = process.cwd(),
|
|
2721
|
+
validate = true
|
|
2722
|
+
}) {
|
|
2723
|
+
const paths = _RulesyncHooks.getSettablePaths();
|
|
2724
|
+
const filePath = (0, import_node_path20.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
2725
|
+
if (!await fileExists(filePath)) {
|
|
2726
|
+
throw new Error(`No ${RULESYNC_HOOKS_RELATIVE_FILE_PATH} found.`);
|
|
2660
2727
|
}
|
|
2661
|
-
const fileContent = await readFileContent(
|
|
2662
|
-
return new
|
|
2728
|
+
const fileContent = await readFileContent(filePath);
|
|
2729
|
+
return new _RulesyncHooks({
|
|
2663
2730
|
baseDir,
|
|
2664
|
-
relativeDirPath: paths.
|
|
2665
|
-
relativeFilePath: paths.
|
|
2666
|
-
fileContent
|
|
2731
|
+
relativeDirPath: paths.relativeDirPath,
|
|
2732
|
+
relativeFilePath: paths.relativeFilePath,
|
|
2733
|
+
fileContent,
|
|
2734
|
+
validate
|
|
2667
2735
|
});
|
|
2668
2736
|
}
|
|
2737
|
+
getJson() {
|
|
2738
|
+
return this.json;
|
|
2739
|
+
}
|
|
2669
2740
|
};
|
|
2670
2741
|
|
|
2671
|
-
// src/features/
|
|
2672
|
-
var
|
|
2673
|
-
patterns;
|
|
2742
|
+
// src/features/hooks/tool-hooks.ts
|
|
2743
|
+
var ToolHooks = class extends ToolFile {
|
|
2674
2744
|
constructor(params) {
|
|
2675
2745
|
super({
|
|
2676
2746
|
...params,
|
|
2677
2747
|
validate: true
|
|
2678
2748
|
});
|
|
2679
|
-
this.patterns = this.fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
2680
2749
|
if (params.validate) {
|
|
2681
2750
|
const result = this.validate();
|
|
2682
2751
|
if (!result.success) {
|
|
@@ -2684,151 +2753,653 @@ var ToolIgnore = class extends ToolFile {
|
|
|
2684
2753
|
}
|
|
2685
2754
|
}
|
|
2686
2755
|
}
|
|
2687
|
-
static getSettablePaths() {
|
|
2688
|
-
throw new Error("Please implement this method in the subclass.");
|
|
2689
|
-
}
|
|
2690
|
-
getPatterns() {
|
|
2691
|
-
return this.patterns;
|
|
2692
|
-
}
|
|
2693
|
-
validate() {
|
|
2694
|
-
return { success: true, error: null };
|
|
2695
|
-
}
|
|
2696
|
-
static fromRulesyncIgnore(_params) {
|
|
2756
|
+
static getSettablePaths(_options) {
|
|
2697
2757
|
throw new Error("Please implement this method in the subclass.");
|
|
2698
2758
|
}
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2759
|
+
toRulesyncHooksDefault({
|
|
2760
|
+
fileContent = void 0
|
|
2761
|
+
} = {}) {
|
|
2762
|
+
return new RulesyncHooks({
|
|
2763
|
+
baseDir: this.baseDir,
|
|
2702
2764
|
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
2703
|
-
relativeFilePath:
|
|
2704
|
-
fileContent: this.fileContent
|
|
2765
|
+
relativeFilePath: "hooks.json",
|
|
2766
|
+
fileContent: fileContent ?? this.fileContent
|
|
2705
2767
|
});
|
|
2706
2768
|
}
|
|
2707
2769
|
static async fromFile(_params) {
|
|
2708
2770
|
throw new Error("Please implement this method in the subclass.");
|
|
2709
2771
|
}
|
|
2710
|
-
/**
|
|
2711
|
-
* Create a minimal instance for deletion purposes.
|
|
2712
|
-
* This method does not read or parse file content, making it safe to use
|
|
2713
|
-
* even when files have old/incompatible formats.
|
|
2714
|
-
*/
|
|
2715
2772
|
static forDeletion(_params) {
|
|
2716
2773
|
throw new Error("Please implement this method in the subclass.");
|
|
2717
2774
|
}
|
|
2718
2775
|
};
|
|
2719
2776
|
|
|
2720
|
-
// src/features/
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2777
|
+
// src/features/hooks/claudecode-hooks.ts
|
|
2778
|
+
function canonicalToClaudeHooks(config) {
|
|
2779
|
+
const claudeSupported = new Set(CLAUDE_HOOK_EVENTS);
|
|
2780
|
+
const sharedHooks = {};
|
|
2781
|
+
for (const [event, defs] of Object.entries(config.hooks)) {
|
|
2782
|
+
if (claudeSupported.has(event)) {
|
|
2783
|
+
sharedHooks[event] = defs;
|
|
2784
|
+
}
|
|
2727
2785
|
}
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2786
|
+
const effectiveHooks = {
|
|
2787
|
+
...sharedHooks,
|
|
2788
|
+
...config.claudecode?.hooks
|
|
2789
|
+
};
|
|
2790
|
+
const claude = {};
|
|
2791
|
+
for (const [eventName, definitions] of Object.entries(effectiveHooks)) {
|
|
2792
|
+
const claudeEventName = CURSOR_TO_CLAUDE_EVENT_NAMES[eventName] ?? eventName;
|
|
2793
|
+
const byMatcher = /* @__PURE__ */ new Map();
|
|
2794
|
+
for (const def of definitions) {
|
|
2795
|
+
const key = def.matcher ?? "";
|
|
2796
|
+
const list = byMatcher.get(key);
|
|
2797
|
+
if (list) list.push(def);
|
|
2798
|
+
else byMatcher.set(key, [def]);
|
|
2799
|
+
}
|
|
2800
|
+
const entries = [];
|
|
2801
|
+
for (const [matcherKey, defs] of byMatcher) {
|
|
2802
|
+
const hooks = defs.map((def) => {
|
|
2803
|
+
const command = def.command !== void 0 && def.command !== null && !def.command.startsWith("$") ? `$CLAUDE_PROJECT_DIR/${def.command.replace(/^\.\//, "")}` : def.command;
|
|
2804
|
+
return {
|
|
2805
|
+
type: def.type ?? "command",
|
|
2806
|
+
...command !== void 0 && command !== null && { command },
|
|
2807
|
+
...def.timeout !== void 0 && def.timeout !== null && { timeout: def.timeout },
|
|
2808
|
+
...def.prompt !== void 0 && def.prompt !== null && { prompt: def.prompt }
|
|
2809
|
+
};
|
|
2810
|
+
});
|
|
2811
|
+
entries.push(matcherKey ? { matcher: matcherKey, hooks } : { hooks });
|
|
2812
|
+
}
|
|
2813
|
+
claude[claudeEventName] = entries;
|
|
2733
2814
|
}
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2815
|
+
return claude;
|
|
2816
|
+
}
|
|
2817
|
+
function isClaudeMatcherEntry(x) {
|
|
2818
|
+
if (x === null || typeof x !== "object") {
|
|
2819
|
+
return false;
|
|
2820
|
+
}
|
|
2821
|
+
if ("matcher" in x && typeof x.matcher !== "string") {
|
|
2822
|
+
return false;
|
|
2823
|
+
}
|
|
2824
|
+
if ("hooks" in x && !Array.isArray(x.hooks)) {
|
|
2825
|
+
return false;
|
|
2826
|
+
}
|
|
2827
|
+
return true;
|
|
2828
|
+
}
|
|
2829
|
+
function claudeHooksToCanonical(claudeHooks) {
|
|
2830
|
+
if (claudeHooks === null || claudeHooks === void 0 || typeof claudeHooks !== "object") {
|
|
2831
|
+
return {};
|
|
2832
|
+
}
|
|
2833
|
+
const canonical = {};
|
|
2834
|
+
for (const [claudeEventName, matcherEntries] of Object.entries(claudeHooks)) {
|
|
2835
|
+
const eventName = CLAUDE_TO_CURSOR_EVENT_NAMES[claudeEventName] ?? claudeEventName;
|
|
2836
|
+
if (!Array.isArray(matcherEntries)) continue;
|
|
2837
|
+
const defs = [];
|
|
2838
|
+
for (const rawEntry of matcherEntries) {
|
|
2839
|
+
if (!isClaudeMatcherEntry(rawEntry)) continue;
|
|
2840
|
+
const entry = rawEntry;
|
|
2841
|
+
const hooks = entry.hooks ?? [];
|
|
2842
|
+
for (const h of hooks) {
|
|
2843
|
+
const cmd = typeof h.command === "string" ? h.command : void 0;
|
|
2844
|
+
const command = typeof cmd === "string" && cmd.includes("$CLAUDE_PROJECT_DIR/") ? cmd.replace(/^\$CLAUDE_PROJECT_DIR\/?/, "./") : cmd;
|
|
2845
|
+
const hookType = h.type === "command" || h.type === "prompt" ? h.type : "command";
|
|
2846
|
+
const timeout = typeof h.timeout === "number" ? h.timeout : void 0;
|
|
2847
|
+
const prompt = typeof h.prompt === "string" ? h.prompt : void 0;
|
|
2848
|
+
defs.push({
|
|
2849
|
+
type: hookType,
|
|
2850
|
+
...command !== void 0 && command !== null && { command },
|
|
2851
|
+
...timeout !== void 0 && timeout !== null && { timeout },
|
|
2852
|
+
...prompt !== void 0 && prompt !== null && { prompt },
|
|
2853
|
+
...entry.matcher !== void 0 && entry.matcher !== null && entry.matcher !== "" && { matcher: entry.matcher }
|
|
2854
|
+
});
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
if (defs.length > 0) {
|
|
2858
|
+
canonical[eventName] = defs;
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
return canonical;
|
|
2862
|
+
}
|
|
2863
|
+
var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
2864
|
+
constructor(params) {
|
|
2865
|
+
super({
|
|
2866
|
+
...params,
|
|
2867
|
+
fileContent: params.fileContent ?? "{}"
|
|
2868
|
+
});
|
|
2869
|
+
}
|
|
2870
|
+
isDeletable() {
|
|
2871
|
+
return false;
|
|
2872
|
+
}
|
|
2873
|
+
static getSettablePaths(_options = {}) {
|
|
2874
|
+
return { relativeDirPath: ".claude", relativeFilePath: "settings.json" };
|
|
2875
|
+
}
|
|
2876
|
+
static async fromFile({
|
|
2739
2877
|
baseDir = process.cwd(),
|
|
2740
|
-
|
|
2878
|
+
validate = true,
|
|
2879
|
+
global = false
|
|
2741
2880
|
}) {
|
|
2742
|
-
|
|
2881
|
+
const paths = _ClaudecodeHooks.getSettablePaths({ global });
|
|
2882
|
+
const filePath = (0, import_node_path21.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
2883
|
+
const fileContent = await readOrInitializeFileContent(
|
|
2884
|
+
filePath,
|
|
2885
|
+
JSON.stringify({ hooks: {} }, null, 2)
|
|
2886
|
+
);
|
|
2887
|
+
return new _ClaudecodeHooks({
|
|
2743
2888
|
baseDir,
|
|
2744
|
-
relativeDirPath:
|
|
2745
|
-
relativeFilePath:
|
|
2746
|
-
fileContent
|
|
2889
|
+
relativeDirPath: paths.relativeDirPath,
|
|
2890
|
+
relativeFilePath: paths.relativeFilePath,
|
|
2891
|
+
fileContent,
|
|
2892
|
+
validate
|
|
2747
2893
|
});
|
|
2748
2894
|
}
|
|
2749
|
-
|
|
2750
|
-
* Create AugmentcodeIgnore from file path
|
|
2751
|
-
* Reads and parses .augmentignore file
|
|
2752
|
-
*/
|
|
2753
|
-
static async fromFile({
|
|
2895
|
+
static async fromRulesyncHooks({
|
|
2754
2896
|
baseDir = process.cwd(),
|
|
2755
|
-
|
|
2897
|
+
rulesyncHooks,
|
|
2898
|
+
validate = true,
|
|
2899
|
+
global = false
|
|
2756
2900
|
}) {
|
|
2757
|
-
const
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
)
|
|
2901
|
+
const paths = _ClaudecodeHooks.getSettablePaths({ global });
|
|
2902
|
+
const filePath = (0, import_node_path21.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
2903
|
+
const existingContent = await readOrInitializeFileContent(
|
|
2904
|
+
filePath,
|
|
2905
|
+
JSON.stringify({}, null, 2)
|
|
2763
2906
|
);
|
|
2764
|
-
|
|
2907
|
+
let settings;
|
|
2908
|
+
try {
|
|
2909
|
+
settings = JSON.parse(existingContent);
|
|
2910
|
+
} catch (error) {
|
|
2911
|
+
throw new Error(
|
|
2912
|
+
`Failed to parse existing Claude settings at ${filePath}: ${formatError(error)}`,
|
|
2913
|
+
{ cause: error }
|
|
2914
|
+
);
|
|
2915
|
+
}
|
|
2916
|
+
const config = rulesyncHooks.getJson();
|
|
2917
|
+
const claudeHooks = canonicalToClaudeHooks(config);
|
|
2918
|
+
const merged = { ...settings, hooks: claudeHooks };
|
|
2919
|
+
const fileContent = JSON.stringify(merged, null, 2);
|
|
2920
|
+
return new _ClaudecodeHooks({
|
|
2765
2921
|
baseDir,
|
|
2766
|
-
relativeDirPath:
|
|
2767
|
-
relativeFilePath:
|
|
2922
|
+
relativeDirPath: paths.relativeDirPath,
|
|
2923
|
+
relativeFilePath: paths.relativeFilePath,
|
|
2768
2924
|
fileContent,
|
|
2769
2925
|
validate
|
|
2770
2926
|
});
|
|
2771
2927
|
}
|
|
2928
|
+
toRulesyncHooks() {
|
|
2929
|
+
let settings;
|
|
2930
|
+
try {
|
|
2931
|
+
settings = JSON.parse(this.getFileContent());
|
|
2932
|
+
} catch (error) {
|
|
2933
|
+
throw new Error(`Failed to parse Claude hooks content: ${formatError(error)}`, {
|
|
2934
|
+
cause: error
|
|
2935
|
+
});
|
|
2936
|
+
}
|
|
2937
|
+
const hooks = claudeHooksToCanonical(settings.hooks);
|
|
2938
|
+
return this.toRulesyncHooksDefault({
|
|
2939
|
+
fileContent: JSON.stringify({ version: 1, hooks }, null, 2)
|
|
2940
|
+
});
|
|
2941
|
+
}
|
|
2942
|
+
validate() {
|
|
2943
|
+
return { success: true, error: null };
|
|
2944
|
+
}
|
|
2772
2945
|
static forDeletion({
|
|
2773
2946
|
baseDir = process.cwd(),
|
|
2774
2947
|
relativeDirPath,
|
|
2775
2948
|
relativeFilePath
|
|
2776
2949
|
}) {
|
|
2777
|
-
return new
|
|
2950
|
+
return new _ClaudecodeHooks({
|
|
2778
2951
|
baseDir,
|
|
2779
2952
|
relativeDirPath,
|
|
2780
2953
|
relativeFilePath,
|
|
2781
|
-
fileContent:
|
|
2954
|
+
fileContent: JSON.stringify({ hooks: {} }, null, 2),
|
|
2782
2955
|
validate: false
|
|
2783
2956
|
});
|
|
2784
2957
|
}
|
|
2785
2958
|
};
|
|
2786
2959
|
|
|
2787
|
-
// src/features/
|
|
2788
|
-
var import_es_toolkit2 = require("es-toolkit");
|
|
2960
|
+
// src/features/hooks/cursor-hooks.ts
|
|
2789
2961
|
var import_node_path22 = require("path");
|
|
2790
|
-
var
|
|
2962
|
+
var CursorHooks = class _CursorHooks extends ToolHooks {
|
|
2791
2963
|
constructor(params) {
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2964
|
+
const { rulesyncHooks: _r, ...rest } = params;
|
|
2965
|
+
super({
|
|
2966
|
+
...rest,
|
|
2967
|
+
fileContent: rest.fileContent ?? "{}"
|
|
2968
|
+
});
|
|
2795
2969
|
}
|
|
2796
2970
|
static getSettablePaths() {
|
|
2797
2971
|
return {
|
|
2798
|
-
relativeDirPath: ".
|
|
2799
|
-
relativeFilePath: "
|
|
2972
|
+
relativeDirPath: ".cursor",
|
|
2973
|
+
relativeFilePath: "hooks.json"
|
|
2800
2974
|
};
|
|
2801
2975
|
}
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
const fileContent = rulesyncPatterns.join("\n");
|
|
2817
|
-
return new RulesyncIgnore({
|
|
2818
|
-
baseDir: this.baseDir,
|
|
2819
|
-
relativeDirPath: RulesyncIgnore.getSettablePaths().recommended.relativeDirPath,
|
|
2820
|
-
relativeFilePath: RulesyncIgnore.getSettablePaths().recommended.relativeFilePath,
|
|
2821
|
-
fileContent
|
|
2976
|
+
static async fromFile({
|
|
2977
|
+
baseDir = process.cwd(),
|
|
2978
|
+
validate = true
|
|
2979
|
+
}) {
|
|
2980
|
+
const paths = _CursorHooks.getSettablePaths();
|
|
2981
|
+
const fileContent = await readFileContent(
|
|
2982
|
+
(0, import_node_path22.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
2983
|
+
);
|
|
2984
|
+
return new _CursorHooks({
|
|
2985
|
+
baseDir,
|
|
2986
|
+
relativeDirPath: paths.relativeDirPath,
|
|
2987
|
+
relativeFilePath: paths.relativeFilePath,
|
|
2988
|
+
fileContent,
|
|
2989
|
+
validate
|
|
2822
2990
|
});
|
|
2823
2991
|
}
|
|
2824
|
-
static
|
|
2992
|
+
static fromRulesyncHooks({
|
|
2825
2993
|
baseDir = process.cwd(),
|
|
2826
|
-
|
|
2994
|
+
rulesyncHooks,
|
|
2995
|
+
validate = true
|
|
2827
2996
|
}) {
|
|
2828
|
-
const
|
|
2829
|
-
const
|
|
2997
|
+
const config = rulesyncHooks.getJson();
|
|
2998
|
+
const cursorSupported = new Set(CURSOR_HOOK_EVENTS);
|
|
2999
|
+
const sharedHooks = {};
|
|
3000
|
+
for (const [event, defs] of Object.entries(config.hooks)) {
|
|
3001
|
+
if (cursorSupported.has(event)) {
|
|
3002
|
+
sharedHooks[event] = defs;
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
const mergedHooks = {
|
|
3006
|
+
...sharedHooks,
|
|
3007
|
+
...config.cursor?.hooks
|
|
3008
|
+
};
|
|
3009
|
+
const cursorConfig = {
|
|
3010
|
+
version: config.version ?? 1,
|
|
3011
|
+
hooks: mergedHooks
|
|
3012
|
+
};
|
|
3013
|
+
const fileContent = JSON.stringify(cursorConfig, null, 2);
|
|
3014
|
+
const paths = _CursorHooks.getSettablePaths();
|
|
3015
|
+
return new _CursorHooks({
|
|
3016
|
+
baseDir,
|
|
3017
|
+
relativeDirPath: paths.relativeDirPath,
|
|
3018
|
+
relativeFilePath: paths.relativeFilePath,
|
|
3019
|
+
fileContent,
|
|
3020
|
+
validate,
|
|
3021
|
+
rulesyncHooks
|
|
3022
|
+
});
|
|
3023
|
+
}
|
|
3024
|
+
toRulesyncHooks() {
|
|
3025
|
+
const content = this.getFileContent();
|
|
3026
|
+
const parsed = JSON.parse(content);
|
|
3027
|
+
const hooks = parsed.hooks ?? {};
|
|
3028
|
+
const version = parsed.version ?? 1;
|
|
3029
|
+
return this.toRulesyncHooksDefault({
|
|
3030
|
+
fileContent: JSON.stringify({ version, hooks }, null, 2)
|
|
3031
|
+
});
|
|
3032
|
+
}
|
|
3033
|
+
validate() {
|
|
3034
|
+
return { success: true, error: null };
|
|
3035
|
+
}
|
|
3036
|
+
static forDeletion({
|
|
3037
|
+
baseDir = process.cwd(),
|
|
3038
|
+
relativeDirPath,
|
|
3039
|
+
relativeFilePath
|
|
3040
|
+
}) {
|
|
3041
|
+
return new _CursorHooks({
|
|
3042
|
+
baseDir,
|
|
3043
|
+
relativeDirPath,
|
|
3044
|
+
relativeFilePath,
|
|
3045
|
+
fileContent: "{}",
|
|
3046
|
+
validate: false
|
|
3047
|
+
});
|
|
3048
|
+
}
|
|
3049
|
+
};
|
|
3050
|
+
|
|
3051
|
+
// src/features/hooks/hooks-processor.ts
|
|
3052
|
+
var hooksProcessorToolTargetTuple = ["cursor", "claudecode"];
|
|
3053
|
+
var HooksProcessorToolTargetSchema = import_mini14.z.enum(hooksProcessorToolTargetTuple);
|
|
3054
|
+
var toolHooksFactories = /* @__PURE__ */ new Map([
|
|
3055
|
+
[
|
|
3056
|
+
"cursor",
|
|
3057
|
+
{
|
|
3058
|
+
class: CursorHooks,
|
|
3059
|
+
meta: { supportsProject: true, supportsGlobal: false }
|
|
3060
|
+
}
|
|
3061
|
+
],
|
|
3062
|
+
[
|
|
3063
|
+
"claudecode",
|
|
3064
|
+
{
|
|
3065
|
+
class: ClaudecodeHooks,
|
|
3066
|
+
meta: { supportsProject: true, supportsGlobal: true }
|
|
3067
|
+
}
|
|
3068
|
+
]
|
|
3069
|
+
]);
|
|
3070
|
+
var hooksProcessorToolTargets = [...toolHooksFactories.keys()];
|
|
3071
|
+
var hooksProcessorToolTargetsGlobal = [...toolHooksFactories.entries()].filter(([, f]) => f.meta.supportsGlobal).map(([t]) => t);
|
|
3072
|
+
var HooksProcessor = class extends FeatureProcessor {
|
|
3073
|
+
toolTarget;
|
|
3074
|
+
global;
|
|
3075
|
+
constructor({
|
|
3076
|
+
baseDir = process.cwd(),
|
|
3077
|
+
toolTarget,
|
|
3078
|
+
global = false
|
|
3079
|
+
}) {
|
|
3080
|
+
super({ baseDir });
|
|
3081
|
+
const result = HooksProcessorToolTargetSchema.safeParse(toolTarget);
|
|
3082
|
+
if (!result.success) {
|
|
3083
|
+
throw new Error(
|
|
3084
|
+
`Invalid tool target for HooksProcessor: ${toolTarget}. ${formatError(result.error)}`
|
|
3085
|
+
);
|
|
3086
|
+
}
|
|
3087
|
+
this.toolTarget = result.data;
|
|
3088
|
+
this.global = global;
|
|
3089
|
+
}
|
|
3090
|
+
async loadRulesyncFiles() {
|
|
3091
|
+
try {
|
|
3092
|
+
return [
|
|
3093
|
+
await RulesyncHooks.fromFile({
|
|
3094
|
+
baseDir: this.baseDir,
|
|
3095
|
+
validate: true
|
|
3096
|
+
})
|
|
3097
|
+
];
|
|
3098
|
+
} catch (error) {
|
|
3099
|
+
logger.error(`Failed to load Rulesync hooks file: ${formatError(error)}`);
|
|
3100
|
+
return [];
|
|
3101
|
+
}
|
|
3102
|
+
}
|
|
3103
|
+
async loadToolFiles({ forDeletion = false } = {}) {
|
|
3104
|
+
try {
|
|
3105
|
+
const factory = toolHooksFactories.get(this.toolTarget);
|
|
3106
|
+
if (!factory) throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
3107
|
+
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
3108
|
+
if (forDeletion) {
|
|
3109
|
+
const toolHooks2 = factory.class.forDeletion({
|
|
3110
|
+
baseDir: this.baseDir,
|
|
3111
|
+
relativeDirPath: paths.relativeDirPath,
|
|
3112
|
+
relativeFilePath: paths.relativeFilePath,
|
|
3113
|
+
global: this.global
|
|
3114
|
+
});
|
|
3115
|
+
const list = toolHooks2.isDeletable?.() !== false ? [toolHooks2] : [];
|
|
3116
|
+
logger.info(
|
|
3117
|
+
`Successfully loaded ${list.length} ${this.toolTarget} hooks files for deletion`
|
|
3118
|
+
);
|
|
3119
|
+
return list;
|
|
3120
|
+
}
|
|
3121
|
+
const fromFile = this.toolTarget === "cursor" ? CursorHooks.fromFile({ baseDir: this.baseDir, validate: true }) : ClaudecodeHooks.fromFile({
|
|
3122
|
+
baseDir: this.baseDir,
|
|
3123
|
+
validate: true,
|
|
3124
|
+
global: this.global
|
|
3125
|
+
});
|
|
3126
|
+
const toolHooks = await fromFile;
|
|
3127
|
+
logger.info(`Successfully loaded 1 ${this.toolTarget} hooks file`);
|
|
3128
|
+
return [toolHooks];
|
|
3129
|
+
} catch (error) {
|
|
3130
|
+
const msg = `Failed to load hooks files for tool target: ${this.toolTarget}: ${formatError(error)}`;
|
|
3131
|
+
if (error instanceof Error && error.message.includes("no such file or directory")) {
|
|
3132
|
+
logger.debug(msg);
|
|
3133
|
+
} else {
|
|
3134
|
+
logger.error(msg);
|
|
3135
|
+
}
|
|
3136
|
+
return [];
|
|
3137
|
+
}
|
|
3138
|
+
}
|
|
3139
|
+
async convertRulesyncFilesToToolFiles(rulesyncFiles) {
|
|
3140
|
+
const rulesyncHooks = rulesyncFiles.find((f) => f instanceof RulesyncHooks);
|
|
3141
|
+
if (!rulesyncHooks) {
|
|
3142
|
+
throw new Error(`No ${RULESYNC_HOOKS_RELATIVE_FILE_PATH} found.`);
|
|
3143
|
+
}
|
|
3144
|
+
const config = rulesyncHooks.getJson();
|
|
3145
|
+
const supportedSet = new Set(
|
|
3146
|
+
this.toolTarget === "cursor" ? CURSOR_HOOK_EVENTS : CLAUDE_HOOK_EVENTS
|
|
3147
|
+
);
|
|
3148
|
+
const configEventNames = /* @__PURE__ */ new Set([
|
|
3149
|
+
...Object.keys(config.hooks),
|
|
3150
|
+
...this.toolTarget === "cursor" ? Object.keys(config.cursor?.hooks ?? {}) : Object.keys(config.claudecode?.hooks ?? {})
|
|
3151
|
+
]);
|
|
3152
|
+
const skipped = [...configEventNames].filter((e) => !supportedSet.has(e));
|
|
3153
|
+
if (skipped.length > 0) {
|
|
3154
|
+
logger.warn(
|
|
3155
|
+
`Skipped hook event(s) for ${this.toolTarget} (not supported): ${skipped.join(", ")}`
|
|
3156
|
+
);
|
|
3157
|
+
}
|
|
3158
|
+
const factory = toolHooksFactories.get(this.toolTarget);
|
|
3159
|
+
if (!factory) throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
3160
|
+
const toolHooks = this.toolTarget === "cursor" ? CursorHooks.fromRulesyncHooks({
|
|
3161
|
+
baseDir: this.baseDir,
|
|
3162
|
+
rulesyncHooks,
|
|
3163
|
+
validate: true
|
|
3164
|
+
}) : await ClaudecodeHooks.fromRulesyncHooks({
|
|
3165
|
+
baseDir: this.baseDir,
|
|
3166
|
+
rulesyncHooks,
|
|
3167
|
+
validate: true,
|
|
3168
|
+
global: this.global
|
|
3169
|
+
});
|
|
3170
|
+
return [toolHooks];
|
|
3171
|
+
}
|
|
3172
|
+
async convertToolFilesToRulesyncFiles(toolFiles) {
|
|
3173
|
+
const hooks = toolFiles.filter((f) => f instanceof ToolHooks);
|
|
3174
|
+
return hooks.map((h) => h.toRulesyncHooks());
|
|
3175
|
+
}
|
|
3176
|
+
static getToolTargets({ global = false } = {}) {
|
|
3177
|
+
return global ? hooksProcessorToolTargetsGlobal : hooksProcessorToolTargets;
|
|
3178
|
+
}
|
|
3179
|
+
};
|
|
3180
|
+
|
|
3181
|
+
// src/features/ignore/ignore-processor.ts
|
|
3182
|
+
var import_mini15 = require("zod/mini");
|
|
3183
|
+
|
|
3184
|
+
// src/features/ignore/augmentcode-ignore.ts
|
|
3185
|
+
var import_node_path24 = require("path");
|
|
3186
|
+
|
|
3187
|
+
// src/features/ignore/rulesync-ignore.ts
|
|
3188
|
+
var import_node_path23 = require("path");
|
|
3189
|
+
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
3190
|
+
validate() {
|
|
3191
|
+
return { success: true, error: null };
|
|
3192
|
+
}
|
|
3193
|
+
static getSettablePaths() {
|
|
3194
|
+
return {
|
|
3195
|
+
recommended: {
|
|
3196
|
+
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
3197
|
+
relativeFilePath: RULESYNC_AIIGNORE_FILE_NAME
|
|
3198
|
+
},
|
|
3199
|
+
legacy: {
|
|
3200
|
+
relativeDirPath: ".",
|
|
3201
|
+
relativeFilePath: RULESYNC_IGNORE_RELATIVE_FILE_PATH
|
|
3202
|
+
}
|
|
3203
|
+
};
|
|
3204
|
+
}
|
|
3205
|
+
static async fromFile() {
|
|
3206
|
+
const baseDir = process.cwd();
|
|
3207
|
+
const paths = this.getSettablePaths();
|
|
3208
|
+
const recommendedPath = (0, import_node_path23.join)(
|
|
3209
|
+
baseDir,
|
|
3210
|
+
paths.recommended.relativeDirPath,
|
|
3211
|
+
paths.recommended.relativeFilePath
|
|
3212
|
+
);
|
|
3213
|
+
const legacyPath = (0, import_node_path23.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
3214
|
+
if (await fileExists(recommendedPath)) {
|
|
3215
|
+
const fileContent2 = await readFileContent(recommendedPath);
|
|
3216
|
+
return new _RulesyncIgnore({
|
|
3217
|
+
baseDir,
|
|
3218
|
+
relativeDirPath: paths.recommended.relativeDirPath,
|
|
3219
|
+
relativeFilePath: paths.recommended.relativeFilePath,
|
|
3220
|
+
fileContent: fileContent2
|
|
3221
|
+
});
|
|
3222
|
+
}
|
|
3223
|
+
if (await fileExists(legacyPath)) {
|
|
3224
|
+
const fileContent2 = await readFileContent(legacyPath);
|
|
3225
|
+
return new _RulesyncIgnore({
|
|
3226
|
+
baseDir,
|
|
3227
|
+
relativeDirPath: paths.legacy.relativeDirPath,
|
|
3228
|
+
relativeFilePath: paths.legacy.relativeFilePath,
|
|
3229
|
+
fileContent: fileContent2
|
|
3230
|
+
});
|
|
3231
|
+
}
|
|
3232
|
+
const fileContent = await readFileContent(recommendedPath);
|
|
3233
|
+
return new _RulesyncIgnore({
|
|
3234
|
+
baseDir,
|
|
3235
|
+
relativeDirPath: paths.recommended.relativeDirPath,
|
|
3236
|
+
relativeFilePath: paths.recommended.relativeFilePath,
|
|
3237
|
+
fileContent
|
|
3238
|
+
});
|
|
3239
|
+
}
|
|
3240
|
+
};
|
|
3241
|
+
|
|
3242
|
+
// src/features/ignore/tool-ignore.ts
|
|
3243
|
+
var ToolIgnore = class extends ToolFile {
|
|
3244
|
+
patterns;
|
|
3245
|
+
constructor(params) {
|
|
3246
|
+
super({
|
|
3247
|
+
...params,
|
|
3248
|
+
validate: true
|
|
3249
|
+
});
|
|
3250
|
+
this.patterns = this.fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
3251
|
+
if (params.validate) {
|
|
3252
|
+
const result = this.validate();
|
|
3253
|
+
if (!result.success) {
|
|
3254
|
+
throw result.error;
|
|
3255
|
+
}
|
|
3256
|
+
}
|
|
3257
|
+
}
|
|
3258
|
+
static getSettablePaths() {
|
|
3259
|
+
throw new Error("Please implement this method in the subclass.");
|
|
3260
|
+
}
|
|
3261
|
+
getPatterns() {
|
|
3262
|
+
return this.patterns;
|
|
3263
|
+
}
|
|
3264
|
+
validate() {
|
|
3265
|
+
return { success: true, error: null };
|
|
3266
|
+
}
|
|
3267
|
+
static fromRulesyncIgnore(_params) {
|
|
3268
|
+
throw new Error("Please implement this method in the subclass.");
|
|
3269
|
+
}
|
|
3270
|
+
toRulesyncIgnoreDefault() {
|
|
3271
|
+
return new RulesyncIgnore({
|
|
3272
|
+
baseDir: ".",
|
|
3273
|
+
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
3274
|
+
relativeFilePath: RULESYNC_AIIGNORE_FILE_NAME,
|
|
3275
|
+
fileContent: this.fileContent
|
|
3276
|
+
});
|
|
3277
|
+
}
|
|
3278
|
+
static async fromFile(_params) {
|
|
3279
|
+
throw new Error("Please implement this method in the subclass.");
|
|
3280
|
+
}
|
|
3281
|
+
/**
|
|
3282
|
+
* Create a minimal instance for deletion purposes.
|
|
3283
|
+
* This method does not read or parse file content, making it safe to use
|
|
3284
|
+
* even when files have old/incompatible formats.
|
|
3285
|
+
*/
|
|
3286
|
+
static forDeletion(_params) {
|
|
3287
|
+
throw new Error("Please implement this method in the subclass.");
|
|
3288
|
+
}
|
|
3289
|
+
};
|
|
3290
|
+
|
|
3291
|
+
// src/features/ignore/augmentcode-ignore.ts
|
|
3292
|
+
var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
3293
|
+
static getSettablePaths() {
|
|
3294
|
+
return {
|
|
3295
|
+
relativeDirPath: ".",
|
|
3296
|
+
relativeFilePath: ".augmentignore"
|
|
3297
|
+
};
|
|
3298
|
+
}
|
|
3299
|
+
/**
|
|
3300
|
+
* Convert to RulesyncIgnore format
|
|
3301
|
+
*/
|
|
3302
|
+
toRulesyncIgnore() {
|
|
3303
|
+
return this.toRulesyncIgnoreDefault();
|
|
3304
|
+
}
|
|
3305
|
+
/**
|
|
3306
|
+
* Create AugmentcodeIgnore from RulesyncIgnore
|
|
3307
|
+
* Supports conversion from unified rulesync format to AugmentCode specific format
|
|
3308
|
+
*/
|
|
3309
|
+
static fromRulesyncIgnore({
|
|
3310
|
+
baseDir = process.cwd(),
|
|
3311
|
+
rulesyncIgnore
|
|
3312
|
+
}) {
|
|
3313
|
+
return new _AugmentcodeIgnore({
|
|
3314
|
+
baseDir,
|
|
3315
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
3316
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
3317
|
+
fileContent: rulesyncIgnore.getFileContent()
|
|
3318
|
+
});
|
|
3319
|
+
}
|
|
3320
|
+
/**
|
|
3321
|
+
* Create AugmentcodeIgnore from file path
|
|
3322
|
+
* Reads and parses .augmentignore file
|
|
3323
|
+
*/
|
|
3324
|
+
static async fromFile({
|
|
3325
|
+
baseDir = process.cwd(),
|
|
3326
|
+
validate = true
|
|
3327
|
+
}) {
|
|
3328
|
+
const fileContent = await readFileContent(
|
|
3329
|
+
(0, import_node_path24.join)(
|
|
3330
|
+
baseDir,
|
|
3331
|
+
this.getSettablePaths().relativeDirPath,
|
|
3332
|
+
this.getSettablePaths().relativeFilePath
|
|
3333
|
+
)
|
|
3334
|
+
);
|
|
3335
|
+
return new _AugmentcodeIgnore({
|
|
3336
|
+
baseDir,
|
|
3337
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
3338
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
3339
|
+
fileContent,
|
|
3340
|
+
validate
|
|
3341
|
+
});
|
|
3342
|
+
}
|
|
3343
|
+
static forDeletion({
|
|
3344
|
+
baseDir = process.cwd(),
|
|
3345
|
+
relativeDirPath,
|
|
3346
|
+
relativeFilePath
|
|
3347
|
+
}) {
|
|
3348
|
+
return new _AugmentcodeIgnore({
|
|
3349
|
+
baseDir,
|
|
3350
|
+
relativeDirPath,
|
|
3351
|
+
relativeFilePath,
|
|
3352
|
+
fileContent: "",
|
|
3353
|
+
validate: false
|
|
3354
|
+
});
|
|
3355
|
+
}
|
|
3356
|
+
};
|
|
3357
|
+
|
|
3358
|
+
// src/features/ignore/claudecode-ignore.ts
|
|
3359
|
+
var import_es_toolkit2 = require("es-toolkit");
|
|
3360
|
+
var import_node_path25 = require("path");
|
|
3361
|
+
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
3362
|
+
constructor(params) {
|
|
3363
|
+
super(params);
|
|
3364
|
+
const jsonValue = JSON.parse(this.fileContent);
|
|
3365
|
+
this.patterns = jsonValue.permissions?.deny ?? [];
|
|
3366
|
+
}
|
|
3367
|
+
static getSettablePaths() {
|
|
3368
|
+
return {
|
|
3369
|
+
relativeDirPath: ".claude",
|
|
3370
|
+
relativeFilePath: "settings.local.json"
|
|
3371
|
+
};
|
|
3372
|
+
}
|
|
3373
|
+
/**
|
|
3374
|
+
* ClaudecodeIgnore uses settings.local.json which is a user-managed config file.
|
|
3375
|
+
* It should not be deleted by rulesync.
|
|
3376
|
+
*/
|
|
3377
|
+
isDeletable() {
|
|
3378
|
+
return false;
|
|
3379
|
+
}
|
|
3380
|
+
toRulesyncIgnore() {
|
|
3381
|
+
const rulesyncPatterns = this.patterns.map((pattern) => {
|
|
3382
|
+
if (pattern.startsWith("Read(") && pattern.endsWith(")")) {
|
|
3383
|
+
return pattern.slice(5, -1);
|
|
3384
|
+
}
|
|
3385
|
+
return pattern;
|
|
3386
|
+
}).filter((pattern) => pattern.length > 0);
|
|
3387
|
+
const fileContent = rulesyncPatterns.join("\n");
|
|
3388
|
+
return new RulesyncIgnore({
|
|
3389
|
+
baseDir: this.baseDir,
|
|
3390
|
+
relativeDirPath: RulesyncIgnore.getSettablePaths().recommended.relativeDirPath,
|
|
3391
|
+
relativeFilePath: RulesyncIgnore.getSettablePaths().recommended.relativeFilePath,
|
|
3392
|
+
fileContent
|
|
3393
|
+
});
|
|
3394
|
+
}
|
|
3395
|
+
static async fromRulesyncIgnore({
|
|
3396
|
+
baseDir = process.cwd(),
|
|
3397
|
+
rulesyncIgnore
|
|
3398
|
+
}) {
|
|
3399
|
+
const fileContent = rulesyncIgnore.getFileContent();
|
|
3400
|
+
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
2830
3401
|
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
2831
|
-
const filePath = (0,
|
|
3402
|
+
const filePath = (0, import_node_path25.join)(
|
|
2832
3403
|
baseDir,
|
|
2833
3404
|
this.getSettablePaths().relativeDirPath,
|
|
2834
3405
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2864,7 +3435,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2864
3435
|
validate = true
|
|
2865
3436
|
}) {
|
|
2866
3437
|
const fileContent = await readFileContent(
|
|
2867
|
-
(0,
|
|
3438
|
+
(0, import_node_path25.join)(
|
|
2868
3439
|
baseDir,
|
|
2869
3440
|
this.getSettablePaths().relativeDirPath,
|
|
2870
3441
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2894,7 +3465,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2894
3465
|
};
|
|
2895
3466
|
|
|
2896
3467
|
// src/features/ignore/cline-ignore.ts
|
|
2897
|
-
var
|
|
3468
|
+
var import_node_path26 = require("path");
|
|
2898
3469
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
2899
3470
|
static getSettablePaths() {
|
|
2900
3471
|
return {
|
|
@@ -2931,7 +3502,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2931
3502
|
validate = true
|
|
2932
3503
|
}) {
|
|
2933
3504
|
const fileContent = await readFileContent(
|
|
2934
|
-
(0,
|
|
3505
|
+
(0, import_node_path26.join)(
|
|
2935
3506
|
baseDir,
|
|
2936
3507
|
this.getSettablePaths().relativeDirPath,
|
|
2937
3508
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2961,7 +3532,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2961
3532
|
};
|
|
2962
3533
|
|
|
2963
3534
|
// src/features/ignore/cursor-ignore.ts
|
|
2964
|
-
var
|
|
3535
|
+
var import_node_path27 = require("path");
|
|
2965
3536
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
2966
3537
|
static getSettablePaths() {
|
|
2967
3538
|
return {
|
|
@@ -2994,7 +3565,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2994
3565
|
validate = true
|
|
2995
3566
|
}) {
|
|
2996
3567
|
const fileContent = await readFileContent(
|
|
2997
|
-
(0,
|
|
3568
|
+
(0, import_node_path27.join)(
|
|
2998
3569
|
baseDir,
|
|
2999
3570
|
this.getSettablePaths().relativeDirPath,
|
|
3000
3571
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3024,7 +3595,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
3024
3595
|
};
|
|
3025
3596
|
|
|
3026
3597
|
// src/features/ignore/geminicli-ignore.ts
|
|
3027
|
-
var
|
|
3598
|
+
var import_node_path28 = require("path");
|
|
3028
3599
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
3029
3600
|
static getSettablePaths() {
|
|
3030
3601
|
return {
|
|
@@ -3051,7 +3622,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
3051
3622
|
validate = true
|
|
3052
3623
|
}) {
|
|
3053
3624
|
const fileContent = await readFileContent(
|
|
3054
|
-
(0,
|
|
3625
|
+
(0, import_node_path28.join)(
|
|
3055
3626
|
baseDir,
|
|
3056
3627
|
this.getSettablePaths().relativeDirPath,
|
|
3057
3628
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3081,7 +3652,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
3081
3652
|
};
|
|
3082
3653
|
|
|
3083
3654
|
// src/features/ignore/junie-ignore.ts
|
|
3084
|
-
var
|
|
3655
|
+
var import_node_path29 = require("path");
|
|
3085
3656
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
3086
3657
|
static getSettablePaths() {
|
|
3087
3658
|
return {
|
|
@@ -3108,7 +3679,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
3108
3679
|
validate = true
|
|
3109
3680
|
}) {
|
|
3110
3681
|
const fileContent = await readFileContent(
|
|
3111
|
-
(0,
|
|
3682
|
+
(0, import_node_path29.join)(
|
|
3112
3683
|
baseDir,
|
|
3113
3684
|
this.getSettablePaths().relativeDirPath,
|
|
3114
3685
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3138,7 +3709,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
3138
3709
|
};
|
|
3139
3710
|
|
|
3140
3711
|
// src/features/ignore/kilo-ignore.ts
|
|
3141
|
-
var
|
|
3712
|
+
var import_node_path30 = require("path");
|
|
3142
3713
|
var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
3143
3714
|
static getSettablePaths() {
|
|
3144
3715
|
return {
|
|
@@ -3175,7 +3746,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
3175
3746
|
validate = true
|
|
3176
3747
|
}) {
|
|
3177
3748
|
const fileContent = await readFileContent(
|
|
3178
|
-
(0,
|
|
3749
|
+
(0, import_node_path30.join)(
|
|
3179
3750
|
baseDir,
|
|
3180
3751
|
this.getSettablePaths().relativeDirPath,
|
|
3181
3752
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3205,7 +3776,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
3205
3776
|
};
|
|
3206
3777
|
|
|
3207
3778
|
// src/features/ignore/kiro-ignore.ts
|
|
3208
|
-
var
|
|
3779
|
+
var import_node_path31 = require("path");
|
|
3209
3780
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
3210
3781
|
static getSettablePaths() {
|
|
3211
3782
|
return {
|
|
@@ -3232,7 +3803,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
3232
3803
|
validate = true
|
|
3233
3804
|
}) {
|
|
3234
3805
|
const fileContent = await readFileContent(
|
|
3235
|
-
(0,
|
|
3806
|
+
(0, import_node_path31.join)(
|
|
3236
3807
|
baseDir,
|
|
3237
3808
|
this.getSettablePaths().relativeDirPath,
|
|
3238
3809
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3262,7 +3833,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
3262
3833
|
};
|
|
3263
3834
|
|
|
3264
3835
|
// src/features/ignore/qwencode-ignore.ts
|
|
3265
|
-
var
|
|
3836
|
+
var import_node_path32 = require("path");
|
|
3266
3837
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
3267
3838
|
static getSettablePaths() {
|
|
3268
3839
|
return {
|
|
@@ -3289,7 +3860,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
3289
3860
|
validate = true
|
|
3290
3861
|
}) {
|
|
3291
3862
|
const fileContent = await readFileContent(
|
|
3292
|
-
(0,
|
|
3863
|
+
(0, import_node_path32.join)(
|
|
3293
3864
|
baseDir,
|
|
3294
3865
|
this.getSettablePaths().relativeDirPath,
|
|
3295
3866
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3319,7 +3890,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
3319
3890
|
};
|
|
3320
3891
|
|
|
3321
3892
|
// src/features/ignore/roo-ignore.ts
|
|
3322
|
-
var
|
|
3893
|
+
var import_node_path33 = require("path");
|
|
3323
3894
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
3324
3895
|
static getSettablePaths() {
|
|
3325
3896
|
return {
|
|
@@ -3346,7 +3917,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
3346
3917
|
validate = true
|
|
3347
3918
|
}) {
|
|
3348
3919
|
const fileContent = await readFileContent(
|
|
3349
|
-
(0,
|
|
3920
|
+
(0, import_node_path33.join)(
|
|
3350
3921
|
baseDir,
|
|
3351
3922
|
this.getSettablePaths().relativeDirPath,
|
|
3352
3923
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3376,7 +3947,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
3376
3947
|
};
|
|
3377
3948
|
|
|
3378
3949
|
// src/features/ignore/windsurf-ignore.ts
|
|
3379
|
-
var
|
|
3950
|
+
var import_node_path34 = require("path");
|
|
3380
3951
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
3381
3952
|
static getSettablePaths() {
|
|
3382
3953
|
return {
|
|
@@ -3403,7 +3974,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3403
3974
|
validate = true
|
|
3404
3975
|
}) {
|
|
3405
3976
|
const fileContent = await readFileContent(
|
|
3406
|
-
(0,
|
|
3977
|
+
(0, import_node_path34.join)(
|
|
3407
3978
|
baseDir,
|
|
3408
3979
|
this.getSettablePaths().relativeDirPath,
|
|
3409
3980
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3434,7 +4005,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3434
4005
|
|
|
3435
4006
|
// src/features/ignore/zed-ignore.ts
|
|
3436
4007
|
var import_es_toolkit3 = require("es-toolkit");
|
|
3437
|
-
var
|
|
4008
|
+
var import_node_path35 = require("path");
|
|
3438
4009
|
var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
3439
4010
|
constructor(params) {
|
|
3440
4011
|
super(params);
|
|
@@ -3470,7 +4041,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
3470
4041
|
}) {
|
|
3471
4042
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
3472
4043
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
3473
|
-
const filePath = (0,
|
|
4044
|
+
const filePath = (0, import_node_path35.join)(
|
|
3474
4045
|
baseDir,
|
|
3475
4046
|
this.getSettablePaths().relativeDirPath,
|
|
3476
4047
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3497,7 +4068,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
3497
4068
|
validate = true
|
|
3498
4069
|
}) {
|
|
3499
4070
|
const fileContent = await readFileContent(
|
|
3500
|
-
(0,
|
|
4071
|
+
(0, import_node_path35.join)(
|
|
3501
4072
|
baseDir,
|
|
3502
4073
|
this.getSettablePaths().relativeDirPath,
|
|
3503
4074
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3542,7 +4113,7 @@ var ignoreProcessorToolTargets = [
|
|
|
3542
4113
|
"windsurf",
|
|
3543
4114
|
"zed"
|
|
3544
4115
|
];
|
|
3545
|
-
var IgnoreProcessorToolTargetSchema =
|
|
4116
|
+
var IgnoreProcessorToolTargetSchema = import_mini15.z.enum(ignoreProcessorToolTargets);
|
|
3546
4117
|
var toolIgnoreFactories = /* @__PURE__ */ new Map([
|
|
3547
4118
|
["augmentcode", { class: AugmentcodeIgnore }],
|
|
3548
4119
|
["claudecode", { class: ClaudecodeIgnore }],
|
|
@@ -3676,45 +4247,45 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
3676
4247
|
};
|
|
3677
4248
|
|
|
3678
4249
|
// src/features/mcp/mcp-processor.ts
|
|
3679
|
-
var
|
|
4250
|
+
var import_mini20 = require("zod/mini");
|
|
3680
4251
|
|
|
3681
4252
|
// src/features/mcp/claudecode-mcp.ts
|
|
3682
|
-
var
|
|
4253
|
+
var import_node_path38 = require("path");
|
|
3683
4254
|
|
|
3684
4255
|
// src/features/mcp/modular-mcp.ts
|
|
3685
|
-
var
|
|
3686
|
-
var
|
|
4256
|
+
var import_node_path36 = require("path");
|
|
4257
|
+
var import_mini17 = require("zod/mini");
|
|
3687
4258
|
|
|
3688
4259
|
// src/types/mcp.ts
|
|
3689
|
-
var
|
|
3690
|
-
var McpServerSchema =
|
|
3691
|
-
type:
|
|
3692
|
-
command:
|
|
3693
|
-
args:
|
|
3694
|
-
url:
|
|
3695
|
-
httpUrl:
|
|
3696
|
-
env:
|
|
3697
|
-
disabled:
|
|
3698
|
-
networkTimeout:
|
|
3699
|
-
timeout:
|
|
3700
|
-
trust:
|
|
3701
|
-
cwd:
|
|
3702
|
-
transport:
|
|
3703
|
-
alwaysAllow:
|
|
3704
|
-
tools:
|
|
3705
|
-
kiroAutoApprove:
|
|
3706
|
-
kiroAutoBlock:
|
|
3707
|
-
headers:
|
|
4260
|
+
var import_mini16 = require("zod/mini");
|
|
4261
|
+
var McpServerSchema = import_mini16.z.object({
|
|
4262
|
+
type: import_mini16.z.optional(import_mini16.z.enum(["stdio", "sse", "http"])),
|
|
4263
|
+
command: import_mini16.z.optional(import_mini16.z.union([import_mini16.z.string(), import_mini16.z.array(import_mini16.z.string())])),
|
|
4264
|
+
args: import_mini16.z.optional(import_mini16.z.array(import_mini16.z.string())),
|
|
4265
|
+
url: import_mini16.z.optional(import_mini16.z.string()),
|
|
4266
|
+
httpUrl: import_mini16.z.optional(import_mini16.z.string()),
|
|
4267
|
+
env: import_mini16.z.optional(import_mini16.z.record(import_mini16.z.string(), import_mini16.z.string())),
|
|
4268
|
+
disabled: import_mini16.z.optional(import_mini16.z.boolean()),
|
|
4269
|
+
networkTimeout: import_mini16.z.optional(import_mini16.z.number()),
|
|
4270
|
+
timeout: import_mini16.z.optional(import_mini16.z.number()),
|
|
4271
|
+
trust: import_mini16.z.optional(import_mini16.z.boolean()),
|
|
4272
|
+
cwd: import_mini16.z.optional(import_mini16.z.string()),
|
|
4273
|
+
transport: import_mini16.z.optional(import_mini16.z.enum(["stdio", "sse", "http"])),
|
|
4274
|
+
alwaysAllow: import_mini16.z.optional(import_mini16.z.array(import_mini16.z.string())),
|
|
4275
|
+
tools: import_mini16.z.optional(import_mini16.z.array(import_mini16.z.string())),
|
|
4276
|
+
kiroAutoApprove: import_mini16.z.optional(import_mini16.z.array(import_mini16.z.string())),
|
|
4277
|
+
kiroAutoBlock: import_mini16.z.optional(import_mini16.z.array(import_mini16.z.string())),
|
|
4278
|
+
headers: import_mini16.z.optional(import_mini16.z.record(import_mini16.z.string(), import_mini16.z.string()))
|
|
3708
4279
|
});
|
|
3709
|
-
var McpServersSchema =
|
|
4280
|
+
var McpServersSchema = import_mini16.z.record(import_mini16.z.string(), McpServerSchema);
|
|
3710
4281
|
|
|
3711
4282
|
// src/features/mcp/modular-mcp.ts
|
|
3712
|
-
var ModularMcpServerSchema =
|
|
3713
|
-
description:
|
|
4283
|
+
var ModularMcpServerSchema = import_mini17.z.extend(McpServerSchema, {
|
|
4284
|
+
description: import_mini17.z.string()
|
|
3714
4285
|
// Required for modular-mcp
|
|
3715
4286
|
});
|
|
3716
|
-
var ModularMcpConfigSchema =
|
|
3717
|
-
mcpServers:
|
|
4287
|
+
var ModularMcpConfigSchema = import_mini17.z.object({
|
|
4288
|
+
mcpServers: import_mini17.z.record(import_mini17.z.string(), ModularMcpServerSchema)
|
|
3718
4289
|
});
|
|
3719
4290
|
var ModularMcp = class _ModularMcp extends AiFile {
|
|
3720
4291
|
json;
|
|
@@ -3770,7 +4341,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3770
4341
|
args: [
|
|
3771
4342
|
"-y",
|
|
3772
4343
|
"@kimuson/modular-mcp",
|
|
3773
|
-
(0,
|
|
4344
|
+
(0, import_node_path36.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3774
4345
|
],
|
|
3775
4346
|
env: {}
|
|
3776
4347
|
}
|
|
@@ -3808,22 +4379,22 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3808
4379
|
|
|
3809
4380
|
// src/features/mcp/rulesync-mcp.ts
|
|
3810
4381
|
var import_object = require("es-toolkit/object");
|
|
3811
|
-
var
|
|
3812
|
-
var
|
|
3813
|
-
var RulesyncMcpServerSchema =
|
|
3814
|
-
|
|
3815
|
-
targets:
|
|
3816
|
-
description:
|
|
3817
|
-
exposed:
|
|
4382
|
+
var import_node_path37 = require("path");
|
|
4383
|
+
var import_mini18 = require("zod/mini");
|
|
4384
|
+
var RulesyncMcpServerSchema = import_mini18.z.union([
|
|
4385
|
+
import_mini18.z.extend(McpServerSchema, {
|
|
4386
|
+
targets: import_mini18.z.optional(RulesyncTargetsSchema),
|
|
4387
|
+
description: import_mini18.z.optional(import_mini18.z.string()),
|
|
4388
|
+
exposed: import_mini18.z.optional(import_mini18.z.literal(false))
|
|
3818
4389
|
}),
|
|
3819
|
-
|
|
3820
|
-
targets:
|
|
3821
|
-
description:
|
|
3822
|
-
exposed:
|
|
4390
|
+
import_mini18.z.extend(McpServerSchema, {
|
|
4391
|
+
targets: import_mini18.z.optional(RulesyncTargetsSchema),
|
|
4392
|
+
description: import_mini18.z.undefined(),
|
|
4393
|
+
exposed: import_mini18.z.literal(true)
|
|
3823
4394
|
})
|
|
3824
4395
|
]);
|
|
3825
|
-
var RulesyncMcpConfigSchema =
|
|
3826
|
-
mcpServers:
|
|
4396
|
+
var RulesyncMcpConfigSchema = import_mini18.z.object({
|
|
4397
|
+
mcpServers: import_mini18.z.record(import_mini18.z.string(), RulesyncMcpServerSchema)
|
|
3827
4398
|
});
|
|
3828
4399
|
var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
3829
4400
|
json;
|
|
@@ -3864,12 +4435,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
3864
4435
|
}) {
|
|
3865
4436
|
const baseDir = process.cwd();
|
|
3866
4437
|
const paths = this.getSettablePaths();
|
|
3867
|
-
const recommendedPath = (0,
|
|
4438
|
+
const recommendedPath = (0, import_node_path37.join)(
|
|
3868
4439
|
baseDir,
|
|
3869
4440
|
paths.recommended.relativeDirPath,
|
|
3870
4441
|
paths.recommended.relativeFilePath
|
|
3871
4442
|
);
|
|
3872
|
-
const legacyPath = (0,
|
|
4443
|
+
const legacyPath = (0, import_node_path37.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
3873
4444
|
if (await fileExists(recommendedPath)) {
|
|
3874
4445
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
3875
4446
|
return new _RulesyncMcp({
|
|
@@ -4013,7 +4584,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
4013
4584
|
}) {
|
|
4014
4585
|
const paths = this.getSettablePaths({ global });
|
|
4015
4586
|
const fileContent = await readOrInitializeFileContent(
|
|
4016
|
-
(0,
|
|
4587
|
+
(0, import_node_path38.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4017
4588
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4018
4589
|
);
|
|
4019
4590
|
const json = JSON.parse(fileContent);
|
|
@@ -4035,7 +4606,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
4035
4606
|
}) {
|
|
4036
4607
|
const paths = this.getSettablePaths({ global });
|
|
4037
4608
|
const fileContent = await readOrInitializeFileContent(
|
|
4038
|
-
(0,
|
|
4609
|
+
(0, import_node_path38.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4039
4610
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4040
4611
|
);
|
|
4041
4612
|
const json = JSON.parse(fileContent);
|
|
@@ -4085,7 +4656,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
4085
4656
|
};
|
|
4086
4657
|
|
|
4087
4658
|
// src/features/mcp/cline-mcp.ts
|
|
4088
|
-
var
|
|
4659
|
+
var import_node_path39 = require("path");
|
|
4089
4660
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
4090
4661
|
json;
|
|
4091
4662
|
constructor(params) {
|
|
@@ -4106,7 +4677,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
4106
4677
|
validate = true
|
|
4107
4678
|
}) {
|
|
4108
4679
|
const fileContent = await readFileContent(
|
|
4109
|
-
(0,
|
|
4680
|
+
(0, import_node_path39.join)(
|
|
4110
4681
|
baseDir,
|
|
4111
4682
|
this.getSettablePaths().relativeDirPath,
|
|
4112
4683
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4155,7 +4726,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
4155
4726
|
};
|
|
4156
4727
|
|
|
4157
4728
|
// src/features/mcp/codexcli-mcp.ts
|
|
4158
|
-
var
|
|
4729
|
+
var import_node_path40 = require("path");
|
|
4159
4730
|
var smolToml = __toESM(require("smol-toml"), 1);
|
|
4160
4731
|
var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
4161
4732
|
toml;
|
|
@@ -4191,7 +4762,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4191
4762
|
}) {
|
|
4192
4763
|
const paths = this.getSettablePaths({ global });
|
|
4193
4764
|
const fileContent = await readFileContent(
|
|
4194
|
-
(0,
|
|
4765
|
+
(0, import_node_path40.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
4195
4766
|
);
|
|
4196
4767
|
return new _CodexcliMcp({
|
|
4197
4768
|
baseDir,
|
|
@@ -4208,7 +4779,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4208
4779
|
global = false
|
|
4209
4780
|
}) {
|
|
4210
4781
|
const paths = this.getSettablePaths({ global });
|
|
4211
|
-
const configTomlFilePath = (0,
|
|
4782
|
+
const configTomlFilePath = (0, import_node_path40.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
4212
4783
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
4213
4784
|
configTomlFilePath,
|
|
4214
4785
|
smolToml.stringify({})
|
|
@@ -4262,7 +4833,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4262
4833
|
};
|
|
4263
4834
|
|
|
4264
4835
|
// src/features/mcp/copilot-mcp.ts
|
|
4265
|
-
var
|
|
4836
|
+
var import_node_path41 = require("path");
|
|
4266
4837
|
function convertToCopilotFormat(mcpServers) {
|
|
4267
4838
|
return { servers: mcpServers };
|
|
4268
4839
|
}
|
|
@@ -4289,7 +4860,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
4289
4860
|
validate = true
|
|
4290
4861
|
}) {
|
|
4291
4862
|
const fileContent = await readFileContent(
|
|
4292
|
-
(0,
|
|
4863
|
+
(0, import_node_path41.join)(
|
|
4293
4864
|
baseDir,
|
|
4294
4865
|
this.getSettablePaths().relativeDirPath,
|
|
4295
4866
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4342,7 +4913,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
4342
4913
|
};
|
|
4343
4914
|
|
|
4344
4915
|
// src/features/mcp/cursor-mcp.ts
|
|
4345
|
-
var
|
|
4916
|
+
var import_node_path42 = require("path");
|
|
4346
4917
|
var CURSOR_ENV_VAR_PATTERN = /\$\{env:([^}]+)\}/g;
|
|
4347
4918
|
function isMcpServers(value) {
|
|
4348
4919
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
@@ -4403,7 +4974,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4403
4974
|
validate = true
|
|
4404
4975
|
}) {
|
|
4405
4976
|
const fileContent = await readFileContent(
|
|
4406
|
-
(0,
|
|
4977
|
+
(0, import_node_path42.join)(
|
|
4407
4978
|
baseDir,
|
|
4408
4979
|
this.getSettablePaths().relativeDirPath,
|
|
4409
4980
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4471,7 +5042,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4471
5042
|
};
|
|
4472
5043
|
|
|
4473
5044
|
// src/features/mcp/geminicli-mcp.ts
|
|
4474
|
-
var
|
|
5045
|
+
var import_node_path43 = require("path");
|
|
4475
5046
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
4476
5047
|
json;
|
|
4477
5048
|
constructor(params) {
|
|
@@ -4500,7 +5071,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4500
5071
|
}) {
|
|
4501
5072
|
const paths = this.getSettablePaths({ global });
|
|
4502
5073
|
const fileContent = await readOrInitializeFileContent(
|
|
4503
|
-
(0,
|
|
5074
|
+
(0, import_node_path43.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4504
5075
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4505
5076
|
);
|
|
4506
5077
|
const json = JSON.parse(fileContent);
|
|
@@ -4521,7 +5092,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4521
5092
|
}) {
|
|
4522
5093
|
const paths = this.getSettablePaths({ global });
|
|
4523
5094
|
const fileContent = await readOrInitializeFileContent(
|
|
4524
|
-
(0,
|
|
5095
|
+
(0, import_node_path43.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4525
5096
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4526
5097
|
);
|
|
4527
5098
|
const json = JSON.parse(fileContent);
|
|
@@ -4566,7 +5137,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4566
5137
|
};
|
|
4567
5138
|
|
|
4568
5139
|
// src/features/mcp/junie-mcp.ts
|
|
4569
|
-
var
|
|
5140
|
+
var import_node_path44 = require("path");
|
|
4570
5141
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
4571
5142
|
json;
|
|
4572
5143
|
constructor(params) {
|
|
@@ -4578,7 +5149,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4578
5149
|
}
|
|
4579
5150
|
static getSettablePaths() {
|
|
4580
5151
|
return {
|
|
4581
|
-
relativeDirPath: (0,
|
|
5152
|
+
relativeDirPath: (0, import_node_path44.join)(".junie", "mcp"),
|
|
4582
5153
|
relativeFilePath: "mcp.json"
|
|
4583
5154
|
};
|
|
4584
5155
|
}
|
|
@@ -4587,7 +5158,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4587
5158
|
validate = true
|
|
4588
5159
|
}) {
|
|
4589
5160
|
const fileContent = await readFileContent(
|
|
4590
|
-
(0,
|
|
5161
|
+
(0, import_node_path44.join)(
|
|
4591
5162
|
baseDir,
|
|
4592
5163
|
this.getSettablePaths().relativeDirPath,
|
|
4593
5164
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4636,7 +5207,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4636
5207
|
};
|
|
4637
5208
|
|
|
4638
5209
|
// src/features/mcp/kilo-mcp.ts
|
|
4639
|
-
var
|
|
5210
|
+
var import_node_path45 = require("path");
|
|
4640
5211
|
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
4641
5212
|
json;
|
|
4642
5213
|
constructor(params) {
|
|
@@ -4658,7 +5229,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4658
5229
|
}) {
|
|
4659
5230
|
const paths = this.getSettablePaths();
|
|
4660
5231
|
const fileContent = await readOrInitializeFileContent(
|
|
4661
|
-
(0,
|
|
5232
|
+
(0, import_node_path45.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4662
5233
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4663
5234
|
);
|
|
4664
5235
|
return new _KiloMcp({
|
|
@@ -4712,7 +5283,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4712
5283
|
};
|
|
4713
5284
|
|
|
4714
5285
|
// src/features/mcp/kiro-mcp.ts
|
|
4715
|
-
var
|
|
5286
|
+
var import_node_path46 = require("path");
|
|
4716
5287
|
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
4717
5288
|
json;
|
|
4718
5289
|
constructor(params) {
|
|
@@ -4724,7 +5295,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4724
5295
|
}
|
|
4725
5296
|
static getSettablePaths() {
|
|
4726
5297
|
return {
|
|
4727
|
-
relativeDirPath: (0,
|
|
5298
|
+
relativeDirPath: (0, import_node_path46.join)(".kiro", "settings"),
|
|
4728
5299
|
relativeFilePath: "mcp.json"
|
|
4729
5300
|
};
|
|
4730
5301
|
}
|
|
@@ -4734,7 +5305,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4734
5305
|
}) {
|
|
4735
5306
|
const paths = this.getSettablePaths();
|
|
4736
5307
|
const fileContent = await readOrInitializeFileContent(
|
|
4737
|
-
(0,
|
|
5308
|
+
(0, import_node_path46.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4738
5309
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4739
5310
|
);
|
|
4740
5311
|
return new _KiroMcp({
|
|
@@ -4788,28 +5359,28 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4788
5359
|
};
|
|
4789
5360
|
|
|
4790
5361
|
// src/features/mcp/opencode-mcp.ts
|
|
4791
|
-
var
|
|
4792
|
-
var
|
|
4793
|
-
var OpencodeMcpLocalServerSchema =
|
|
4794
|
-
type:
|
|
4795
|
-
command:
|
|
4796
|
-
environment:
|
|
4797
|
-
enabled:
|
|
4798
|
-
cwd:
|
|
5362
|
+
var import_node_path47 = require("path");
|
|
5363
|
+
var import_mini19 = require("zod/mini");
|
|
5364
|
+
var OpencodeMcpLocalServerSchema = import_mini19.z.object({
|
|
5365
|
+
type: import_mini19.z.literal("local"),
|
|
5366
|
+
command: import_mini19.z.array(import_mini19.z.string()),
|
|
5367
|
+
environment: import_mini19.z.optional(import_mini19.z.record(import_mini19.z.string(), import_mini19.z.string())),
|
|
5368
|
+
enabled: import_mini19.z._default(import_mini19.z.boolean(), true),
|
|
5369
|
+
cwd: import_mini19.z.optional(import_mini19.z.string())
|
|
4799
5370
|
});
|
|
4800
|
-
var OpencodeMcpRemoteServerSchema =
|
|
4801
|
-
type:
|
|
4802
|
-
url:
|
|
4803
|
-
headers:
|
|
4804
|
-
enabled:
|
|
5371
|
+
var OpencodeMcpRemoteServerSchema = import_mini19.z.object({
|
|
5372
|
+
type: import_mini19.z.literal("remote"),
|
|
5373
|
+
url: import_mini19.z.string(),
|
|
5374
|
+
headers: import_mini19.z.optional(import_mini19.z.record(import_mini19.z.string(), import_mini19.z.string())),
|
|
5375
|
+
enabled: import_mini19.z._default(import_mini19.z.boolean(), true)
|
|
4805
5376
|
});
|
|
4806
|
-
var OpencodeMcpServerSchema =
|
|
5377
|
+
var OpencodeMcpServerSchema = import_mini19.z.union([
|
|
4807
5378
|
OpencodeMcpLocalServerSchema,
|
|
4808
5379
|
OpencodeMcpRemoteServerSchema
|
|
4809
5380
|
]);
|
|
4810
|
-
var OpencodeConfigSchema =
|
|
4811
|
-
$schema:
|
|
4812
|
-
mcp:
|
|
5381
|
+
var OpencodeConfigSchema = import_mini19.z.looseObject({
|
|
5382
|
+
$schema: import_mini19.z.optional(import_mini19.z.string()),
|
|
5383
|
+
mcp: import_mini19.z.optional(import_mini19.z.record(import_mini19.z.string(), OpencodeMcpServerSchema))
|
|
4813
5384
|
});
|
|
4814
5385
|
function convertFromOpencodeFormat(opencodeMcp) {
|
|
4815
5386
|
return Object.fromEntries(
|
|
@@ -4912,7 +5483,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4912
5483
|
}) {
|
|
4913
5484
|
const paths = this.getSettablePaths({ global });
|
|
4914
5485
|
const fileContent = await readOrInitializeFileContent(
|
|
4915
|
-
(0,
|
|
5486
|
+
(0, import_node_path47.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4916
5487
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4917
5488
|
);
|
|
4918
5489
|
const json = JSON.parse(fileContent);
|
|
@@ -4933,7 +5504,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4933
5504
|
}) {
|
|
4934
5505
|
const paths = this.getSettablePaths({ global });
|
|
4935
5506
|
const fileContent = await readOrInitializeFileContent(
|
|
4936
|
-
(0,
|
|
5507
|
+
(0, import_node_path47.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4937
5508
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4938
5509
|
);
|
|
4939
5510
|
const json = JSON.parse(fileContent);
|
|
@@ -4979,7 +5550,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4979
5550
|
};
|
|
4980
5551
|
|
|
4981
5552
|
// src/features/mcp/roo-mcp.ts
|
|
4982
|
-
var
|
|
5553
|
+
var import_node_path48 = require("path");
|
|
4983
5554
|
function isRooMcpServers(value) {
|
|
4984
5555
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
4985
5556
|
}
|
|
@@ -5031,7 +5602,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
5031
5602
|
validate = true
|
|
5032
5603
|
}) {
|
|
5033
5604
|
const fileContent = await readFileContent(
|
|
5034
|
-
(0,
|
|
5605
|
+
(0, import_node_path48.join)(
|
|
5035
5606
|
baseDir,
|
|
5036
5607
|
this.getSettablePaths().relativeDirPath,
|
|
5037
5608
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5101,7 +5672,7 @@ var mcpProcessorToolTargetTuple = [
|
|
|
5101
5672
|
"opencode",
|
|
5102
5673
|
"roo"
|
|
5103
5674
|
];
|
|
5104
|
-
var McpProcessorToolTargetSchema =
|
|
5675
|
+
var McpProcessorToolTargetSchema = import_mini20.z.enum(mcpProcessorToolTargetTuple);
|
|
5105
5676
|
var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
5106
5677
|
[
|
|
5107
5678
|
"claudecode",
|
|
@@ -5346,24 +5917,24 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
5346
5917
|
|
|
5347
5918
|
// src/features/rules/rules-processor.ts
|
|
5348
5919
|
var import_toon = require("@toon-format/toon");
|
|
5349
|
-
var
|
|
5350
|
-
var
|
|
5920
|
+
var import_node_path101 = require("path");
|
|
5921
|
+
var import_mini48 = require("zod/mini");
|
|
5351
5922
|
|
|
5352
5923
|
// src/constants/general.ts
|
|
5353
5924
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
5354
5925
|
|
|
5355
5926
|
// src/features/skills/agentsmd-skill.ts
|
|
5356
|
-
var
|
|
5927
|
+
var import_node_path52 = require("path");
|
|
5357
5928
|
|
|
5358
5929
|
// src/features/skills/simulated-skill.ts
|
|
5359
|
-
var
|
|
5360
|
-
var
|
|
5930
|
+
var import_node_path51 = require("path");
|
|
5931
|
+
var import_mini21 = require("zod/mini");
|
|
5361
5932
|
|
|
5362
5933
|
// src/features/skills/tool-skill.ts
|
|
5363
|
-
var
|
|
5934
|
+
var import_node_path50 = require("path");
|
|
5364
5935
|
|
|
5365
5936
|
// src/types/ai-dir.ts
|
|
5366
|
-
var
|
|
5937
|
+
var import_node_path49 = __toESM(require("path"), 1);
|
|
5367
5938
|
var AiDir = class {
|
|
5368
5939
|
/**
|
|
5369
5940
|
* @example "."
|
|
@@ -5397,7 +5968,7 @@ var AiDir = class {
|
|
|
5397
5968
|
otherFiles = [],
|
|
5398
5969
|
global = false
|
|
5399
5970
|
}) {
|
|
5400
|
-
if (dirName.includes(
|
|
5971
|
+
if (dirName.includes(import_node_path49.default.sep) || dirName.includes("/") || dirName.includes("\\")) {
|
|
5401
5972
|
throw new Error(`Directory name cannot contain path separators: dirName="${dirName}"`);
|
|
5402
5973
|
}
|
|
5403
5974
|
this.baseDir = baseDir;
|
|
@@ -5420,11 +5991,11 @@ var AiDir = class {
|
|
|
5420
5991
|
return this.dirName;
|
|
5421
5992
|
}
|
|
5422
5993
|
getDirPath() {
|
|
5423
|
-
const fullPath =
|
|
5424
|
-
const resolvedFull = (0,
|
|
5425
|
-
const resolvedBase = (0,
|
|
5426
|
-
const rel = (0,
|
|
5427
|
-
if (rel.startsWith("..") ||
|
|
5994
|
+
const fullPath = import_node_path49.default.join(this.baseDir, this.relativeDirPath, this.dirName);
|
|
5995
|
+
const resolvedFull = (0, import_node_path49.resolve)(fullPath);
|
|
5996
|
+
const resolvedBase = (0, import_node_path49.resolve)(this.baseDir);
|
|
5997
|
+
const rel = (0, import_node_path49.relative)(resolvedBase, resolvedFull);
|
|
5998
|
+
if (rel.startsWith("..") || import_node_path49.default.isAbsolute(rel)) {
|
|
5428
5999
|
throw new Error(
|
|
5429
6000
|
`Path traversal detected: Final path escapes baseDir. baseDir="${this.baseDir}", relativeDirPath="${this.relativeDirPath}", dirName="${this.dirName}"`
|
|
5430
6001
|
);
|
|
@@ -5438,7 +6009,7 @@ var AiDir = class {
|
|
|
5438
6009
|
return this.otherFiles;
|
|
5439
6010
|
}
|
|
5440
6011
|
getRelativePathFromCwd() {
|
|
5441
|
-
return
|
|
6012
|
+
return import_node_path49.default.join(this.relativeDirPath, this.dirName);
|
|
5442
6013
|
}
|
|
5443
6014
|
getGlobal() {
|
|
5444
6015
|
return this.global;
|
|
@@ -5457,15 +6028,15 @@ var AiDir = class {
|
|
|
5457
6028
|
* @returns Array of files with their relative paths and buffers
|
|
5458
6029
|
*/
|
|
5459
6030
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
5460
|
-
const dirPath = (0,
|
|
5461
|
-
const glob = (0,
|
|
6031
|
+
const dirPath = (0, import_node_path49.join)(baseDir, relativeDirPath, dirName);
|
|
6032
|
+
const glob = (0, import_node_path49.join)(dirPath, "**", "*");
|
|
5462
6033
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
5463
|
-
const filteredPaths = filePaths.filter((filePath) => (0,
|
|
6034
|
+
const filteredPaths = filePaths.filter((filePath) => (0, import_node_path49.basename)(filePath) !== excludeFileName);
|
|
5464
6035
|
const files = await Promise.all(
|
|
5465
6036
|
filteredPaths.map(async (filePath) => {
|
|
5466
6037
|
const fileBuffer = await readFileBuffer(filePath);
|
|
5467
6038
|
return {
|
|
5468
|
-
relativeFilePathToDirPath: (0,
|
|
6039
|
+
relativeFilePathToDirPath: (0, import_node_path49.relative)(dirPath, filePath),
|
|
5469
6040
|
fileBuffer
|
|
5470
6041
|
};
|
|
5471
6042
|
})
|
|
@@ -5556,8 +6127,8 @@ var ToolSkill = class extends AiDir {
|
|
|
5556
6127
|
}) {
|
|
5557
6128
|
const settablePaths = getSettablePaths({ global });
|
|
5558
6129
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5559
|
-
const skillDirPath = (0,
|
|
5560
|
-
const skillFilePath = (0,
|
|
6130
|
+
const skillDirPath = (0, import_node_path50.join)(baseDir, actualRelativeDirPath, dirName);
|
|
6131
|
+
const skillFilePath = (0, import_node_path50.join)(skillDirPath, SKILL_FILE_NAME);
|
|
5561
6132
|
if (!await fileExists(skillFilePath)) {
|
|
5562
6133
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5563
6134
|
}
|
|
@@ -5582,9 +6153,9 @@ var ToolSkill = class extends AiDir {
|
|
|
5582
6153
|
};
|
|
5583
6154
|
|
|
5584
6155
|
// src/features/skills/simulated-skill.ts
|
|
5585
|
-
var SimulatedSkillFrontmatterSchema =
|
|
5586
|
-
name:
|
|
5587
|
-
description:
|
|
6156
|
+
var SimulatedSkillFrontmatterSchema = import_mini21.z.looseObject({
|
|
6157
|
+
name: import_mini21.z.string(),
|
|
6158
|
+
description: import_mini21.z.string()
|
|
5588
6159
|
});
|
|
5589
6160
|
var SimulatedSkill = class extends ToolSkill {
|
|
5590
6161
|
frontmatter;
|
|
@@ -5615,7 +6186,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5615
6186
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
5616
6187
|
if (!result.success) {
|
|
5617
6188
|
throw new Error(
|
|
5618
|
-
`Invalid frontmatter in ${(0,
|
|
6189
|
+
`Invalid frontmatter in ${(0, import_node_path51.join)(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
5619
6190
|
);
|
|
5620
6191
|
}
|
|
5621
6192
|
}
|
|
@@ -5673,8 +6244,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5673
6244
|
}) {
|
|
5674
6245
|
const settablePaths = this.getSettablePaths();
|
|
5675
6246
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5676
|
-
const skillDirPath = (0,
|
|
5677
|
-
const skillFilePath = (0,
|
|
6247
|
+
const skillDirPath = (0, import_node_path51.join)(baseDir, actualRelativeDirPath, dirName);
|
|
6248
|
+
const skillFilePath = (0, import_node_path51.join)(skillDirPath, SKILL_FILE_NAME);
|
|
5678
6249
|
if (!await fileExists(skillFilePath)) {
|
|
5679
6250
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5680
6251
|
}
|
|
@@ -5751,7 +6322,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5751
6322
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
5752
6323
|
}
|
|
5753
6324
|
return {
|
|
5754
|
-
relativeDirPath: (0,
|
|
6325
|
+
relativeDirPath: (0, import_node_path52.join)(".agents", "skills")
|
|
5755
6326
|
};
|
|
5756
6327
|
}
|
|
5757
6328
|
static async fromDir(params) {
|
|
@@ -5778,14 +6349,14 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5778
6349
|
};
|
|
5779
6350
|
|
|
5780
6351
|
// src/features/skills/geminicli-skill.ts
|
|
5781
|
-
var
|
|
6352
|
+
var import_node_path53 = require("path");
|
|
5782
6353
|
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5783
6354
|
static getSettablePaths(options) {
|
|
5784
6355
|
if (options?.global) {
|
|
5785
6356
|
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5786
6357
|
}
|
|
5787
6358
|
return {
|
|
5788
|
-
relativeDirPath: (0,
|
|
6359
|
+
relativeDirPath: (0, import_node_path53.join)(".gemini", "skills")
|
|
5789
6360
|
};
|
|
5790
6361
|
}
|
|
5791
6362
|
static async fromDir(params) {
|
|
@@ -5812,11 +6383,11 @@ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
|
5812
6383
|
};
|
|
5813
6384
|
|
|
5814
6385
|
// src/features/skills/skills-processor.ts
|
|
5815
|
-
var
|
|
5816
|
-
var
|
|
6386
|
+
var import_node_path66 = require("path");
|
|
6387
|
+
var import_mini33 = require("zod/mini");
|
|
5817
6388
|
|
|
5818
6389
|
// src/types/dir-feature-processor.ts
|
|
5819
|
-
var
|
|
6390
|
+
var import_node_path54 = require("path");
|
|
5820
6391
|
var DirFeatureProcessor = class {
|
|
5821
6392
|
baseDir;
|
|
5822
6393
|
constructor({ baseDir = process.cwd() }) {
|
|
@@ -5838,14 +6409,14 @@ var DirFeatureProcessor = class {
|
|
|
5838
6409
|
await ensureDir(dirPath);
|
|
5839
6410
|
const mainFile = aiDir.getMainFile();
|
|
5840
6411
|
if (mainFile) {
|
|
5841
|
-
const mainFilePath = (0,
|
|
6412
|
+
const mainFilePath = (0, import_node_path54.join)(dirPath, mainFile.name);
|
|
5842
6413
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5843
6414
|
const contentWithNewline = addTrailingNewline(content);
|
|
5844
6415
|
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5845
6416
|
}
|
|
5846
6417
|
const otherFiles = aiDir.getOtherFiles();
|
|
5847
6418
|
for (const file of otherFiles) {
|
|
5848
|
-
const filePath = (0,
|
|
6419
|
+
const filePath = (0, import_node_path54.join)(dirPath, file.relativeFilePathToDirPath);
|
|
5849
6420
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5850
6421
|
await writeFileContent(filePath, contentWithNewline);
|
|
5851
6422
|
}
|
|
@@ -5860,37 +6431,37 @@ var DirFeatureProcessor = class {
|
|
|
5860
6431
|
};
|
|
5861
6432
|
|
|
5862
6433
|
// src/features/skills/antigravity-skill.ts
|
|
5863
|
-
var
|
|
5864
|
-
var
|
|
6434
|
+
var import_node_path56 = require("path");
|
|
6435
|
+
var import_mini23 = require("zod/mini");
|
|
5865
6436
|
|
|
5866
6437
|
// src/features/skills/rulesync-skill.ts
|
|
5867
|
-
var
|
|
5868
|
-
var
|
|
5869
|
-
var RulesyncSkillFrontmatterSchemaInternal =
|
|
5870
|
-
name:
|
|
5871
|
-
description:
|
|
5872
|
-
targets:
|
|
5873
|
-
claudecode:
|
|
5874
|
-
|
|
5875
|
-
"allowed-tools":
|
|
6438
|
+
var import_node_path55 = require("path");
|
|
6439
|
+
var import_mini22 = require("zod/mini");
|
|
6440
|
+
var RulesyncSkillFrontmatterSchemaInternal = import_mini22.z.looseObject({
|
|
6441
|
+
name: import_mini22.z.string(),
|
|
6442
|
+
description: import_mini22.z.string(),
|
|
6443
|
+
targets: import_mini22.z._default(RulesyncTargetsSchema, ["*"]),
|
|
6444
|
+
claudecode: import_mini22.z.optional(
|
|
6445
|
+
import_mini22.z.looseObject({
|
|
6446
|
+
"allowed-tools": import_mini22.z.optional(import_mini22.z.array(import_mini22.z.string()))
|
|
5876
6447
|
})
|
|
5877
6448
|
),
|
|
5878
|
-
codexcli:
|
|
5879
|
-
|
|
5880
|
-
"short-description":
|
|
6449
|
+
codexcli: import_mini22.z.optional(
|
|
6450
|
+
import_mini22.z.looseObject({
|
|
6451
|
+
"short-description": import_mini22.z.optional(import_mini22.z.string())
|
|
5881
6452
|
})
|
|
5882
6453
|
),
|
|
5883
|
-
opencode:
|
|
5884
|
-
|
|
5885
|
-
"allowed-tools":
|
|
6454
|
+
opencode: import_mini22.z.optional(
|
|
6455
|
+
import_mini22.z.looseObject({
|
|
6456
|
+
"allowed-tools": import_mini22.z.optional(import_mini22.z.array(import_mini22.z.string()))
|
|
5886
6457
|
})
|
|
5887
6458
|
),
|
|
5888
|
-
copilot:
|
|
5889
|
-
|
|
5890
|
-
license:
|
|
6459
|
+
copilot: import_mini22.z.optional(
|
|
6460
|
+
import_mini22.z.looseObject({
|
|
6461
|
+
license: import_mini22.z.optional(import_mini22.z.string())
|
|
5891
6462
|
})
|
|
5892
6463
|
),
|
|
5893
|
-
roo:
|
|
6464
|
+
roo: import_mini22.z.optional(import_mini22.z.looseObject({}))
|
|
5894
6465
|
});
|
|
5895
6466
|
var RulesyncSkillFrontmatterSchema = RulesyncSkillFrontmatterSchemaInternal;
|
|
5896
6467
|
var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
@@ -5956,8 +6527,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5956
6527
|
dirName,
|
|
5957
6528
|
global = false
|
|
5958
6529
|
}) {
|
|
5959
|
-
const skillDirPath = (0,
|
|
5960
|
-
const skillFilePath = (0,
|
|
6530
|
+
const skillDirPath = (0, import_node_path55.join)(baseDir, relativeDirPath, dirName);
|
|
6531
|
+
const skillFilePath = (0, import_node_path55.join)(skillDirPath, SKILL_FILE_NAME);
|
|
5961
6532
|
if (!await fileExists(skillFilePath)) {
|
|
5962
6533
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5963
6534
|
}
|
|
@@ -5987,14 +6558,14 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5987
6558
|
};
|
|
5988
6559
|
|
|
5989
6560
|
// src/features/skills/antigravity-skill.ts
|
|
5990
|
-
var AntigravitySkillFrontmatterSchema =
|
|
5991
|
-
name:
|
|
5992
|
-
description:
|
|
6561
|
+
var AntigravitySkillFrontmatterSchema = import_mini23.z.looseObject({
|
|
6562
|
+
name: import_mini23.z.string(),
|
|
6563
|
+
description: import_mini23.z.string()
|
|
5993
6564
|
});
|
|
5994
6565
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
5995
6566
|
constructor({
|
|
5996
6567
|
baseDir = process.cwd(),
|
|
5997
|
-
relativeDirPath = (0,
|
|
6568
|
+
relativeDirPath = (0, import_node_path56.join)(".agent", "skills"),
|
|
5998
6569
|
dirName,
|
|
5999
6570
|
frontmatter,
|
|
6000
6571
|
body,
|
|
@@ -6026,11 +6597,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
6026
6597
|
} = {}) {
|
|
6027
6598
|
if (global) {
|
|
6028
6599
|
return {
|
|
6029
|
-
relativeDirPath: (0,
|
|
6600
|
+
relativeDirPath: (0, import_node_path56.join)(".gemini", "antigravity", "skills")
|
|
6030
6601
|
};
|
|
6031
6602
|
}
|
|
6032
6603
|
return {
|
|
6033
|
-
relativeDirPath: (0,
|
|
6604
|
+
relativeDirPath: (0, import_node_path56.join)(".agent", "skills")
|
|
6034
6605
|
};
|
|
6035
6606
|
}
|
|
6036
6607
|
getFrontmatter() {
|
|
@@ -6112,9 +6683,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
6112
6683
|
});
|
|
6113
6684
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6114
6685
|
if (!result.success) {
|
|
6115
|
-
const skillDirPath = (0,
|
|
6686
|
+
const skillDirPath = (0, import_node_path56.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6116
6687
|
throw new Error(
|
|
6117
|
-
`Invalid frontmatter in ${(0,
|
|
6688
|
+
`Invalid frontmatter in ${(0, import_node_path56.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6118
6689
|
);
|
|
6119
6690
|
}
|
|
6120
6691
|
return new _AntigravitySkill({
|
|
@@ -6148,17 +6719,17 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
6148
6719
|
};
|
|
6149
6720
|
|
|
6150
6721
|
// src/features/skills/claudecode-skill.ts
|
|
6151
|
-
var
|
|
6152
|
-
var
|
|
6153
|
-
var ClaudecodeSkillFrontmatterSchema =
|
|
6154
|
-
name:
|
|
6155
|
-
description:
|
|
6156
|
-
"allowed-tools":
|
|
6722
|
+
var import_node_path57 = require("path");
|
|
6723
|
+
var import_mini24 = require("zod/mini");
|
|
6724
|
+
var ClaudecodeSkillFrontmatterSchema = import_mini24.z.looseObject({
|
|
6725
|
+
name: import_mini24.z.string(),
|
|
6726
|
+
description: import_mini24.z.string(),
|
|
6727
|
+
"allowed-tools": import_mini24.z.optional(import_mini24.z.array(import_mini24.z.string()))
|
|
6157
6728
|
});
|
|
6158
6729
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
6159
6730
|
constructor({
|
|
6160
6731
|
baseDir = process.cwd(),
|
|
6161
|
-
relativeDirPath = (0,
|
|
6732
|
+
relativeDirPath = (0, import_node_path57.join)(".claude", "skills"),
|
|
6162
6733
|
dirName,
|
|
6163
6734
|
frontmatter,
|
|
6164
6735
|
body,
|
|
@@ -6189,7 +6760,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
6189
6760
|
global: _global = false
|
|
6190
6761
|
} = {}) {
|
|
6191
6762
|
return {
|
|
6192
|
-
relativeDirPath: (0,
|
|
6763
|
+
relativeDirPath: (0, import_node_path57.join)(".claude", "skills")
|
|
6193
6764
|
};
|
|
6194
6765
|
}
|
|
6195
6766
|
getFrontmatter() {
|
|
@@ -6277,9 +6848,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
6277
6848
|
});
|
|
6278
6849
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6279
6850
|
if (!result.success) {
|
|
6280
|
-
const skillDirPath = (0,
|
|
6851
|
+
const skillDirPath = (0, import_node_path57.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6281
6852
|
throw new Error(
|
|
6282
|
-
`Invalid frontmatter in ${(0,
|
|
6853
|
+
`Invalid frontmatter in ${(0, import_node_path57.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6283
6854
|
);
|
|
6284
6855
|
}
|
|
6285
6856
|
return new _ClaudecodeSkill({
|
|
@@ -6313,21 +6884,21 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
6313
6884
|
};
|
|
6314
6885
|
|
|
6315
6886
|
// src/features/skills/codexcli-skill.ts
|
|
6316
|
-
var
|
|
6317
|
-
var
|
|
6318
|
-
var CodexCliSkillFrontmatterSchema =
|
|
6319
|
-
name:
|
|
6320
|
-
description:
|
|
6321
|
-
metadata:
|
|
6322
|
-
|
|
6323
|
-
"short-description":
|
|
6887
|
+
var import_node_path58 = require("path");
|
|
6888
|
+
var import_mini25 = require("zod/mini");
|
|
6889
|
+
var CodexCliSkillFrontmatterSchema = import_mini25.z.looseObject({
|
|
6890
|
+
name: import_mini25.z.string(),
|
|
6891
|
+
description: import_mini25.z.string(),
|
|
6892
|
+
metadata: import_mini25.z.optional(
|
|
6893
|
+
import_mini25.z.looseObject({
|
|
6894
|
+
"short-description": import_mini25.z.optional(import_mini25.z.string())
|
|
6324
6895
|
})
|
|
6325
6896
|
)
|
|
6326
6897
|
});
|
|
6327
6898
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
6328
6899
|
constructor({
|
|
6329
6900
|
baseDir = process.cwd(),
|
|
6330
|
-
relativeDirPath = (0,
|
|
6901
|
+
relativeDirPath = (0, import_node_path58.join)(".codex", "skills"),
|
|
6331
6902
|
dirName,
|
|
6332
6903
|
frontmatter,
|
|
6333
6904
|
body,
|
|
@@ -6358,7 +6929,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6358
6929
|
global: _global = false
|
|
6359
6930
|
} = {}) {
|
|
6360
6931
|
return {
|
|
6361
|
-
relativeDirPath: (0,
|
|
6932
|
+
relativeDirPath: (0, import_node_path58.join)(".codex", "skills")
|
|
6362
6933
|
};
|
|
6363
6934
|
}
|
|
6364
6935
|
getFrontmatter() {
|
|
@@ -6450,9 +7021,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6450
7021
|
});
|
|
6451
7022
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6452
7023
|
if (!result.success) {
|
|
6453
|
-
const skillDirPath = (0,
|
|
7024
|
+
const skillDirPath = (0, import_node_path58.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6454
7025
|
throw new Error(
|
|
6455
|
-
`Invalid frontmatter in ${(0,
|
|
7026
|
+
`Invalid frontmatter in ${(0, import_node_path58.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6456
7027
|
);
|
|
6457
7028
|
}
|
|
6458
7029
|
return new _CodexCliSkill({
|
|
@@ -6486,17 +7057,17 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6486
7057
|
};
|
|
6487
7058
|
|
|
6488
7059
|
// src/features/skills/copilot-skill.ts
|
|
6489
|
-
var
|
|
6490
|
-
var
|
|
6491
|
-
var CopilotSkillFrontmatterSchema =
|
|
6492
|
-
name:
|
|
6493
|
-
description:
|
|
6494
|
-
license:
|
|
7060
|
+
var import_node_path59 = require("path");
|
|
7061
|
+
var import_mini26 = require("zod/mini");
|
|
7062
|
+
var CopilotSkillFrontmatterSchema = import_mini26.z.looseObject({
|
|
7063
|
+
name: import_mini26.z.string(),
|
|
7064
|
+
description: import_mini26.z.string(),
|
|
7065
|
+
license: import_mini26.z.optional(import_mini26.z.string())
|
|
6495
7066
|
});
|
|
6496
7067
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
6497
7068
|
constructor({
|
|
6498
7069
|
baseDir = process.cwd(),
|
|
6499
|
-
relativeDirPath = (0,
|
|
7070
|
+
relativeDirPath = (0, import_node_path59.join)(".github", "skills"),
|
|
6500
7071
|
dirName,
|
|
6501
7072
|
frontmatter,
|
|
6502
7073
|
body,
|
|
@@ -6528,7 +7099,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6528
7099
|
throw new Error("CopilotSkill does not support global mode.");
|
|
6529
7100
|
}
|
|
6530
7101
|
return {
|
|
6531
|
-
relativeDirPath: (0,
|
|
7102
|
+
relativeDirPath: (0, import_node_path59.join)(".github", "skills")
|
|
6532
7103
|
};
|
|
6533
7104
|
}
|
|
6534
7105
|
getFrontmatter() {
|
|
@@ -6616,9 +7187,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6616
7187
|
});
|
|
6617
7188
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6618
7189
|
if (!result.success) {
|
|
6619
|
-
const skillDirPath = (0,
|
|
7190
|
+
const skillDirPath = (0, import_node_path59.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6620
7191
|
throw new Error(
|
|
6621
|
-
`Invalid frontmatter in ${(0,
|
|
7192
|
+
`Invalid frontmatter in ${(0, import_node_path59.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6622
7193
|
);
|
|
6623
7194
|
}
|
|
6624
7195
|
return new _CopilotSkill({
|
|
@@ -6653,16 +7224,16 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6653
7224
|
};
|
|
6654
7225
|
|
|
6655
7226
|
// src/features/skills/cursor-skill.ts
|
|
6656
|
-
var
|
|
6657
|
-
var
|
|
6658
|
-
var CursorSkillFrontmatterSchema =
|
|
6659
|
-
name:
|
|
6660
|
-
description:
|
|
7227
|
+
var import_node_path60 = require("path");
|
|
7228
|
+
var import_mini27 = require("zod/mini");
|
|
7229
|
+
var CursorSkillFrontmatterSchema = import_mini27.z.looseObject({
|
|
7230
|
+
name: import_mini27.z.string(),
|
|
7231
|
+
description: import_mini27.z.string()
|
|
6661
7232
|
});
|
|
6662
7233
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
6663
7234
|
constructor({
|
|
6664
7235
|
baseDir = process.cwd(),
|
|
6665
|
-
relativeDirPath = (0,
|
|
7236
|
+
relativeDirPath = (0, import_node_path60.join)(".cursor", "skills"),
|
|
6666
7237
|
dirName,
|
|
6667
7238
|
frontmatter,
|
|
6668
7239
|
body,
|
|
@@ -6689,12 +7260,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6689
7260
|
}
|
|
6690
7261
|
}
|
|
6691
7262
|
}
|
|
6692
|
-
static getSettablePaths(
|
|
6693
|
-
if (options?.global) {
|
|
6694
|
-
throw new Error("CursorSkill does not support global mode.");
|
|
6695
|
-
}
|
|
7263
|
+
static getSettablePaths(_options) {
|
|
6696
7264
|
return {
|
|
6697
|
-
relativeDirPath: (0,
|
|
7265
|
+
relativeDirPath: (0, import_node_path60.join)(".cursor", "skills")
|
|
6698
7266
|
};
|
|
6699
7267
|
}
|
|
6700
7268
|
getFrontmatter() {
|
|
@@ -6776,9 +7344,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6776
7344
|
});
|
|
6777
7345
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6778
7346
|
if (!result.success) {
|
|
6779
|
-
const skillDirPath = (0,
|
|
7347
|
+
const skillDirPath = (0, import_node_path60.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6780
7348
|
throw new Error(
|
|
6781
|
-
`Invalid frontmatter in ${(0,
|
|
7349
|
+
`Invalid frontmatter in ${(0, import_node_path60.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6782
7350
|
);
|
|
6783
7351
|
}
|
|
6784
7352
|
return new _CursorSkill({
|
|
@@ -6813,16 +7381,16 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6813
7381
|
};
|
|
6814
7382
|
|
|
6815
7383
|
// src/features/skills/kilo-skill.ts
|
|
6816
|
-
var
|
|
6817
|
-
var
|
|
6818
|
-
var KiloSkillFrontmatterSchema =
|
|
6819
|
-
name:
|
|
6820
|
-
description:
|
|
7384
|
+
var import_node_path61 = require("path");
|
|
7385
|
+
var import_mini28 = require("zod/mini");
|
|
7386
|
+
var KiloSkillFrontmatterSchema = import_mini28.z.looseObject({
|
|
7387
|
+
name: import_mini28.z.string(),
|
|
7388
|
+
description: import_mini28.z.string()
|
|
6821
7389
|
});
|
|
6822
7390
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
6823
7391
|
constructor({
|
|
6824
7392
|
baseDir = process.cwd(),
|
|
6825
|
-
relativeDirPath = (0,
|
|
7393
|
+
relativeDirPath = (0, import_node_path61.join)(".kilocode", "skills"),
|
|
6826
7394
|
dirName,
|
|
6827
7395
|
frontmatter,
|
|
6828
7396
|
body,
|
|
@@ -6853,7 +7421,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6853
7421
|
global: _global = false
|
|
6854
7422
|
} = {}) {
|
|
6855
7423
|
return {
|
|
6856
|
-
relativeDirPath: (0,
|
|
7424
|
+
relativeDirPath: (0, import_node_path61.join)(".kilocode", "skills")
|
|
6857
7425
|
};
|
|
6858
7426
|
}
|
|
6859
7427
|
getFrontmatter() {
|
|
@@ -6943,13 +7511,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6943
7511
|
});
|
|
6944
7512
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6945
7513
|
if (!result.success) {
|
|
6946
|
-
const skillDirPath = (0,
|
|
7514
|
+
const skillDirPath = (0, import_node_path61.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6947
7515
|
throw new Error(
|
|
6948
|
-
`Invalid frontmatter in ${(0,
|
|
7516
|
+
`Invalid frontmatter in ${(0, import_node_path61.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6949
7517
|
);
|
|
6950
7518
|
}
|
|
6951
7519
|
if (result.data.name !== loaded.dirName) {
|
|
6952
|
-
const skillFilePath = (0,
|
|
7520
|
+
const skillFilePath = (0, import_node_path61.join)(
|
|
6953
7521
|
loaded.baseDir,
|
|
6954
7522
|
loaded.relativeDirPath,
|
|
6955
7523
|
loaded.dirName,
|
|
@@ -6990,16 +7558,16 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6990
7558
|
};
|
|
6991
7559
|
|
|
6992
7560
|
// src/features/skills/kiro-skill.ts
|
|
6993
|
-
var
|
|
6994
|
-
var
|
|
6995
|
-
var KiroSkillFrontmatterSchema =
|
|
6996
|
-
name:
|
|
6997
|
-
description:
|
|
7561
|
+
var import_node_path62 = require("path");
|
|
7562
|
+
var import_mini29 = require("zod/mini");
|
|
7563
|
+
var KiroSkillFrontmatterSchema = import_mini29.z.looseObject({
|
|
7564
|
+
name: import_mini29.z.string(),
|
|
7565
|
+
description: import_mini29.z.string()
|
|
6998
7566
|
});
|
|
6999
7567
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
7000
7568
|
constructor({
|
|
7001
7569
|
baseDir = process.cwd(),
|
|
7002
|
-
relativeDirPath = (0,
|
|
7570
|
+
relativeDirPath = (0, import_node_path62.join)(".kiro", "skills"),
|
|
7003
7571
|
dirName,
|
|
7004
7572
|
frontmatter,
|
|
7005
7573
|
body,
|
|
@@ -7031,7 +7599,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
7031
7599
|
throw new Error("KiroSkill does not support global mode.");
|
|
7032
7600
|
}
|
|
7033
7601
|
return {
|
|
7034
|
-
relativeDirPath: (0,
|
|
7602
|
+
relativeDirPath: (0, import_node_path62.join)(".kiro", "skills")
|
|
7035
7603
|
};
|
|
7036
7604
|
}
|
|
7037
7605
|
getFrontmatter() {
|
|
@@ -7121,13 +7689,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
7121
7689
|
});
|
|
7122
7690
|
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7123
7691
|
if (!result.success) {
|
|
7124
|
-
const skillDirPath = (0,
|
|
7692
|
+
const skillDirPath = (0, import_node_path62.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7125
7693
|
throw new Error(
|
|
7126
|
-
`Invalid frontmatter in ${(0,
|
|
7694
|
+
`Invalid frontmatter in ${(0, import_node_path62.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7127
7695
|
);
|
|
7128
7696
|
}
|
|
7129
7697
|
if (result.data.name !== loaded.dirName) {
|
|
7130
|
-
const skillFilePath = (0,
|
|
7698
|
+
const skillFilePath = (0, import_node_path62.join)(
|
|
7131
7699
|
loaded.baseDir,
|
|
7132
7700
|
loaded.relativeDirPath,
|
|
7133
7701
|
loaded.dirName,
|
|
@@ -7169,17 +7737,17 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
7169
7737
|
};
|
|
7170
7738
|
|
|
7171
7739
|
// src/features/skills/opencode-skill.ts
|
|
7172
|
-
var
|
|
7173
|
-
var
|
|
7174
|
-
var OpenCodeSkillFrontmatterSchema =
|
|
7175
|
-
name:
|
|
7176
|
-
description:
|
|
7177
|
-
"allowed-tools":
|
|
7740
|
+
var import_node_path63 = require("path");
|
|
7741
|
+
var import_mini30 = require("zod/mini");
|
|
7742
|
+
var OpenCodeSkillFrontmatterSchema = import_mini30.z.looseObject({
|
|
7743
|
+
name: import_mini30.z.string(),
|
|
7744
|
+
description: import_mini30.z.string(),
|
|
7745
|
+
"allowed-tools": import_mini30.z.optional(import_mini30.z.array(import_mini30.z.string()))
|
|
7178
7746
|
});
|
|
7179
7747
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
7180
7748
|
constructor({
|
|
7181
7749
|
baseDir = process.cwd(),
|
|
7182
|
-
relativeDirPath = (0,
|
|
7750
|
+
relativeDirPath = (0, import_node_path63.join)(".opencode", "skill"),
|
|
7183
7751
|
dirName,
|
|
7184
7752
|
frontmatter,
|
|
7185
7753
|
body,
|
|
@@ -7208,7 +7776,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
7208
7776
|
}
|
|
7209
7777
|
static getSettablePaths({ global = false } = {}) {
|
|
7210
7778
|
return {
|
|
7211
|
-
relativeDirPath: global ? (0,
|
|
7779
|
+
relativeDirPath: global ? (0, import_node_path63.join)(".config", "opencode", "skill") : (0, import_node_path63.join)(".opencode", "skill")
|
|
7212
7780
|
};
|
|
7213
7781
|
}
|
|
7214
7782
|
getFrontmatter() {
|
|
@@ -7296,9 +7864,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
7296
7864
|
});
|
|
7297
7865
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7298
7866
|
if (!result.success) {
|
|
7299
|
-
const skillDirPath = (0,
|
|
7867
|
+
const skillDirPath = (0, import_node_path63.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7300
7868
|
throw new Error(
|
|
7301
|
-
`Invalid frontmatter in ${(0,
|
|
7869
|
+
`Invalid frontmatter in ${(0, import_node_path63.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7302
7870
|
);
|
|
7303
7871
|
}
|
|
7304
7872
|
return new _OpenCodeSkill({
|
|
@@ -7331,17 +7899,177 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
7331
7899
|
}
|
|
7332
7900
|
};
|
|
7333
7901
|
|
|
7902
|
+
// src/features/skills/replit-skill.ts
|
|
7903
|
+
var import_node_path64 = require("path");
|
|
7904
|
+
var import_mini31 = require("zod/mini");
|
|
7905
|
+
var ReplitSkillFrontmatterSchema = import_mini31.z.looseObject({
|
|
7906
|
+
name: import_mini31.z.string(),
|
|
7907
|
+
description: import_mini31.z.string()
|
|
7908
|
+
});
|
|
7909
|
+
var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
7910
|
+
constructor({
|
|
7911
|
+
baseDir = process.cwd(),
|
|
7912
|
+
relativeDirPath = (0, import_node_path64.join)(".agent", "skills"),
|
|
7913
|
+
dirName,
|
|
7914
|
+
frontmatter,
|
|
7915
|
+
body,
|
|
7916
|
+
otherFiles = [],
|
|
7917
|
+
validate = true,
|
|
7918
|
+
global = false
|
|
7919
|
+
}) {
|
|
7920
|
+
super({
|
|
7921
|
+
baseDir,
|
|
7922
|
+
relativeDirPath,
|
|
7923
|
+
dirName,
|
|
7924
|
+
mainFile: {
|
|
7925
|
+
name: SKILL_FILE_NAME,
|
|
7926
|
+
body,
|
|
7927
|
+
frontmatter: { ...frontmatter }
|
|
7928
|
+
},
|
|
7929
|
+
otherFiles,
|
|
7930
|
+
global
|
|
7931
|
+
});
|
|
7932
|
+
if (validate) {
|
|
7933
|
+
const result = this.validate();
|
|
7934
|
+
if (!result.success) {
|
|
7935
|
+
throw result.error;
|
|
7936
|
+
}
|
|
7937
|
+
}
|
|
7938
|
+
}
|
|
7939
|
+
static getSettablePaths(options) {
|
|
7940
|
+
if (options?.global) {
|
|
7941
|
+
throw new Error("ReplitSkill does not support global mode.");
|
|
7942
|
+
}
|
|
7943
|
+
return {
|
|
7944
|
+
relativeDirPath: (0, import_node_path64.join)(".agent", "skills")
|
|
7945
|
+
};
|
|
7946
|
+
}
|
|
7947
|
+
getFrontmatter() {
|
|
7948
|
+
if (!this.mainFile?.frontmatter) {
|
|
7949
|
+
throw new Error("Frontmatter is not defined");
|
|
7950
|
+
}
|
|
7951
|
+
const result = ReplitSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
7952
|
+
return result;
|
|
7953
|
+
}
|
|
7954
|
+
getBody() {
|
|
7955
|
+
return this.mainFile?.body ?? "";
|
|
7956
|
+
}
|
|
7957
|
+
validate() {
|
|
7958
|
+
if (!this.mainFile) {
|
|
7959
|
+
return {
|
|
7960
|
+
success: false,
|
|
7961
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
7962
|
+
};
|
|
7963
|
+
}
|
|
7964
|
+
const result = ReplitSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
7965
|
+
if (!result.success) {
|
|
7966
|
+
return {
|
|
7967
|
+
success: false,
|
|
7968
|
+
error: new Error(
|
|
7969
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
7970
|
+
)
|
|
7971
|
+
};
|
|
7972
|
+
}
|
|
7973
|
+
return { success: true, error: null };
|
|
7974
|
+
}
|
|
7975
|
+
toRulesyncSkill() {
|
|
7976
|
+
const frontmatter = this.getFrontmatter();
|
|
7977
|
+
const rulesyncFrontmatter = {
|
|
7978
|
+
name: frontmatter.name,
|
|
7979
|
+
description: frontmatter.description,
|
|
7980
|
+
targets: ["*"]
|
|
7981
|
+
};
|
|
7982
|
+
return new RulesyncSkill({
|
|
7983
|
+
baseDir: this.baseDir,
|
|
7984
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
7985
|
+
dirName: this.getDirName(),
|
|
7986
|
+
frontmatter: rulesyncFrontmatter,
|
|
7987
|
+
body: this.getBody(),
|
|
7988
|
+
otherFiles: this.getOtherFiles(),
|
|
7989
|
+
validate: true,
|
|
7990
|
+
global: this.global
|
|
7991
|
+
});
|
|
7992
|
+
}
|
|
7993
|
+
static fromRulesyncSkill({
|
|
7994
|
+
rulesyncSkill,
|
|
7995
|
+
validate = true,
|
|
7996
|
+
global = false
|
|
7997
|
+
}) {
|
|
7998
|
+
const settablePaths = _ReplitSkill.getSettablePaths({ global });
|
|
7999
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
8000
|
+
const replitFrontmatter = {
|
|
8001
|
+
name: rulesyncFrontmatter.name,
|
|
8002
|
+
description: rulesyncFrontmatter.description
|
|
8003
|
+
};
|
|
8004
|
+
return new _ReplitSkill({
|
|
8005
|
+
baseDir: rulesyncSkill.getBaseDir(),
|
|
8006
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
8007
|
+
dirName: rulesyncSkill.getDirName(),
|
|
8008
|
+
frontmatter: replitFrontmatter,
|
|
8009
|
+
body: rulesyncSkill.getBody(),
|
|
8010
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
8011
|
+
validate,
|
|
8012
|
+
global
|
|
8013
|
+
});
|
|
8014
|
+
}
|
|
8015
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
8016
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
8017
|
+
return targets.includes("*") || targets.includes("replit");
|
|
8018
|
+
}
|
|
8019
|
+
static async fromDir(params) {
|
|
8020
|
+
const loaded = await this.loadSkillDirContent({
|
|
8021
|
+
...params,
|
|
8022
|
+
getSettablePaths: _ReplitSkill.getSettablePaths
|
|
8023
|
+
});
|
|
8024
|
+
const result = ReplitSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8025
|
+
if (!result.success) {
|
|
8026
|
+
const skillDirPath = (0, import_node_path64.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8027
|
+
throw new Error(
|
|
8028
|
+
`Invalid frontmatter in ${(0, import_node_path64.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8029
|
+
);
|
|
8030
|
+
}
|
|
8031
|
+
return new _ReplitSkill({
|
|
8032
|
+
baseDir: loaded.baseDir,
|
|
8033
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
8034
|
+
dirName: loaded.dirName,
|
|
8035
|
+
frontmatter: result.data,
|
|
8036
|
+
body: loaded.body,
|
|
8037
|
+
otherFiles: loaded.otherFiles,
|
|
8038
|
+
validate: true,
|
|
8039
|
+
global: loaded.global
|
|
8040
|
+
});
|
|
8041
|
+
}
|
|
8042
|
+
static forDeletion({
|
|
8043
|
+
baseDir = process.cwd(),
|
|
8044
|
+
relativeDirPath,
|
|
8045
|
+
dirName,
|
|
8046
|
+
global = false
|
|
8047
|
+
}) {
|
|
8048
|
+
const settablePaths = _ReplitSkill.getSettablePaths({ global });
|
|
8049
|
+
return new _ReplitSkill({
|
|
8050
|
+
baseDir,
|
|
8051
|
+
relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
|
|
8052
|
+
dirName,
|
|
8053
|
+
frontmatter: { name: "", description: "" },
|
|
8054
|
+
body: "",
|
|
8055
|
+
otherFiles: [],
|
|
8056
|
+
validate: false,
|
|
8057
|
+
global
|
|
8058
|
+
});
|
|
8059
|
+
}
|
|
8060
|
+
};
|
|
8061
|
+
|
|
7334
8062
|
// src/features/skills/roo-skill.ts
|
|
7335
|
-
var
|
|
7336
|
-
var
|
|
7337
|
-
var RooSkillFrontmatterSchema =
|
|
7338
|
-
name:
|
|
7339
|
-
description:
|
|
8063
|
+
var import_node_path65 = require("path");
|
|
8064
|
+
var import_mini32 = require("zod/mini");
|
|
8065
|
+
var RooSkillFrontmatterSchema = import_mini32.z.looseObject({
|
|
8066
|
+
name: import_mini32.z.string(),
|
|
8067
|
+
description: import_mini32.z.string()
|
|
7340
8068
|
});
|
|
7341
8069
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
7342
8070
|
constructor({
|
|
7343
8071
|
baseDir = process.cwd(),
|
|
7344
|
-
relativeDirPath = (0,
|
|
8072
|
+
relativeDirPath = (0, import_node_path65.join)(".roo", "skills"),
|
|
7345
8073
|
dirName,
|
|
7346
8074
|
frontmatter,
|
|
7347
8075
|
body,
|
|
@@ -7372,7 +8100,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
7372
8100
|
global: _global = false
|
|
7373
8101
|
} = {}) {
|
|
7374
8102
|
return {
|
|
7375
|
-
relativeDirPath: (0,
|
|
8103
|
+
relativeDirPath: (0, import_node_path65.join)(".roo", "skills")
|
|
7376
8104
|
};
|
|
7377
8105
|
}
|
|
7378
8106
|
getFrontmatter() {
|
|
@@ -7462,13 +8190,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
7462
8190
|
});
|
|
7463
8191
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7464
8192
|
if (!result.success) {
|
|
7465
|
-
const skillDirPath = (0,
|
|
8193
|
+
const skillDirPath = (0, import_node_path65.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7466
8194
|
throw new Error(
|
|
7467
|
-
`Invalid frontmatter in ${(0,
|
|
8195
|
+
`Invalid frontmatter in ${(0, import_node_path65.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7468
8196
|
);
|
|
7469
8197
|
}
|
|
7470
8198
|
if (result.data.name !== loaded.dirName) {
|
|
7471
|
-
const skillFilePath = (0,
|
|
8199
|
+
const skillFilePath = (0, import_node_path65.join)(
|
|
7472
8200
|
loaded.baseDir,
|
|
7473
8201
|
loaded.relativeDirPath,
|
|
7474
8202
|
loaded.dirName,
|
|
@@ -7521,9 +8249,10 @@ var skillsProcessorToolTargetTuple = [
|
|
|
7521
8249
|
"kilo",
|
|
7522
8250
|
"kiro",
|
|
7523
8251
|
"opencode",
|
|
8252
|
+
"replit",
|
|
7524
8253
|
"roo"
|
|
7525
8254
|
];
|
|
7526
|
-
var SkillsProcessorToolTargetSchema =
|
|
8255
|
+
var SkillsProcessorToolTargetSchema = import_mini33.z.enum(skillsProcessorToolTargetTuple);
|
|
7527
8256
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
7528
8257
|
[
|
|
7529
8258
|
"agentsmd",
|
|
@@ -7571,7 +8300,7 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
7571
8300
|
"cursor",
|
|
7572
8301
|
{
|
|
7573
8302
|
class: CursorSkill,
|
|
7574
|
-
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal:
|
|
8303
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
7575
8304
|
}
|
|
7576
8305
|
],
|
|
7577
8306
|
[
|
|
@@ -7602,6 +8331,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
7602
8331
|
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
7603
8332
|
}
|
|
7604
8333
|
],
|
|
8334
|
+
[
|
|
8335
|
+
"replit",
|
|
8336
|
+
{
|
|
8337
|
+
class: ReplitSkill,
|
|
8338
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: false }
|
|
8339
|
+
}
|
|
8340
|
+
],
|
|
7605
8341
|
[
|
|
7606
8342
|
"roo",
|
|
7607
8343
|
{
|
|
@@ -7687,9 +8423,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7687
8423
|
*/
|
|
7688
8424
|
async loadRulesyncDirs() {
|
|
7689
8425
|
const paths = RulesyncSkill.getSettablePaths();
|
|
7690
|
-
const rulesyncSkillsDirPath = (0,
|
|
7691
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
7692
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
8426
|
+
const rulesyncSkillsDirPath = (0, import_node_path66.join)(this.baseDir, paths.relativeDirPath);
|
|
8427
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path66.join)(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
8428
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path66.basename)(path3));
|
|
7693
8429
|
const rulesyncSkills = await Promise.all(
|
|
7694
8430
|
dirNames.map(
|
|
7695
8431
|
(dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
|
|
@@ -7705,9 +8441,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7705
8441
|
async loadToolDirs() {
|
|
7706
8442
|
const factory = this.getFactory(this.toolTarget);
|
|
7707
8443
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7708
|
-
const skillsDirPath = (0,
|
|
7709
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
7710
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
8444
|
+
const skillsDirPath = (0, import_node_path66.join)(this.baseDir, paths.relativeDirPath);
|
|
8445
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path66.join)(skillsDirPath, "*"), { type: "dir" });
|
|
8446
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path66.basename)(path3));
|
|
7711
8447
|
const toolSkills = await Promise.all(
|
|
7712
8448
|
dirNames.map(
|
|
7713
8449
|
(dirName) => factory.class.fromDir({
|
|
@@ -7723,9 +8459,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7723
8459
|
async loadToolDirsToDelete() {
|
|
7724
8460
|
const factory = this.getFactory(this.toolTarget);
|
|
7725
8461
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7726
|
-
const skillsDirPath = (0,
|
|
7727
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
7728
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
8462
|
+
const skillsDirPath = (0, import_node_path66.join)(this.baseDir, paths.relativeDirPath);
|
|
8463
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path66.join)(skillsDirPath, "*"), { type: "dir" });
|
|
8464
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path66.basename)(path3));
|
|
7729
8465
|
const toolSkills = dirNames.map(
|
|
7730
8466
|
(dirName) => factory.class.forDeletion({
|
|
7731
8467
|
baseDir: this.baseDir,
|
|
@@ -7773,11 +8509,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7773
8509
|
};
|
|
7774
8510
|
|
|
7775
8511
|
// src/features/subagents/agentsmd-subagent.ts
|
|
7776
|
-
var
|
|
8512
|
+
var import_node_path68 = require("path");
|
|
7777
8513
|
|
|
7778
8514
|
// src/features/subagents/simulated-subagent.ts
|
|
7779
|
-
var
|
|
7780
|
-
var
|
|
8515
|
+
var import_node_path67 = require("path");
|
|
8516
|
+
var import_mini34 = require("zod/mini");
|
|
7781
8517
|
|
|
7782
8518
|
// src/features/subagents/tool-subagent.ts
|
|
7783
8519
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -7820,9 +8556,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
7820
8556
|
};
|
|
7821
8557
|
|
|
7822
8558
|
// src/features/subagents/simulated-subagent.ts
|
|
7823
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
7824
|
-
name:
|
|
7825
|
-
description:
|
|
8559
|
+
var SimulatedSubagentFrontmatterSchema = import_mini34.z.object({
|
|
8560
|
+
name: import_mini34.z.string(),
|
|
8561
|
+
description: import_mini34.z.string()
|
|
7826
8562
|
});
|
|
7827
8563
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
7828
8564
|
frontmatter;
|
|
@@ -7832,7 +8568,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7832
8568
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7833
8569
|
if (!result.success) {
|
|
7834
8570
|
throw new Error(
|
|
7835
|
-
`Invalid frontmatter in ${(0,
|
|
8571
|
+
`Invalid frontmatter in ${(0, import_node_path67.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7836
8572
|
);
|
|
7837
8573
|
}
|
|
7838
8574
|
}
|
|
@@ -7883,7 +8619,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7883
8619
|
return {
|
|
7884
8620
|
success: false,
|
|
7885
8621
|
error: new Error(
|
|
7886
|
-
`Invalid frontmatter in ${(0,
|
|
8622
|
+
`Invalid frontmatter in ${(0, import_node_path67.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7887
8623
|
)
|
|
7888
8624
|
};
|
|
7889
8625
|
}
|
|
@@ -7893,7 +8629,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7893
8629
|
relativeFilePath,
|
|
7894
8630
|
validate = true
|
|
7895
8631
|
}) {
|
|
7896
|
-
const filePath = (0,
|
|
8632
|
+
const filePath = (0, import_node_path67.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
7897
8633
|
const fileContent = await readFileContent(filePath);
|
|
7898
8634
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7899
8635
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7903,7 +8639,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7903
8639
|
return {
|
|
7904
8640
|
baseDir,
|
|
7905
8641
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
7906
|
-
relativeFilePath: (0,
|
|
8642
|
+
relativeFilePath: (0, import_node_path67.basename)(relativeFilePath),
|
|
7907
8643
|
frontmatter: result.data,
|
|
7908
8644
|
body: content.trim(),
|
|
7909
8645
|
validate
|
|
@@ -7929,7 +8665,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7929
8665
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
7930
8666
|
static getSettablePaths() {
|
|
7931
8667
|
return {
|
|
7932
|
-
relativeDirPath: (0,
|
|
8668
|
+
relativeDirPath: (0, import_node_path68.join)(".agents", "subagents")
|
|
7933
8669
|
};
|
|
7934
8670
|
}
|
|
7935
8671
|
static async fromFile(params) {
|
|
@@ -7952,11 +8688,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
7952
8688
|
};
|
|
7953
8689
|
|
|
7954
8690
|
// src/features/subagents/codexcli-subagent.ts
|
|
7955
|
-
var
|
|
8691
|
+
var import_node_path69 = require("path");
|
|
7956
8692
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
7957
8693
|
static getSettablePaths() {
|
|
7958
8694
|
return {
|
|
7959
|
-
relativeDirPath: (0,
|
|
8695
|
+
relativeDirPath: (0, import_node_path69.join)(".codex", "subagents")
|
|
7960
8696
|
};
|
|
7961
8697
|
}
|
|
7962
8698
|
static async fromFile(params) {
|
|
@@ -7979,11 +8715,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
7979
8715
|
};
|
|
7980
8716
|
|
|
7981
8717
|
// src/features/subagents/geminicli-subagent.ts
|
|
7982
|
-
var
|
|
8718
|
+
var import_node_path70 = require("path");
|
|
7983
8719
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
7984
8720
|
static getSettablePaths() {
|
|
7985
8721
|
return {
|
|
7986
|
-
relativeDirPath: (0,
|
|
8722
|
+
relativeDirPath: (0, import_node_path70.join)(".gemini", "subagents")
|
|
7987
8723
|
};
|
|
7988
8724
|
}
|
|
7989
8725
|
static async fromFile(params) {
|
|
@@ -8006,11 +8742,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
8006
8742
|
};
|
|
8007
8743
|
|
|
8008
8744
|
// src/features/subagents/roo-subagent.ts
|
|
8009
|
-
var
|
|
8745
|
+
var import_node_path71 = require("path");
|
|
8010
8746
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
8011
8747
|
static getSettablePaths() {
|
|
8012
8748
|
return {
|
|
8013
|
-
relativeDirPath: (0,
|
|
8749
|
+
relativeDirPath: (0, import_node_path71.join)(".roo", "subagents")
|
|
8014
8750
|
};
|
|
8015
8751
|
}
|
|
8016
8752
|
static async fromFile(params) {
|
|
@@ -8033,20 +8769,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
8033
8769
|
};
|
|
8034
8770
|
|
|
8035
8771
|
// src/features/subagents/subagents-processor.ts
|
|
8036
|
-
var
|
|
8037
|
-
var
|
|
8772
|
+
var import_node_path78 = require("path");
|
|
8773
|
+
var import_mini41 = require("zod/mini");
|
|
8038
8774
|
|
|
8039
8775
|
// src/features/subagents/claudecode-subagent.ts
|
|
8040
|
-
var
|
|
8041
|
-
var
|
|
8776
|
+
var import_node_path73 = require("path");
|
|
8777
|
+
var import_mini36 = require("zod/mini");
|
|
8042
8778
|
|
|
8043
8779
|
// src/features/subagents/rulesync-subagent.ts
|
|
8044
|
-
var
|
|
8045
|
-
var
|
|
8046
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
8780
|
+
var import_node_path72 = require("path");
|
|
8781
|
+
var import_mini35 = require("zod/mini");
|
|
8782
|
+
var RulesyncSubagentFrontmatterSchema = import_mini35.z.looseObject({
|
|
8047
8783
|
targets: RulesyncTargetsSchema,
|
|
8048
|
-
name:
|
|
8049
|
-
description:
|
|
8784
|
+
name: import_mini35.z.string(),
|
|
8785
|
+
description: import_mini35.z.string()
|
|
8050
8786
|
});
|
|
8051
8787
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
8052
8788
|
frontmatter;
|
|
@@ -8056,7 +8792,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
8056
8792
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8057
8793
|
if (!result.success) {
|
|
8058
8794
|
throw new Error(
|
|
8059
|
-
`Invalid frontmatter in ${(0,
|
|
8795
|
+
`Invalid frontmatter in ${(0, import_node_path72.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8060
8796
|
);
|
|
8061
8797
|
}
|
|
8062
8798
|
}
|
|
@@ -8089,7 +8825,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
8089
8825
|
return {
|
|
8090
8826
|
success: false,
|
|
8091
8827
|
error: new Error(
|
|
8092
|
-
`Invalid frontmatter in ${(0,
|
|
8828
|
+
`Invalid frontmatter in ${(0, import_node_path72.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8093
8829
|
)
|
|
8094
8830
|
};
|
|
8095
8831
|
}
|
|
@@ -8098,14 +8834,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
8098
8834
|
relativeFilePath
|
|
8099
8835
|
}) {
|
|
8100
8836
|
const fileContent = await readFileContent(
|
|
8101
|
-
(0,
|
|
8837
|
+
(0, import_node_path72.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
8102
8838
|
);
|
|
8103
8839
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8104
8840
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8105
8841
|
if (!result.success) {
|
|
8106
8842
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
8107
8843
|
}
|
|
8108
|
-
const filename = (0,
|
|
8844
|
+
const filename = (0, import_node_path72.basename)(relativeFilePath);
|
|
8109
8845
|
return new _RulesyncSubagent({
|
|
8110
8846
|
baseDir: process.cwd(),
|
|
8111
8847
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -8117,13 +8853,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
8117
8853
|
};
|
|
8118
8854
|
|
|
8119
8855
|
// src/features/subagents/claudecode-subagent.ts
|
|
8120
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
8121
|
-
name:
|
|
8122
|
-
description:
|
|
8123
|
-
model:
|
|
8124
|
-
tools:
|
|
8125
|
-
permissionMode:
|
|
8126
|
-
skills:
|
|
8856
|
+
var ClaudecodeSubagentFrontmatterSchema = import_mini36.z.looseObject({
|
|
8857
|
+
name: import_mini36.z.string(),
|
|
8858
|
+
description: import_mini36.z.string(),
|
|
8859
|
+
model: import_mini36.z.optional(import_mini36.z.string()),
|
|
8860
|
+
tools: import_mini36.z.optional(import_mini36.z.union([import_mini36.z.string(), import_mini36.z.array(import_mini36.z.string())])),
|
|
8861
|
+
permissionMode: import_mini36.z.optional(import_mini36.z.string()),
|
|
8862
|
+
skills: import_mini36.z.optional(import_mini36.z.union([import_mini36.z.string(), import_mini36.z.array(import_mini36.z.string())]))
|
|
8127
8863
|
});
|
|
8128
8864
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
8129
8865
|
frontmatter;
|
|
@@ -8133,7 +8869,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8133
8869
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8134
8870
|
if (!result.success) {
|
|
8135
8871
|
throw new Error(
|
|
8136
|
-
`Invalid frontmatter in ${(0,
|
|
8872
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8137
8873
|
);
|
|
8138
8874
|
}
|
|
8139
8875
|
}
|
|
@@ -8145,7 +8881,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8145
8881
|
}
|
|
8146
8882
|
static getSettablePaths(_options = {}) {
|
|
8147
8883
|
return {
|
|
8148
|
-
relativeDirPath: (0,
|
|
8884
|
+
relativeDirPath: (0, import_node_path73.join)(".claude", "agents")
|
|
8149
8885
|
};
|
|
8150
8886
|
}
|
|
8151
8887
|
getFrontmatter() {
|
|
@@ -8219,7 +8955,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8219
8955
|
return {
|
|
8220
8956
|
success: false,
|
|
8221
8957
|
error: new Error(
|
|
8222
|
-
`Invalid frontmatter in ${(0,
|
|
8958
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8223
8959
|
)
|
|
8224
8960
|
};
|
|
8225
8961
|
}
|
|
@@ -8237,7 +8973,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8237
8973
|
global = false
|
|
8238
8974
|
}) {
|
|
8239
8975
|
const paths = this.getSettablePaths({ global });
|
|
8240
|
-
const filePath = (0,
|
|
8976
|
+
const filePath = (0, import_node_path73.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8241
8977
|
const fileContent = await readFileContent(filePath);
|
|
8242
8978
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8243
8979
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8272,13 +9008,13 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8272
9008
|
};
|
|
8273
9009
|
|
|
8274
9010
|
// src/features/subagents/copilot-subagent.ts
|
|
8275
|
-
var
|
|
8276
|
-
var
|
|
9011
|
+
var import_node_path74 = require("path");
|
|
9012
|
+
var import_mini37 = require("zod/mini");
|
|
8277
9013
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
8278
|
-
var CopilotSubagentFrontmatterSchema =
|
|
8279
|
-
name:
|
|
8280
|
-
description:
|
|
8281
|
-
tools:
|
|
9014
|
+
var CopilotSubagentFrontmatterSchema = import_mini37.z.looseObject({
|
|
9015
|
+
name: import_mini37.z.string(),
|
|
9016
|
+
description: import_mini37.z.string(),
|
|
9017
|
+
tools: import_mini37.z.optional(import_mini37.z.union([import_mini37.z.string(), import_mini37.z.array(import_mini37.z.string())]))
|
|
8282
9018
|
});
|
|
8283
9019
|
var normalizeTools = (tools) => {
|
|
8284
9020
|
if (!tools) {
|
|
@@ -8298,7 +9034,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8298
9034
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8299
9035
|
if (!result.success) {
|
|
8300
9036
|
throw new Error(
|
|
8301
|
-
`Invalid frontmatter in ${(0,
|
|
9037
|
+
`Invalid frontmatter in ${(0, import_node_path74.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8302
9038
|
);
|
|
8303
9039
|
}
|
|
8304
9040
|
}
|
|
@@ -8310,7 +9046,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8310
9046
|
}
|
|
8311
9047
|
static getSettablePaths(_options = {}) {
|
|
8312
9048
|
return {
|
|
8313
|
-
relativeDirPath: (0,
|
|
9049
|
+
relativeDirPath: (0, import_node_path74.join)(".github", "agents")
|
|
8314
9050
|
};
|
|
8315
9051
|
}
|
|
8316
9052
|
getFrontmatter() {
|
|
@@ -8384,7 +9120,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8384
9120
|
return {
|
|
8385
9121
|
success: false,
|
|
8386
9122
|
error: new Error(
|
|
8387
|
-
`Invalid frontmatter in ${(0,
|
|
9123
|
+
`Invalid frontmatter in ${(0, import_node_path74.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8388
9124
|
)
|
|
8389
9125
|
};
|
|
8390
9126
|
}
|
|
@@ -8402,7 +9138,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8402
9138
|
global = false
|
|
8403
9139
|
}) {
|
|
8404
9140
|
const paths = this.getSettablePaths({ global });
|
|
8405
|
-
const filePath = (0,
|
|
9141
|
+
const filePath = (0, import_node_path74.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8406
9142
|
const fileContent = await readFileContent(filePath);
|
|
8407
9143
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8408
9144
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8438,11 +9174,11 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8438
9174
|
};
|
|
8439
9175
|
|
|
8440
9176
|
// src/features/subagents/cursor-subagent.ts
|
|
8441
|
-
var
|
|
8442
|
-
var
|
|
8443
|
-
var CursorSubagentFrontmatterSchema =
|
|
8444
|
-
name:
|
|
8445
|
-
description:
|
|
9177
|
+
var import_node_path75 = require("path");
|
|
9178
|
+
var import_mini38 = require("zod/mini");
|
|
9179
|
+
var CursorSubagentFrontmatterSchema = import_mini38.z.looseObject({
|
|
9180
|
+
name: import_mini38.z.string(),
|
|
9181
|
+
description: import_mini38.z.string()
|
|
8446
9182
|
});
|
|
8447
9183
|
var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
8448
9184
|
frontmatter;
|
|
@@ -8452,7 +9188,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
8452
9188
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8453
9189
|
if (!result.success) {
|
|
8454
9190
|
throw new Error(
|
|
8455
|
-
`Invalid frontmatter in ${(0,
|
|
9191
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8456
9192
|
);
|
|
8457
9193
|
}
|
|
8458
9194
|
}
|
|
@@ -8464,7 +9200,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
8464
9200
|
}
|
|
8465
9201
|
static getSettablePaths(_options = {}) {
|
|
8466
9202
|
return {
|
|
8467
|
-
relativeDirPath: (0,
|
|
9203
|
+
relativeDirPath: (0, import_node_path75.join)(".cursor", "agents")
|
|
8468
9204
|
};
|
|
8469
9205
|
}
|
|
8470
9206
|
getFrontmatter() {
|
|
@@ -8531,7 +9267,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
8531
9267
|
return {
|
|
8532
9268
|
success: false,
|
|
8533
9269
|
error: new Error(
|
|
8534
|
-
`Invalid frontmatter in ${(0,
|
|
9270
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8535
9271
|
)
|
|
8536
9272
|
};
|
|
8537
9273
|
}
|
|
@@ -8549,7 +9285,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
8549
9285
|
global = false
|
|
8550
9286
|
}) {
|
|
8551
9287
|
const paths = this.getSettablePaths({ global });
|
|
8552
|
-
const filePath = (0,
|
|
9288
|
+
const filePath = (0, import_node_path75.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8553
9289
|
const fileContent = await readFileContent(filePath);
|
|
8554
9290
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8555
9291
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8585,23 +9321,23 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
8585
9321
|
};
|
|
8586
9322
|
|
|
8587
9323
|
// src/features/subagents/kiro-subagent.ts
|
|
8588
|
-
var
|
|
8589
|
-
var
|
|
8590
|
-
var KiroCliSubagentJsonSchema =
|
|
8591
|
-
name:
|
|
8592
|
-
description:
|
|
8593
|
-
prompt:
|
|
8594
|
-
tools:
|
|
8595
|
-
toolAliases:
|
|
8596
|
-
toolSettings:
|
|
8597
|
-
toolSchema:
|
|
8598
|
-
hooks:
|
|
8599
|
-
model:
|
|
8600
|
-
mcpServers:
|
|
8601
|
-
useLegacyMcpJson:
|
|
8602
|
-
resources:
|
|
8603
|
-
allowedTools:
|
|
8604
|
-
includeMcpJson:
|
|
9324
|
+
var import_node_path76 = require("path");
|
|
9325
|
+
var import_mini39 = require("zod/mini");
|
|
9326
|
+
var KiroCliSubagentJsonSchema = import_mini39.z.looseObject({
|
|
9327
|
+
name: import_mini39.z.string(),
|
|
9328
|
+
description: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.string())),
|
|
9329
|
+
prompt: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.string())),
|
|
9330
|
+
tools: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.array(import_mini39.z.string()))),
|
|
9331
|
+
toolAliases: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.record(import_mini39.z.string(), import_mini39.z.string()))),
|
|
9332
|
+
toolSettings: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.unknown())),
|
|
9333
|
+
toolSchema: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.unknown())),
|
|
9334
|
+
hooks: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.record(import_mini39.z.string(), import_mini39.z.array(import_mini39.z.unknown())))),
|
|
9335
|
+
model: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.string())),
|
|
9336
|
+
mcpServers: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.record(import_mini39.z.string(), import_mini39.z.unknown()))),
|
|
9337
|
+
useLegacyMcpJson: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.boolean())),
|
|
9338
|
+
resources: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.array(import_mini39.z.string()))),
|
|
9339
|
+
allowedTools: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.array(import_mini39.z.string()))),
|
|
9340
|
+
includeMcpJson: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.boolean()))
|
|
8605
9341
|
});
|
|
8606
9342
|
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
8607
9343
|
body;
|
|
@@ -8613,7 +9349,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
8613
9349
|
}
|
|
8614
9350
|
static getSettablePaths(_options = {}) {
|
|
8615
9351
|
return {
|
|
8616
|
-
relativeDirPath: (0,
|
|
9352
|
+
relativeDirPath: (0, import_node_path76.join)(".kiro", "agents")
|
|
8617
9353
|
};
|
|
8618
9354
|
}
|
|
8619
9355
|
getBody() {
|
|
@@ -8693,7 +9429,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
8693
9429
|
global = false
|
|
8694
9430
|
}) {
|
|
8695
9431
|
const paths = this.getSettablePaths({ global });
|
|
8696
|
-
const filePath = (0,
|
|
9432
|
+
const filePath = (0, import_node_path76.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8697
9433
|
const fileContent = await readFileContent(filePath);
|
|
8698
9434
|
return new _KiroSubagent({
|
|
8699
9435
|
baseDir,
|
|
@@ -8722,12 +9458,12 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
8722
9458
|
};
|
|
8723
9459
|
|
|
8724
9460
|
// src/features/subagents/opencode-subagent.ts
|
|
8725
|
-
var
|
|
8726
|
-
var
|
|
8727
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
8728
|
-
description:
|
|
8729
|
-
mode:
|
|
8730
|
-
name:
|
|
9461
|
+
var import_node_path77 = require("path");
|
|
9462
|
+
var import_mini40 = require("zod/mini");
|
|
9463
|
+
var OpenCodeSubagentFrontmatterSchema = import_mini40.z.looseObject({
|
|
9464
|
+
description: import_mini40.z.string(),
|
|
9465
|
+
mode: import_mini40.z.literal("subagent"),
|
|
9466
|
+
name: import_mini40.z.optional(import_mini40.z.string())
|
|
8731
9467
|
});
|
|
8732
9468
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
8733
9469
|
frontmatter;
|
|
@@ -8737,7 +9473,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8737
9473
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8738
9474
|
if (!result.success) {
|
|
8739
9475
|
throw new Error(
|
|
8740
|
-
`Invalid frontmatter in ${(0,
|
|
9476
|
+
`Invalid frontmatter in ${(0, import_node_path77.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8741
9477
|
);
|
|
8742
9478
|
}
|
|
8743
9479
|
}
|
|
@@ -8751,7 +9487,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8751
9487
|
global = false
|
|
8752
9488
|
} = {}) {
|
|
8753
9489
|
return {
|
|
8754
|
-
relativeDirPath: global ? (0,
|
|
9490
|
+
relativeDirPath: global ? (0, import_node_path77.join)(".config", "opencode", "agent") : (0, import_node_path77.join)(".opencode", "agent")
|
|
8755
9491
|
};
|
|
8756
9492
|
}
|
|
8757
9493
|
getFrontmatter() {
|
|
@@ -8764,7 +9500,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8764
9500
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
8765
9501
|
const rulesyncFrontmatter = {
|
|
8766
9502
|
targets: ["*"],
|
|
8767
|
-
name: name ?? (0,
|
|
9503
|
+
name: name ?? (0, import_node_path77.basename)(this.getRelativeFilePath(), ".md"),
|
|
8768
9504
|
description,
|
|
8769
9505
|
opencode: { mode, ...opencodeSection }
|
|
8770
9506
|
};
|
|
@@ -8817,7 +9553,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8817
9553
|
return {
|
|
8818
9554
|
success: false,
|
|
8819
9555
|
error: new Error(
|
|
8820
|
-
`Invalid frontmatter in ${(0,
|
|
9556
|
+
`Invalid frontmatter in ${(0, import_node_path77.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8821
9557
|
)
|
|
8822
9558
|
};
|
|
8823
9559
|
}
|
|
@@ -8834,7 +9570,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8834
9570
|
global = false
|
|
8835
9571
|
}) {
|
|
8836
9572
|
const paths = this.getSettablePaths({ global });
|
|
8837
|
-
const filePath = (0,
|
|
9573
|
+
const filePath = (0, import_node_path77.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8838
9574
|
const fileContent = await readFileContent(filePath);
|
|
8839
9575
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8840
9576
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8882,7 +9618,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
8882
9618
|
"opencode",
|
|
8883
9619
|
"roo"
|
|
8884
9620
|
];
|
|
8885
|
-
var SubagentsProcessorToolTargetSchema =
|
|
9621
|
+
var SubagentsProcessorToolTargetSchema = import_mini41.z.enum(subagentsProcessorToolTargetTuple);
|
|
8886
9622
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
8887
9623
|
[
|
|
8888
9624
|
"agentsmd",
|
|
@@ -8923,7 +9659,7 @@ var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
|
8923
9659
|
"cursor",
|
|
8924
9660
|
{
|
|
8925
9661
|
class: CursorSubagent,
|
|
8926
|
-
meta: { supportsSimulated: false, supportsGlobal:
|
|
9662
|
+
meta: { supportsSimulated: false, supportsGlobal: true, filePattern: "*.md" }
|
|
8927
9663
|
}
|
|
8928
9664
|
],
|
|
8929
9665
|
[
|
|
@@ -9036,7 +9772,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
9036
9772
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
9037
9773
|
*/
|
|
9038
9774
|
async loadRulesyncFiles() {
|
|
9039
|
-
const subagentsDir = (0,
|
|
9775
|
+
const subagentsDir = (0, import_node_path78.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
9040
9776
|
const dirExists = await directoryExists(subagentsDir);
|
|
9041
9777
|
if (!dirExists) {
|
|
9042
9778
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -9051,7 +9787,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
9051
9787
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
9052
9788
|
const rulesyncSubagents = [];
|
|
9053
9789
|
for (const mdFile of mdFiles) {
|
|
9054
|
-
const filepath = (0,
|
|
9790
|
+
const filepath = (0, import_node_path78.join)(subagentsDir, mdFile);
|
|
9055
9791
|
try {
|
|
9056
9792
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
9057
9793
|
relativeFilePath: mdFile,
|
|
@@ -9081,14 +9817,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
9081
9817
|
const factory = this.getFactory(this.toolTarget);
|
|
9082
9818
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
9083
9819
|
const subagentFilePaths = await findFilesByGlobs(
|
|
9084
|
-
(0,
|
|
9820
|
+
(0, import_node_path78.join)(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
9085
9821
|
);
|
|
9086
9822
|
if (forDeletion) {
|
|
9087
9823
|
const toolSubagents2 = subagentFilePaths.map(
|
|
9088
9824
|
(path3) => factory.class.forDeletion({
|
|
9089
9825
|
baseDir: this.baseDir,
|
|
9090
9826
|
relativeDirPath: paths.relativeDirPath,
|
|
9091
|
-
relativeFilePath: (0,
|
|
9827
|
+
relativeFilePath: (0, import_node_path78.basename)(path3),
|
|
9092
9828
|
global: this.global
|
|
9093
9829
|
})
|
|
9094
9830
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -9099,7 +9835,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
9099
9835
|
subagentFilePaths.map(
|
|
9100
9836
|
(path3) => factory.class.fromFile({
|
|
9101
9837
|
baseDir: this.baseDir,
|
|
9102
|
-
relativeFilePath: (0,
|
|
9838
|
+
relativeFilePath: (0, import_node_path78.basename)(path3),
|
|
9103
9839
|
global: this.global
|
|
9104
9840
|
})
|
|
9105
9841
|
)
|
|
@@ -9131,49 +9867,49 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
9131
9867
|
};
|
|
9132
9868
|
|
|
9133
9869
|
// src/features/rules/agentsmd-rule.ts
|
|
9134
|
-
var
|
|
9870
|
+
var import_node_path81 = require("path");
|
|
9135
9871
|
|
|
9136
9872
|
// src/features/rules/tool-rule.ts
|
|
9137
|
-
var
|
|
9873
|
+
var import_node_path80 = require("path");
|
|
9138
9874
|
|
|
9139
9875
|
// src/features/rules/rulesync-rule.ts
|
|
9140
|
-
var
|
|
9141
|
-
var
|
|
9142
|
-
var RulesyncRuleFrontmatterSchema =
|
|
9143
|
-
root:
|
|
9144
|
-
localRoot:
|
|
9145
|
-
targets:
|
|
9146
|
-
description:
|
|
9147
|
-
globs:
|
|
9148
|
-
agentsmd:
|
|
9149
|
-
|
|
9876
|
+
var import_node_path79 = require("path");
|
|
9877
|
+
var import_mini42 = require("zod/mini");
|
|
9878
|
+
var RulesyncRuleFrontmatterSchema = import_mini42.z.object({
|
|
9879
|
+
root: import_mini42.z.optional(import_mini42.z.boolean()),
|
|
9880
|
+
localRoot: import_mini42.z.optional(import_mini42.z.boolean()),
|
|
9881
|
+
targets: import_mini42.z.optional(RulesyncTargetsSchema),
|
|
9882
|
+
description: import_mini42.z.optional(import_mini42.z.string()),
|
|
9883
|
+
globs: import_mini42.z.optional(import_mini42.z.array(import_mini42.z.string())),
|
|
9884
|
+
agentsmd: import_mini42.z.optional(
|
|
9885
|
+
import_mini42.z.object({
|
|
9150
9886
|
// @example "path/to/subproject"
|
|
9151
|
-
subprojectPath:
|
|
9887
|
+
subprojectPath: import_mini42.z.optional(import_mini42.z.string())
|
|
9152
9888
|
})
|
|
9153
9889
|
),
|
|
9154
|
-
claudecode:
|
|
9155
|
-
|
|
9890
|
+
claudecode: import_mini42.z.optional(
|
|
9891
|
+
import_mini42.z.object({
|
|
9156
9892
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
9157
9893
|
// @example "src/**/*.ts, tests/**/*.test.ts"
|
|
9158
|
-
paths:
|
|
9894
|
+
paths: import_mini42.z.optional(import_mini42.z.string())
|
|
9159
9895
|
})
|
|
9160
9896
|
),
|
|
9161
|
-
cursor:
|
|
9162
|
-
|
|
9163
|
-
alwaysApply:
|
|
9164
|
-
description:
|
|
9165
|
-
globs:
|
|
9897
|
+
cursor: import_mini42.z.optional(
|
|
9898
|
+
import_mini42.z.object({
|
|
9899
|
+
alwaysApply: import_mini42.z.optional(import_mini42.z.boolean()),
|
|
9900
|
+
description: import_mini42.z.optional(import_mini42.z.string()),
|
|
9901
|
+
globs: import_mini42.z.optional(import_mini42.z.array(import_mini42.z.string()))
|
|
9166
9902
|
})
|
|
9167
9903
|
),
|
|
9168
|
-
copilot:
|
|
9169
|
-
|
|
9170
|
-
excludeAgent:
|
|
9904
|
+
copilot: import_mini42.z.optional(
|
|
9905
|
+
import_mini42.z.object({
|
|
9906
|
+
excludeAgent: import_mini42.z.optional(import_mini42.z.union([import_mini42.z.literal("code-review"), import_mini42.z.literal("coding-agent")]))
|
|
9171
9907
|
})
|
|
9172
9908
|
),
|
|
9173
|
-
antigravity:
|
|
9174
|
-
|
|
9175
|
-
trigger:
|
|
9176
|
-
globs:
|
|
9909
|
+
antigravity: import_mini42.z.optional(
|
|
9910
|
+
import_mini42.z.looseObject({
|
|
9911
|
+
trigger: import_mini42.z.optional(import_mini42.z.string()),
|
|
9912
|
+
globs: import_mini42.z.optional(import_mini42.z.array(import_mini42.z.string()))
|
|
9177
9913
|
})
|
|
9178
9914
|
)
|
|
9179
9915
|
});
|
|
@@ -9185,7 +9921,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
9185
9921
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9186
9922
|
if (!result.success) {
|
|
9187
9923
|
throw new Error(
|
|
9188
|
-
`Invalid frontmatter in ${(0,
|
|
9924
|
+
`Invalid frontmatter in ${(0, import_node_path79.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9189
9925
|
);
|
|
9190
9926
|
}
|
|
9191
9927
|
}
|
|
@@ -9220,7 +9956,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
9220
9956
|
return {
|
|
9221
9957
|
success: false,
|
|
9222
9958
|
error: new Error(
|
|
9223
|
-
`Invalid frontmatter in ${(0,
|
|
9959
|
+
`Invalid frontmatter in ${(0, import_node_path79.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9224
9960
|
)
|
|
9225
9961
|
};
|
|
9226
9962
|
}
|
|
@@ -9229,7 +9965,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
9229
9965
|
relativeFilePath,
|
|
9230
9966
|
validate = true
|
|
9231
9967
|
}) {
|
|
9232
|
-
const filePath = (0,
|
|
9968
|
+
const filePath = (0, import_node_path79.join)(
|
|
9233
9969
|
process.cwd(),
|
|
9234
9970
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
9235
9971
|
relativeFilePath
|
|
@@ -9331,7 +10067,7 @@ var ToolRule = class extends ToolFile {
|
|
|
9331
10067
|
rulesyncRule,
|
|
9332
10068
|
validate = true,
|
|
9333
10069
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
9334
|
-
nonRootPath = { relativeDirPath: (0,
|
|
10070
|
+
nonRootPath = { relativeDirPath: (0, import_node_path80.join)(".agents", "memories") }
|
|
9335
10071
|
}) {
|
|
9336
10072
|
const params = this.buildToolRuleParamsDefault({
|
|
9337
10073
|
baseDir,
|
|
@@ -9342,7 +10078,7 @@ var ToolRule = class extends ToolFile {
|
|
|
9342
10078
|
});
|
|
9343
10079
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
9344
10080
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
9345
|
-
params.relativeDirPath = (0,
|
|
10081
|
+
params.relativeDirPath = (0, import_node_path80.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
9346
10082
|
params.relativeFilePath = "AGENTS.md";
|
|
9347
10083
|
}
|
|
9348
10084
|
return params;
|
|
@@ -9407,7 +10143,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
9407
10143
|
relativeFilePath: "AGENTS.md"
|
|
9408
10144
|
},
|
|
9409
10145
|
nonRoot: {
|
|
9410
|
-
relativeDirPath: (0,
|
|
10146
|
+
relativeDirPath: (0, import_node_path81.join)(".agents", "memories")
|
|
9411
10147
|
}
|
|
9412
10148
|
};
|
|
9413
10149
|
}
|
|
@@ -9417,8 +10153,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
9417
10153
|
validate = true
|
|
9418
10154
|
}) {
|
|
9419
10155
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
9420
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
9421
|
-
const fileContent = await readFileContent((0,
|
|
10156
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path81.join)(".agents", "memories", relativeFilePath);
|
|
10157
|
+
const fileContent = await readFileContent((0, import_node_path81.join)(baseDir, relativePath));
|
|
9422
10158
|
return new _AgentsMdRule({
|
|
9423
10159
|
baseDir,
|
|
9424
10160
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9473,21 +10209,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
9473
10209
|
};
|
|
9474
10210
|
|
|
9475
10211
|
// src/features/rules/antigravity-rule.ts
|
|
9476
|
-
var
|
|
9477
|
-
var
|
|
9478
|
-
var AntigravityRuleFrontmatterSchema =
|
|
9479
|
-
trigger:
|
|
9480
|
-
|
|
9481
|
-
|
|
9482
|
-
|
|
9483
|
-
|
|
9484
|
-
|
|
9485
|
-
|
|
10212
|
+
var import_node_path82 = require("path");
|
|
10213
|
+
var import_mini43 = require("zod/mini");
|
|
10214
|
+
var AntigravityRuleFrontmatterSchema = import_mini43.z.looseObject({
|
|
10215
|
+
trigger: import_mini43.z.optional(
|
|
10216
|
+
import_mini43.z.union([
|
|
10217
|
+
import_mini43.z.literal("always_on"),
|
|
10218
|
+
import_mini43.z.literal("glob"),
|
|
10219
|
+
import_mini43.z.literal("manual"),
|
|
10220
|
+
import_mini43.z.literal("model_decision"),
|
|
10221
|
+
import_mini43.z.string()
|
|
9486
10222
|
// accepts any string for forward compatibility
|
|
9487
10223
|
])
|
|
9488
10224
|
),
|
|
9489
|
-
globs:
|
|
9490
|
-
description:
|
|
10225
|
+
globs: import_mini43.z.optional(import_mini43.z.string()),
|
|
10226
|
+
description: import_mini43.z.optional(import_mini43.z.string())
|
|
9491
10227
|
});
|
|
9492
10228
|
function parseGlobsString(globs) {
|
|
9493
10229
|
if (!globs) {
|
|
@@ -9632,7 +10368,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9632
10368
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9633
10369
|
if (!result.success) {
|
|
9634
10370
|
throw new Error(
|
|
9635
|
-
`Invalid frontmatter in ${(0,
|
|
10371
|
+
`Invalid frontmatter in ${(0, import_node_path82.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9636
10372
|
);
|
|
9637
10373
|
}
|
|
9638
10374
|
}
|
|
@@ -9647,7 +10383,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9647
10383
|
static getSettablePaths() {
|
|
9648
10384
|
return {
|
|
9649
10385
|
nonRoot: {
|
|
9650
|
-
relativeDirPath: (0,
|
|
10386
|
+
relativeDirPath: (0, import_node_path82.join)(".agent", "rules")
|
|
9651
10387
|
}
|
|
9652
10388
|
};
|
|
9653
10389
|
}
|
|
@@ -9656,7 +10392,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9656
10392
|
relativeFilePath,
|
|
9657
10393
|
validate = true
|
|
9658
10394
|
}) {
|
|
9659
|
-
const filePath = (0,
|
|
10395
|
+
const filePath = (0, import_node_path82.join)(
|
|
9660
10396
|
baseDir,
|
|
9661
10397
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
9662
10398
|
relativeFilePath
|
|
@@ -9797,7 +10533,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9797
10533
|
};
|
|
9798
10534
|
|
|
9799
10535
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
9800
|
-
var
|
|
10536
|
+
var import_node_path83 = require("path");
|
|
9801
10537
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
9802
10538
|
toRulesyncRule() {
|
|
9803
10539
|
const rulesyncFrontmatter = {
|
|
@@ -9823,7 +10559,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9823
10559
|
relativeFilePath: ".augment-guidelines"
|
|
9824
10560
|
},
|
|
9825
10561
|
nonRoot: {
|
|
9826
|
-
relativeDirPath: (0,
|
|
10562
|
+
relativeDirPath: (0, import_node_path83.join)(".augment", "rules")
|
|
9827
10563
|
}
|
|
9828
10564
|
};
|
|
9829
10565
|
}
|
|
@@ -9858,8 +10594,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9858
10594
|
}) {
|
|
9859
10595
|
const settablePaths = this.getSettablePaths();
|
|
9860
10596
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
9861
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
9862
|
-
const fileContent = await readFileContent((0,
|
|
10597
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path83.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10598
|
+
const fileContent = await readFileContent((0, import_node_path83.join)(baseDir, relativePath));
|
|
9863
10599
|
return new _AugmentcodeLegacyRule({
|
|
9864
10600
|
baseDir,
|
|
9865
10601
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -9888,7 +10624,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9888
10624
|
};
|
|
9889
10625
|
|
|
9890
10626
|
// src/features/rules/augmentcode-rule.ts
|
|
9891
|
-
var
|
|
10627
|
+
var import_node_path84 = require("path");
|
|
9892
10628
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
9893
10629
|
toRulesyncRule() {
|
|
9894
10630
|
return this.toRulesyncRuleDefault();
|
|
@@ -9896,7 +10632,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9896
10632
|
static getSettablePaths() {
|
|
9897
10633
|
return {
|
|
9898
10634
|
nonRoot: {
|
|
9899
|
-
relativeDirPath: (0,
|
|
10635
|
+
relativeDirPath: (0, import_node_path84.join)(".augment", "rules")
|
|
9900
10636
|
}
|
|
9901
10637
|
};
|
|
9902
10638
|
}
|
|
@@ -9920,7 +10656,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9920
10656
|
validate = true
|
|
9921
10657
|
}) {
|
|
9922
10658
|
const fileContent = await readFileContent(
|
|
9923
|
-
(0,
|
|
10659
|
+
(0, import_node_path84.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9924
10660
|
);
|
|
9925
10661
|
const { body: content } = parseFrontmatter(fileContent);
|
|
9926
10662
|
return new _AugmentcodeRule({
|
|
@@ -9956,7 +10692,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9956
10692
|
};
|
|
9957
10693
|
|
|
9958
10694
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
9959
|
-
var
|
|
10695
|
+
var import_node_path85 = require("path");
|
|
9960
10696
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
9961
10697
|
static getSettablePaths({
|
|
9962
10698
|
global
|
|
@@ -9975,7 +10711,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9975
10711
|
relativeFilePath: "CLAUDE.md"
|
|
9976
10712
|
},
|
|
9977
10713
|
nonRoot: {
|
|
9978
|
-
relativeDirPath: (0,
|
|
10714
|
+
relativeDirPath: (0, import_node_path85.join)(".claude", "memories")
|
|
9979
10715
|
}
|
|
9980
10716
|
};
|
|
9981
10717
|
}
|
|
@@ -9990,7 +10726,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9990
10726
|
if (isRoot) {
|
|
9991
10727
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9992
10728
|
const fileContent2 = await readFileContent(
|
|
9993
|
-
(0,
|
|
10729
|
+
(0, import_node_path85.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9994
10730
|
);
|
|
9995
10731
|
return new _ClaudecodeLegacyRule({
|
|
9996
10732
|
baseDir,
|
|
@@ -10004,8 +10740,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
10004
10740
|
if (!paths.nonRoot) {
|
|
10005
10741
|
throw new Error("nonRoot path is not set");
|
|
10006
10742
|
}
|
|
10007
|
-
const relativePath = (0,
|
|
10008
|
-
const fileContent = await readFileContent((0,
|
|
10743
|
+
const relativePath = (0, import_node_path85.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10744
|
+
const fileContent = await readFileContent((0, import_node_path85.join)(baseDir, relativePath));
|
|
10009
10745
|
return new _ClaudecodeLegacyRule({
|
|
10010
10746
|
baseDir,
|
|
10011
10747
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10064,10 +10800,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
10064
10800
|
};
|
|
10065
10801
|
|
|
10066
10802
|
// src/features/rules/claudecode-rule.ts
|
|
10067
|
-
var
|
|
10068
|
-
var
|
|
10069
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
10070
|
-
paths:
|
|
10803
|
+
var import_node_path86 = require("path");
|
|
10804
|
+
var import_mini44 = require("zod/mini");
|
|
10805
|
+
var ClaudecodeRuleFrontmatterSchema = import_mini44.z.object({
|
|
10806
|
+
paths: import_mini44.z.optional(import_mini44.z.string())
|
|
10071
10807
|
});
|
|
10072
10808
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
10073
10809
|
frontmatter;
|
|
@@ -10089,7 +10825,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
10089
10825
|
relativeFilePath: "CLAUDE.md"
|
|
10090
10826
|
},
|
|
10091
10827
|
nonRoot: {
|
|
10092
|
-
relativeDirPath: (0,
|
|
10828
|
+
relativeDirPath: (0, import_node_path86.join)(".claude", "rules")
|
|
10093
10829
|
}
|
|
10094
10830
|
};
|
|
10095
10831
|
}
|
|
@@ -10098,7 +10834,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
10098
10834
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10099
10835
|
if (!result.success) {
|
|
10100
10836
|
throw new Error(
|
|
10101
|
-
`Invalid frontmatter in ${(0,
|
|
10837
|
+
`Invalid frontmatter in ${(0, import_node_path86.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10102
10838
|
);
|
|
10103
10839
|
}
|
|
10104
10840
|
}
|
|
@@ -10126,7 +10862,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
10126
10862
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
10127
10863
|
if (isRoot) {
|
|
10128
10864
|
const fileContent2 = await readFileContent(
|
|
10129
|
-
(0,
|
|
10865
|
+
(0, import_node_path86.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
10130
10866
|
);
|
|
10131
10867
|
return new _ClaudecodeRule({
|
|
10132
10868
|
baseDir,
|
|
@@ -10141,13 +10877,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
10141
10877
|
if (!paths.nonRoot) {
|
|
10142
10878
|
throw new Error("nonRoot path is not set");
|
|
10143
10879
|
}
|
|
10144
|
-
const relativePath = (0,
|
|
10145
|
-
const fileContent = await readFileContent((0,
|
|
10880
|
+
const relativePath = (0, import_node_path86.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10881
|
+
const fileContent = await readFileContent((0, import_node_path86.join)(baseDir, relativePath));
|
|
10146
10882
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
10147
10883
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10148
10884
|
if (!result.success) {
|
|
10149
10885
|
throw new Error(
|
|
10150
|
-
`Invalid frontmatter in ${(0,
|
|
10886
|
+
`Invalid frontmatter in ${(0, import_node_path86.join)(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
10151
10887
|
);
|
|
10152
10888
|
}
|
|
10153
10889
|
return new _ClaudecodeRule({
|
|
@@ -10254,7 +10990,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
10254
10990
|
return {
|
|
10255
10991
|
success: false,
|
|
10256
10992
|
error: new Error(
|
|
10257
|
-
`Invalid frontmatter in ${(0,
|
|
10993
|
+
`Invalid frontmatter in ${(0, import_node_path86.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10258
10994
|
)
|
|
10259
10995
|
};
|
|
10260
10996
|
}
|
|
@@ -10274,10 +11010,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
10274
11010
|
};
|
|
10275
11011
|
|
|
10276
11012
|
// src/features/rules/cline-rule.ts
|
|
10277
|
-
var
|
|
10278
|
-
var
|
|
10279
|
-
var ClineRuleFrontmatterSchema =
|
|
10280
|
-
description:
|
|
11013
|
+
var import_node_path87 = require("path");
|
|
11014
|
+
var import_mini45 = require("zod/mini");
|
|
11015
|
+
var ClineRuleFrontmatterSchema = import_mini45.z.object({
|
|
11016
|
+
description: import_mini45.z.string()
|
|
10281
11017
|
});
|
|
10282
11018
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
10283
11019
|
static getSettablePaths() {
|
|
@@ -10319,7 +11055,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
10319
11055
|
validate = true
|
|
10320
11056
|
}) {
|
|
10321
11057
|
const fileContent = await readFileContent(
|
|
10322
|
-
(0,
|
|
11058
|
+
(0, import_node_path87.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10323
11059
|
);
|
|
10324
11060
|
return new _ClineRule({
|
|
10325
11061
|
baseDir,
|
|
@@ -10345,7 +11081,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
10345
11081
|
};
|
|
10346
11082
|
|
|
10347
11083
|
// src/features/rules/codexcli-rule.ts
|
|
10348
|
-
var
|
|
11084
|
+
var import_node_path88 = require("path");
|
|
10349
11085
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
10350
11086
|
static getSettablePaths({
|
|
10351
11087
|
global
|
|
@@ -10364,7 +11100,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10364
11100
|
relativeFilePath: "AGENTS.md"
|
|
10365
11101
|
},
|
|
10366
11102
|
nonRoot: {
|
|
10367
|
-
relativeDirPath: (0,
|
|
11103
|
+
relativeDirPath: (0, import_node_path88.join)(".codex", "memories")
|
|
10368
11104
|
}
|
|
10369
11105
|
};
|
|
10370
11106
|
}
|
|
@@ -10379,7 +11115,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10379
11115
|
if (isRoot) {
|
|
10380
11116
|
const relativePath2 = paths.root.relativeFilePath;
|
|
10381
11117
|
const fileContent2 = await readFileContent(
|
|
10382
|
-
(0,
|
|
11118
|
+
(0, import_node_path88.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
10383
11119
|
);
|
|
10384
11120
|
return new _CodexcliRule({
|
|
10385
11121
|
baseDir,
|
|
@@ -10393,8 +11129,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10393
11129
|
if (!paths.nonRoot) {
|
|
10394
11130
|
throw new Error("nonRoot path is not set");
|
|
10395
11131
|
}
|
|
10396
|
-
const relativePath = (0,
|
|
10397
|
-
const fileContent = await readFileContent((0,
|
|
11132
|
+
const relativePath = (0, import_node_path88.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
11133
|
+
const fileContent = await readFileContent((0, import_node_path88.join)(baseDir, relativePath));
|
|
10398
11134
|
return new _CodexcliRule({
|
|
10399
11135
|
baseDir,
|
|
10400
11136
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10453,12 +11189,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10453
11189
|
};
|
|
10454
11190
|
|
|
10455
11191
|
// src/features/rules/copilot-rule.ts
|
|
10456
|
-
var
|
|
10457
|
-
var
|
|
10458
|
-
var CopilotRuleFrontmatterSchema =
|
|
10459
|
-
description:
|
|
10460
|
-
applyTo:
|
|
10461
|
-
excludeAgent:
|
|
11192
|
+
var import_node_path89 = require("path");
|
|
11193
|
+
var import_mini46 = require("zod/mini");
|
|
11194
|
+
var CopilotRuleFrontmatterSchema = import_mini46.z.object({
|
|
11195
|
+
description: import_mini46.z.optional(import_mini46.z.string()),
|
|
11196
|
+
applyTo: import_mini46.z.optional(import_mini46.z.string()),
|
|
11197
|
+
excludeAgent: import_mini46.z.optional(import_mini46.z.union([import_mini46.z.literal("code-review"), import_mini46.z.literal("coding-agent")]))
|
|
10462
11198
|
});
|
|
10463
11199
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
10464
11200
|
frontmatter;
|
|
@@ -10470,7 +11206,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10470
11206
|
relativeFilePath: "copilot-instructions.md"
|
|
10471
11207
|
},
|
|
10472
11208
|
nonRoot: {
|
|
10473
|
-
relativeDirPath: (0,
|
|
11209
|
+
relativeDirPath: (0, import_node_path89.join)(".github", "instructions")
|
|
10474
11210
|
}
|
|
10475
11211
|
};
|
|
10476
11212
|
}
|
|
@@ -10479,7 +11215,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10479
11215
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10480
11216
|
if (!result.success) {
|
|
10481
11217
|
throw new Error(
|
|
10482
|
-
`Invalid frontmatter in ${(0,
|
|
11218
|
+
`Invalid frontmatter in ${(0, import_node_path89.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10483
11219
|
);
|
|
10484
11220
|
}
|
|
10485
11221
|
}
|
|
@@ -10561,11 +11297,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10561
11297
|
validate = true
|
|
10562
11298
|
}) {
|
|
10563
11299
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
10564
|
-
const relativePath = isRoot ? (0,
|
|
11300
|
+
const relativePath = isRoot ? (0, import_node_path89.join)(
|
|
10565
11301
|
this.getSettablePaths().root.relativeDirPath,
|
|
10566
11302
|
this.getSettablePaths().root.relativeFilePath
|
|
10567
|
-
) : (0,
|
|
10568
|
-
const fileContent = await readFileContent((0,
|
|
11303
|
+
) : (0, import_node_path89.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
11304
|
+
const fileContent = await readFileContent((0, import_node_path89.join)(baseDir, relativePath));
|
|
10569
11305
|
if (isRoot) {
|
|
10570
11306
|
return new _CopilotRule({
|
|
10571
11307
|
baseDir,
|
|
@@ -10581,7 +11317,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10581
11317
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10582
11318
|
if (!result.success) {
|
|
10583
11319
|
throw new Error(
|
|
10584
|
-
`Invalid frontmatter in ${(0,
|
|
11320
|
+
`Invalid frontmatter in ${(0, import_node_path89.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10585
11321
|
);
|
|
10586
11322
|
}
|
|
10587
11323
|
return new _CopilotRule({
|
|
@@ -10621,7 +11357,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10621
11357
|
return {
|
|
10622
11358
|
success: false,
|
|
10623
11359
|
error: new Error(
|
|
10624
|
-
`Invalid frontmatter in ${(0,
|
|
11360
|
+
`Invalid frontmatter in ${(0, import_node_path89.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10625
11361
|
)
|
|
10626
11362
|
};
|
|
10627
11363
|
}
|
|
@@ -10641,12 +11377,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10641
11377
|
};
|
|
10642
11378
|
|
|
10643
11379
|
// src/features/rules/cursor-rule.ts
|
|
10644
|
-
var
|
|
10645
|
-
var
|
|
10646
|
-
var CursorRuleFrontmatterSchema =
|
|
10647
|
-
description:
|
|
10648
|
-
globs:
|
|
10649
|
-
alwaysApply:
|
|
11380
|
+
var import_node_path90 = require("path");
|
|
11381
|
+
var import_mini47 = require("zod/mini");
|
|
11382
|
+
var CursorRuleFrontmatterSchema = import_mini47.z.object({
|
|
11383
|
+
description: import_mini47.z.optional(import_mini47.z.string()),
|
|
11384
|
+
globs: import_mini47.z.optional(import_mini47.z.string()),
|
|
11385
|
+
alwaysApply: import_mini47.z.optional(import_mini47.z.boolean())
|
|
10650
11386
|
});
|
|
10651
11387
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
10652
11388
|
frontmatter;
|
|
@@ -10654,7 +11390,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10654
11390
|
static getSettablePaths() {
|
|
10655
11391
|
return {
|
|
10656
11392
|
nonRoot: {
|
|
10657
|
-
relativeDirPath: (0,
|
|
11393
|
+
relativeDirPath: (0, import_node_path90.join)(".cursor", "rules")
|
|
10658
11394
|
}
|
|
10659
11395
|
};
|
|
10660
11396
|
}
|
|
@@ -10663,7 +11399,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10663
11399
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10664
11400
|
if (!result.success) {
|
|
10665
11401
|
throw new Error(
|
|
10666
|
-
`Invalid frontmatter in ${(0,
|
|
11402
|
+
`Invalid frontmatter in ${(0, import_node_path90.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10667
11403
|
);
|
|
10668
11404
|
}
|
|
10669
11405
|
}
|
|
@@ -10780,13 +11516,13 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10780
11516
|
validate = true
|
|
10781
11517
|
}) {
|
|
10782
11518
|
const fileContent = await readFileContent(
|
|
10783
|
-
(0,
|
|
11519
|
+
(0, import_node_path90.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10784
11520
|
);
|
|
10785
11521
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
10786
11522
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10787
11523
|
if (!result.success) {
|
|
10788
11524
|
throw new Error(
|
|
10789
|
-
`Invalid frontmatter in ${(0,
|
|
11525
|
+
`Invalid frontmatter in ${(0, import_node_path90.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10790
11526
|
);
|
|
10791
11527
|
}
|
|
10792
11528
|
return new _CursorRule({
|
|
@@ -10823,7 +11559,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10823
11559
|
return {
|
|
10824
11560
|
success: false,
|
|
10825
11561
|
error: new Error(
|
|
10826
|
-
`Invalid frontmatter in ${(0,
|
|
11562
|
+
`Invalid frontmatter in ${(0, import_node_path90.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10827
11563
|
)
|
|
10828
11564
|
};
|
|
10829
11565
|
}
|
|
@@ -10843,7 +11579,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10843
11579
|
};
|
|
10844
11580
|
|
|
10845
11581
|
// src/features/rules/geminicli-rule.ts
|
|
10846
|
-
var
|
|
11582
|
+
var import_node_path91 = require("path");
|
|
10847
11583
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
10848
11584
|
static getSettablePaths({
|
|
10849
11585
|
global
|
|
@@ -10862,7 +11598,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10862
11598
|
relativeFilePath: "GEMINI.md"
|
|
10863
11599
|
},
|
|
10864
11600
|
nonRoot: {
|
|
10865
|
-
relativeDirPath: (0,
|
|
11601
|
+
relativeDirPath: (0, import_node_path91.join)(".gemini", "memories")
|
|
10866
11602
|
}
|
|
10867
11603
|
};
|
|
10868
11604
|
}
|
|
@@ -10877,7 +11613,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10877
11613
|
if (isRoot) {
|
|
10878
11614
|
const relativePath2 = paths.root.relativeFilePath;
|
|
10879
11615
|
const fileContent2 = await readFileContent(
|
|
10880
|
-
(0,
|
|
11616
|
+
(0, import_node_path91.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
10881
11617
|
);
|
|
10882
11618
|
return new _GeminiCliRule({
|
|
10883
11619
|
baseDir,
|
|
@@ -10891,8 +11627,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10891
11627
|
if (!paths.nonRoot) {
|
|
10892
11628
|
throw new Error("nonRoot path is not set");
|
|
10893
11629
|
}
|
|
10894
|
-
const relativePath = (0,
|
|
10895
|
-
const fileContent = await readFileContent((0,
|
|
11630
|
+
const relativePath = (0, import_node_path91.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
11631
|
+
const fileContent = await readFileContent((0, import_node_path91.join)(baseDir, relativePath));
|
|
10896
11632
|
return new _GeminiCliRule({
|
|
10897
11633
|
baseDir,
|
|
10898
11634
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10951,7 +11687,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10951
11687
|
};
|
|
10952
11688
|
|
|
10953
11689
|
// src/features/rules/junie-rule.ts
|
|
10954
|
-
var
|
|
11690
|
+
var import_node_path92 = require("path");
|
|
10955
11691
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
10956
11692
|
static getSettablePaths() {
|
|
10957
11693
|
return {
|
|
@@ -10960,7 +11696,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10960
11696
|
relativeFilePath: "guidelines.md"
|
|
10961
11697
|
},
|
|
10962
11698
|
nonRoot: {
|
|
10963
|
-
relativeDirPath: (0,
|
|
11699
|
+
relativeDirPath: (0, import_node_path92.join)(".junie", "memories")
|
|
10964
11700
|
}
|
|
10965
11701
|
};
|
|
10966
11702
|
}
|
|
@@ -10970,8 +11706,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10970
11706
|
validate = true
|
|
10971
11707
|
}) {
|
|
10972
11708
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
10973
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
10974
|
-
const fileContent = await readFileContent((0,
|
|
11709
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path92.join)(".junie", "memories", relativeFilePath);
|
|
11710
|
+
const fileContent = await readFileContent((0, import_node_path92.join)(baseDir, relativePath));
|
|
10975
11711
|
return new _JunieRule({
|
|
10976
11712
|
baseDir,
|
|
10977
11713
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -11026,12 +11762,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
11026
11762
|
};
|
|
11027
11763
|
|
|
11028
11764
|
// src/features/rules/kilo-rule.ts
|
|
11029
|
-
var
|
|
11765
|
+
var import_node_path93 = require("path");
|
|
11030
11766
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
11031
11767
|
static getSettablePaths(_options = {}) {
|
|
11032
11768
|
return {
|
|
11033
11769
|
nonRoot: {
|
|
11034
|
-
relativeDirPath: (0,
|
|
11770
|
+
relativeDirPath: (0, import_node_path93.join)(".kilocode", "rules")
|
|
11035
11771
|
}
|
|
11036
11772
|
};
|
|
11037
11773
|
}
|
|
@@ -11041,7 +11777,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
11041
11777
|
validate = true
|
|
11042
11778
|
}) {
|
|
11043
11779
|
const fileContent = await readFileContent(
|
|
11044
|
-
(0,
|
|
11780
|
+
(0, import_node_path93.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
11045
11781
|
);
|
|
11046
11782
|
return new _KiloRule({
|
|
11047
11783
|
baseDir,
|
|
@@ -11093,12 +11829,12 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
11093
11829
|
};
|
|
11094
11830
|
|
|
11095
11831
|
// src/features/rules/kiro-rule.ts
|
|
11096
|
-
var
|
|
11832
|
+
var import_node_path94 = require("path");
|
|
11097
11833
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
11098
11834
|
static getSettablePaths() {
|
|
11099
11835
|
return {
|
|
11100
11836
|
nonRoot: {
|
|
11101
|
-
relativeDirPath: (0,
|
|
11837
|
+
relativeDirPath: (0, import_node_path94.join)(".kiro", "steering")
|
|
11102
11838
|
}
|
|
11103
11839
|
};
|
|
11104
11840
|
}
|
|
@@ -11108,7 +11844,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
11108
11844
|
validate = true
|
|
11109
11845
|
}) {
|
|
11110
11846
|
const fileContent = await readFileContent(
|
|
11111
|
-
(0,
|
|
11847
|
+
(0, import_node_path94.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
11112
11848
|
);
|
|
11113
11849
|
return new _KiroRule({
|
|
11114
11850
|
baseDir,
|
|
@@ -11162,7 +11898,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
11162
11898
|
};
|
|
11163
11899
|
|
|
11164
11900
|
// src/features/rules/opencode-rule.ts
|
|
11165
|
-
var
|
|
11901
|
+
var import_node_path95 = require("path");
|
|
11166
11902
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
11167
11903
|
static getSettablePaths() {
|
|
11168
11904
|
return {
|
|
@@ -11171,7 +11907,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
11171
11907
|
relativeFilePath: "AGENTS.md"
|
|
11172
11908
|
},
|
|
11173
11909
|
nonRoot: {
|
|
11174
|
-
relativeDirPath: (0,
|
|
11910
|
+
relativeDirPath: (0, import_node_path95.join)(".opencode", "memories")
|
|
11175
11911
|
}
|
|
11176
11912
|
};
|
|
11177
11913
|
}
|
|
@@ -11181,8 +11917,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
11181
11917
|
validate = true
|
|
11182
11918
|
}) {
|
|
11183
11919
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
11184
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
11185
|
-
const fileContent = await readFileContent((0,
|
|
11920
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path95.join)(".opencode", "memories", relativeFilePath);
|
|
11921
|
+
const fileContent = await readFileContent((0, import_node_path95.join)(baseDir, relativePath));
|
|
11186
11922
|
return new _OpenCodeRule({
|
|
11187
11923
|
baseDir,
|
|
11188
11924
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -11237,7 +11973,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
11237
11973
|
};
|
|
11238
11974
|
|
|
11239
11975
|
// src/features/rules/qwencode-rule.ts
|
|
11240
|
-
var
|
|
11976
|
+
var import_node_path96 = require("path");
|
|
11241
11977
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
11242
11978
|
static getSettablePaths() {
|
|
11243
11979
|
return {
|
|
@@ -11246,7 +11982,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
11246
11982
|
relativeFilePath: "QWEN.md"
|
|
11247
11983
|
},
|
|
11248
11984
|
nonRoot: {
|
|
11249
|
-
relativeDirPath: (0,
|
|
11985
|
+
relativeDirPath: (0, import_node_path96.join)(".qwen", "memories")
|
|
11250
11986
|
}
|
|
11251
11987
|
};
|
|
11252
11988
|
}
|
|
@@ -11256,8 +11992,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
11256
11992
|
validate = true
|
|
11257
11993
|
}) {
|
|
11258
11994
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
11259
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
11260
|
-
const fileContent = await readFileContent((0,
|
|
11995
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path96.join)(".qwen", "memories", relativeFilePath);
|
|
11996
|
+
const fileContent = await readFileContent((0, import_node_path96.join)(baseDir, relativePath));
|
|
11261
11997
|
return new _QwencodeRule({
|
|
11262
11998
|
baseDir,
|
|
11263
11999
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -11309,7 +12045,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
11309
12045
|
};
|
|
11310
12046
|
|
|
11311
12047
|
// src/features/rules/replit-rule.ts
|
|
11312
|
-
var
|
|
12048
|
+
var import_node_path97 = require("path");
|
|
11313
12049
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
11314
12050
|
static getSettablePaths() {
|
|
11315
12051
|
return {
|
|
@@ -11331,7 +12067,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
11331
12067
|
}
|
|
11332
12068
|
const relativePath = paths.root.relativeFilePath;
|
|
11333
12069
|
const fileContent = await readFileContent(
|
|
11334
|
-
(0,
|
|
12070
|
+
(0, import_node_path97.join)(baseDir, paths.root.relativeDirPath, relativePath)
|
|
11335
12071
|
);
|
|
11336
12072
|
return new _ReplitRule({
|
|
11337
12073
|
baseDir,
|
|
@@ -11397,12 +12133,12 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
11397
12133
|
};
|
|
11398
12134
|
|
|
11399
12135
|
// src/features/rules/roo-rule.ts
|
|
11400
|
-
var
|
|
12136
|
+
var import_node_path98 = require("path");
|
|
11401
12137
|
var RooRule = class _RooRule extends ToolRule {
|
|
11402
12138
|
static getSettablePaths() {
|
|
11403
12139
|
return {
|
|
11404
12140
|
nonRoot: {
|
|
11405
|
-
relativeDirPath: (0,
|
|
12141
|
+
relativeDirPath: (0, import_node_path98.join)(".roo", "rules")
|
|
11406
12142
|
}
|
|
11407
12143
|
};
|
|
11408
12144
|
}
|
|
@@ -11412,7 +12148,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
11412
12148
|
validate = true
|
|
11413
12149
|
}) {
|
|
11414
12150
|
const fileContent = await readFileContent(
|
|
11415
|
-
(0,
|
|
12151
|
+
(0, import_node_path98.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
11416
12152
|
);
|
|
11417
12153
|
return new _RooRule({
|
|
11418
12154
|
baseDir,
|
|
@@ -11481,7 +12217,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
11481
12217
|
};
|
|
11482
12218
|
|
|
11483
12219
|
// src/features/rules/warp-rule.ts
|
|
11484
|
-
var
|
|
12220
|
+
var import_node_path99 = require("path");
|
|
11485
12221
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
11486
12222
|
constructor({ fileContent, root, ...rest }) {
|
|
11487
12223
|
super({
|
|
@@ -11497,7 +12233,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11497
12233
|
relativeFilePath: "WARP.md"
|
|
11498
12234
|
},
|
|
11499
12235
|
nonRoot: {
|
|
11500
|
-
relativeDirPath: (0,
|
|
12236
|
+
relativeDirPath: (0, import_node_path99.join)(".warp", "memories")
|
|
11501
12237
|
}
|
|
11502
12238
|
};
|
|
11503
12239
|
}
|
|
@@ -11507,8 +12243,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11507
12243
|
validate = true
|
|
11508
12244
|
}) {
|
|
11509
12245
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
11510
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
11511
|
-
const fileContent = await readFileContent((0,
|
|
12246
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path99.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
12247
|
+
const fileContent = await readFileContent((0, import_node_path99.join)(baseDir, relativePath));
|
|
11512
12248
|
return new _WarpRule({
|
|
11513
12249
|
baseDir,
|
|
11514
12250
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -11563,12 +12299,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11563
12299
|
};
|
|
11564
12300
|
|
|
11565
12301
|
// src/features/rules/windsurf-rule.ts
|
|
11566
|
-
var
|
|
12302
|
+
var import_node_path100 = require("path");
|
|
11567
12303
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
11568
12304
|
static getSettablePaths() {
|
|
11569
12305
|
return {
|
|
11570
12306
|
nonRoot: {
|
|
11571
|
-
relativeDirPath: (0,
|
|
12307
|
+
relativeDirPath: (0, import_node_path100.join)(".windsurf", "rules")
|
|
11572
12308
|
}
|
|
11573
12309
|
};
|
|
11574
12310
|
}
|
|
@@ -11578,7 +12314,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
11578
12314
|
validate = true
|
|
11579
12315
|
}) {
|
|
11580
12316
|
const fileContent = await readFileContent(
|
|
11581
|
-
(0,
|
|
12317
|
+
(0, import_node_path100.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
11582
12318
|
);
|
|
11583
12319
|
return new _WindsurfRule({
|
|
11584
12320
|
baseDir,
|
|
@@ -11652,7 +12388,7 @@ var rulesProcessorToolTargets = [
|
|
|
11652
12388
|
"warp",
|
|
11653
12389
|
"windsurf"
|
|
11654
12390
|
];
|
|
11655
|
-
var RulesProcessorToolTargetSchema =
|
|
12391
|
+
var RulesProcessorToolTargetSchema = import_mini48.z.enum(rulesProcessorToolTargets);
|
|
11656
12392
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
11657
12393
|
[
|
|
11658
12394
|
"agentsmd",
|
|
@@ -11947,7 +12683,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11947
12683
|
}).relativeDirPath;
|
|
11948
12684
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
11949
12685
|
const frontmatter = skill.getFrontmatter();
|
|
11950
|
-
const relativePath = (0,
|
|
12686
|
+
const relativePath = (0, import_node_path101.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
11951
12687
|
return {
|
|
11952
12688
|
name: frontmatter.name,
|
|
11953
12689
|
description: frontmatter.description,
|
|
@@ -12058,12 +12794,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
12058
12794
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
12059
12795
|
*/
|
|
12060
12796
|
async loadRulesyncFiles() {
|
|
12061
|
-
const rulesyncBaseDir = (0,
|
|
12062
|
-
const files = await findFilesByGlobs((0,
|
|
12797
|
+
const rulesyncBaseDir = (0, import_node_path101.join)(this.baseDir, RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12798
|
+
const files = await findFilesByGlobs((0, import_node_path101.join)(rulesyncBaseDir, "**", "*.md"));
|
|
12063
12799
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
12064
12800
|
const rulesyncRules = await Promise.all(
|
|
12065
12801
|
files.map((file) => {
|
|
12066
|
-
const relativeFilePath = (0,
|
|
12802
|
+
const relativeFilePath = (0, import_node_path101.relative)(rulesyncBaseDir, file);
|
|
12067
12803
|
checkPathTraversal({ relativePath: relativeFilePath, intendedRootDir: rulesyncBaseDir });
|
|
12068
12804
|
return RulesyncRule.fromFile({
|
|
12069
12805
|
relativeFilePath
|
|
@@ -12117,7 +12853,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
12117
12853
|
return [];
|
|
12118
12854
|
}
|
|
12119
12855
|
const rootFilePaths = await findFilesByGlobs(
|
|
12120
|
-
(0,
|
|
12856
|
+
(0, import_node_path101.join)(
|
|
12121
12857
|
this.baseDir,
|
|
12122
12858
|
settablePaths.root.relativeDirPath ?? ".",
|
|
12123
12859
|
settablePaths.root.relativeFilePath
|
|
@@ -12128,7 +12864,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
12128
12864
|
(filePath) => factory.class.forDeletion({
|
|
12129
12865
|
baseDir: this.baseDir,
|
|
12130
12866
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
12131
|
-
relativeFilePath: (0,
|
|
12867
|
+
relativeFilePath: (0, import_node_path101.basename)(filePath),
|
|
12132
12868
|
global: this.global
|
|
12133
12869
|
})
|
|
12134
12870
|
).filter((rule) => rule.isDeletable());
|
|
@@ -12137,7 +12873,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
12137
12873
|
rootFilePaths.map(
|
|
12138
12874
|
(filePath) => factory.class.fromFile({
|
|
12139
12875
|
baseDir: this.baseDir,
|
|
12140
|
-
relativeFilePath: (0,
|
|
12876
|
+
relativeFilePath: (0, import_node_path101.basename)(filePath),
|
|
12141
12877
|
global: this.global
|
|
12142
12878
|
})
|
|
12143
12879
|
)
|
|
@@ -12155,13 +12891,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
12155
12891
|
return [];
|
|
12156
12892
|
}
|
|
12157
12893
|
const localRootFilePaths = await findFilesByGlobs(
|
|
12158
|
-
(0,
|
|
12894
|
+
(0, import_node_path101.join)(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md")
|
|
12159
12895
|
);
|
|
12160
12896
|
return localRootFilePaths.map(
|
|
12161
12897
|
(filePath) => factory.class.forDeletion({
|
|
12162
12898
|
baseDir: this.baseDir,
|
|
12163
12899
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
12164
|
-
relativeFilePath: (0,
|
|
12900
|
+
relativeFilePath: (0, import_node_path101.basename)(filePath),
|
|
12165
12901
|
global: this.global
|
|
12166
12902
|
})
|
|
12167
12903
|
).filter((rule) => rule.isDeletable());
|
|
@@ -12171,13 +12907,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
12171
12907
|
if (!settablePaths.nonRoot) {
|
|
12172
12908
|
return [];
|
|
12173
12909
|
}
|
|
12174
|
-
const nonRootBaseDir = (0,
|
|
12910
|
+
const nonRootBaseDir = (0, import_node_path101.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
12175
12911
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
12176
|
-
(0,
|
|
12912
|
+
(0, import_node_path101.join)(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
12177
12913
|
);
|
|
12178
12914
|
if (forDeletion) {
|
|
12179
12915
|
return nonRootFilePaths.map((filePath) => {
|
|
12180
|
-
const relativeFilePath = (0,
|
|
12916
|
+
const relativeFilePath = (0, import_node_path101.relative)(nonRootBaseDir, filePath);
|
|
12181
12917
|
checkPathTraversal({
|
|
12182
12918
|
relativePath: relativeFilePath,
|
|
12183
12919
|
intendedRootDir: nonRootBaseDir
|
|
@@ -12192,7 +12928,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
12192
12928
|
}
|
|
12193
12929
|
return await Promise.all(
|
|
12194
12930
|
nonRootFilePaths.map((filePath) => {
|
|
12195
|
-
const relativeFilePath = (0,
|
|
12931
|
+
const relativeFilePath = (0, import_node_path101.relative)(nonRootBaseDir, filePath);
|
|
12196
12932
|
checkPathTraversal({ relativePath: relativeFilePath, intendedRootDir: nonRootBaseDir });
|
|
12197
12933
|
return factory.class.fromFile({
|
|
12198
12934
|
baseDir: this.baseDir,
|
|
@@ -12289,14 +13025,14 @@ s/<command> [arguments]
|
|
|
12289
13025
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
12290
13026
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
12291
13027
|
|
|
12292
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
13028
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path101.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
12293
13029
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
12294
13030
|
|
|
12295
13031
|
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.
|
|
12296
13032
|
|
|
12297
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
13033
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path101.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
12298
13034
|
|
|
12299
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
13035
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path101.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
12300
13036
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
12301
13037
|
const result = [
|
|
12302
13038
|
overview,
|
|
@@ -12325,7 +13061,7 @@ ${toonContent}`;
|
|
|
12325
13061
|
|
|
12326
13062
|
// src/lib/generate.ts
|
|
12327
13063
|
async function checkRulesyncDirExists(params) {
|
|
12328
|
-
return fileExists((0,
|
|
13064
|
+
return fileExists((0, import_node_path102.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
12329
13065
|
}
|
|
12330
13066
|
async function generate(params) {
|
|
12331
13067
|
const { config } = params;
|
|
@@ -12334,6 +13070,7 @@ async function generate(params) {
|
|
|
12334
13070
|
const commandsCount = await generateCommandsCore({ config });
|
|
12335
13071
|
const subagentsCount = await generateSubagentsCore({ config });
|
|
12336
13072
|
const skillsResult = await generateSkillsCore({ config });
|
|
13073
|
+
const hooksCount = await generateHooksCore({ config });
|
|
12337
13074
|
const rulesCount = await generateRulesCore({ config, skills: skillsResult.skills });
|
|
12338
13075
|
return {
|
|
12339
13076
|
rulesCount,
|
|
@@ -12342,6 +13079,7 @@ async function generate(params) {
|
|
|
12342
13079
|
commandsCount,
|
|
12343
13080
|
subagentsCount,
|
|
12344
13081
|
skillsCount: skillsResult.count,
|
|
13082
|
+
hooksCount,
|
|
12345
13083
|
skills: skillsResult.skills
|
|
12346
13084
|
};
|
|
12347
13085
|
}
|
|
@@ -12546,6 +13284,38 @@ async function generateSkillsCore(params) {
|
|
|
12546
13284
|
}
|
|
12547
13285
|
return { count: totalCount, skills: allSkills };
|
|
12548
13286
|
}
|
|
13287
|
+
async function generateHooksCore(params) {
|
|
13288
|
+
const { config } = params;
|
|
13289
|
+
if (!config.getFeatures().includes("hooks")) {
|
|
13290
|
+
return 0;
|
|
13291
|
+
}
|
|
13292
|
+
let totalCount = 0;
|
|
13293
|
+
const toolTargets = (0, import_es_toolkit4.intersection)(
|
|
13294
|
+
config.getTargets(),
|
|
13295
|
+
HooksProcessor.getToolTargets({ global: config.getGlobal() })
|
|
13296
|
+
);
|
|
13297
|
+
for (const baseDir of config.getBaseDirs()) {
|
|
13298
|
+
for (const toolTarget of toolTargets) {
|
|
13299
|
+
const processor = new HooksProcessor({
|
|
13300
|
+
baseDir,
|
|
13301
|
+
toolTarget,
|
|
13302
|
+
global: config.getGlobal()
|
|
13303
|
+
});
|
|
13304
|
+
if (config.getDelete()) {
|
|
13305
|
+
const oldToolFiles = await processor.loadToolFiles({ forDeletion: true });
|
|
13306
|
+
await processor.removeAiFiles(oldToolFiles);
|
|
13307
|
+
}
|
|
13308
|
+
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
13309
|
+
if (rulesyncFiles.length === 0) {
|
|
13310
|
+
continue;
|
|
13311
|
+
}
|
|
13312
|
+
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
13313
|
+
const writtenCount = await processor.writeAiFiles(toolFiles);
|
|
13314
|
+
totalCount += writtenCount;
|
|
13315
|
+
}
|
|
13316
|
+
}
|
|
13317
|
+
return totalCount;
|
|
13318
|
+
}
|
|
12549
13319
|
|
|
12550
13320
|
// src/cli/commands/generate.ts
|
|
12551
13321
|
async function generateCommand(options) {
|
|
@@ -12579,6 +13349,9 @@ async function generateCommand(options) {
|
|
|
12579
13349
|
if (features.includes("skills")) {
|
|
12580
13350
|
logger.info("Generating skill files...");
|
|
12581
13351
|
}
|
|
13352
|
+
if (features.includes("hooks")) {
|
|
13353
|
+
logger.info("Generating hooks...");
|
|
13354
|
+
}
|
|
12582
13355
|
if (features.includes("rules")) {
|
|
12583
13356
|
logger.info("Generating rule files...");
|
|
12584
13357
|
}
|
|
@@ -12598,10 +13371,13 @@ async function generateCommand(options) {
|
|
|
12598
13371
|
if (result.skillsCount > 0) {
|
|
12599
13372
|
logger.success(`Generated ${result.skillsCount} skill(s)`);
|
|
12600
13373
|
}
|
|
13374
|
+
if (result.hooksCount > 0) {
|
|
13375
|
+
logger.success(`Generated ${result.hooksCount} hooks file(s)`);
|
|
13376
|
+
}
|
|
12601
13377
|
if (result.rulesCount > 0) {
|
|
12602
13378
|
logger.success(`Generated ${result.rulesCount} rule(s)`);
|
|
12603
13379
|
}
|
|
12604
|
-
const totalGenerated = result.rulesCount + result.ignoreCount + result.mcpCount + result.commandsCount + result.subagentsCount + result.skillsCount;
|
|
13380
|
+
const totalGenerated = result.rulesCount + result.ignoreCount + result.mcpCount + result.commandsCount + result.subagentsCount + result.skillsCount + result.hooksCount;
|
|
12605
13381
|
if (totalGenerated === 0) {
|
|
12606
13382
|
const enabledFeatures = features.join(", ");
|
|
12607
13383
|
logger.warn(`\u26A0\uFE0F No files generated for enabled features: ${enabledFeatures}`);
|
|
@@ -12614,11 +13390,12 @@ async function generateCommand(options) {
|
|
|
12614
13390
|
if (result.commandsCount > 0) parts.push(`${result.commandsCount} commands`);
|
|
12615
13391
|
if (result.subagentsCount > 0) parts.push(`${result.subagentsCount} subagents`);
|
|
12616
13392
|
if (result.skillsCount > 0) parts.push(`${result.skillsCount} skills`);
|
|
13393
|
+
if (result.hooksCount > 0) parts.push(`${result.hooksCount} hooks`);
|
|
12617
13394
|
logger.success(`\u{1F389} All done! Generated ${totalGenerated} file(s) total (${parts.join(" + ")})`);
|
|
12618
13395
|
}
|
|
12619
13396
|
|
|
12620
13397
|
// src/cli/commands/gitignore.ts
|
|
12621
|
-
var
|
|
13398
|
+
var import_node_path103 = require("path");
|
|
12622
13399
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
12623
13400
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
12624
13401
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -12763,7 +13540,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
12763
13540
|
return result;
|
|
12764
13541
|
};
|
|
12765
13542
|
var gitignoreCommand = async () => {
|
|
12766
|
-
const gitignorePath = (0,
|
|
13543
|
+
const gitignorePath = (0, import_node_path103.join)(process.cwd(), ".gitignore");
|
|
12767
13544
|
let gitignoreContent = "";
|
|
12768
13545
|
if (await fileExists(gitignorePath)) {
|
|
12769
13546
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -12786,30 +13563,28 @@ ${rulesyncBlock}
|
|
|
12786
13563
|
}
|
|
12787
13564
|
};
|
|
12788
13565
|
|
|
12789
|
-
// src/
|
|
12790
|
-
async function
|
|
12791
|
-
|
|
12792
|
-
|
|
12793
|
-
|
|
12794
|
-
}
|
|
12795
|
-
|
|
12796
|
-
|
|
12797
|
-
|
|
12798
|
-
}
|
|
12799
|
-
|
|
12800
|
-
|
|
12801
|
-
|
|
12802
|
-
|
|
12803
|
-
|
|
12804
|
-
|
|
12805
|
-
|
|
12806
|
-
|
|
12807
|
-
|
|
12808
|
-
await importCommands(config, tool);
|
|
12809
|
-
await importSubagents(config, tool);
|
|
12810
|
-
await importSkills(config, tool);
|
|
13566
|
+
// src/lib/import.ts
|
|
13567
|
+
async function importFromTool(params) {
|
|
13568
|
+
const { config, tool } = params;
|
|
13569
|
+
const rulesCount = await importRulesCore({ config, tool });
|
|
13570
|
+
const ignoreCount = await importIgnoreCore({ config, tool });
|
|
13571
|
+
const mcpCount = await importMcpCore({ config, tool });
|
|
13572
|
+
const commandsCount = await importCommandsCore({ config, tool });
|
|
13573
|
+
const subagentsCount = await importSubagentsCore({ config, tool });
|
|
13574
|
+
const skillsCount = await importSkillsCore({ config, tool });
|
|
13575
|
+
const hooksCount = await importHooksCore({ config, tool });
|
|
13576
|
+
return {
|
|
13577
|
+
rulesCount,
|
|
13578
|
+
ignoreCount,
|
|
13579
|
+
mcpCount,
|
|
13580
|
+
commandsCount,
|
|
13581
|
+
subagentsCount,
|
|
13582
|
+
skillsCount,
|
|
13583
|
+
hooksCount
|
|
13584
|
+
};
|
|
12811
13585
|
}
|
|
12812
|
-
async function
|
|
13586
|
+
async function importRulesCore(params) {
|
|
13587
|
+
const { config, tool } = params;
|
|
12813
13588
|
if (!config.getFeatures().includes("rules")) {
|
|
12814
13589
|
return 0;
|
|
12815
13590
|
}
|
|
@@ -12834,7 +13609,8 @@ async function importRules(config, tool) {
|
|
|
12834
13609
|
}
|
|
12835
13610
|
return writtenCount;
|
|
12836
13611
|
}
|
|
12837
|
-
async function
|
|
13612
|
+
async function importIgnoreCore(params) {
|
|
13613
|
+
const { config, tool } = params;
|
|
12838
13614
|
if (!config.getFeatures().includes("ignore")) {
|
|
12839
13615
|
return 0;
|
|
12840
13616
|
}
|
|
@@ -12863,7 +13639,8 @@ async function importIgnore(config, tool) {
|
|
|
12863
13639
|
}
|
|
12864
13640
|
return writtenCount;
|
|
12865
13641
|
}
|
|
12866
|
-
async function
|
|
13642
|
+
async function importMcpCore(params) {
|
|
13643
|
+
const { config, tool } = params;
|
|
12867
13644
|
if (!config.getFeatures().includes("mcp")) {
|
|
12868
13645
|
return 0;
|
|
12869
13646
|
}
|
|
@@ -12888,7 +13665,8 @@ async function importMcp(config, tool) {
|
|
|
12888
13665
|
}
|
|
12889
13666
|
return writtenCount;
|
|
12890
13667
|
}
|
|
12891
|
-
async function
|
|
13668
|
+
async function importCommandsCore(params) {
|
|
13669
|
+
const { config, tool } = params;
|
|
12892
13670
|
if (!config.getFeatures().includes("commands")) {
|
|
12893
13671
|
return 0;
|
|
12894
13672
|
}
|
|
@@ -12913,7 +13691,8 @@ async function importCommands(config, tool) {
|
|
|
12913
13691
|
}
|
|
12914
13692
|
return writtenCount;
|
|
12915
13693
|
}
|
|
12916
|
-
async function
|
|
13694
|
+
async function importSubagentsCore(params) {
|
|
13695
|
+
const { config, tool } = params;
|
|
12917
13696
|
if (!config.getFeatures().includes("subagents")) {
|
|
12918
13697
|
return 0;
|
|
12919
13698
|
}
|
|
@@ -12938,7 +13717,8 @@ async function importSubagents(config, tool) {
|
|
|
12938
13717
|
}
|
|
12939
13718
|
return writtenCount;
|
|
12940
13719
|
}
|
|
12941
|
-
async function
|
|
13720
|
+
async function importSkillsCore(params) {
|
|
13721
|
+
const { config, tool } = params;
|
|
12942
13722
|
if (!config.getFeatures().includes("skills")) {
|
|
12943
13723
|
return 0;
|
|
12944
13724
|
}
|
|
@@ -12963,9 +13743,70 @@ async function importSkills(config, tool) {
|
|
|
12963
13743
|
}
|
|
12964
13744
|
return writtenCount;
|
|
12965
13745
|
}
|
|
13746
|
+
async function importHooksCore(params) {
|
|
13747
|
+
const { config, tool } = params;
|
|
13748
|
+
if (!config.getFeatures().includes("hooks")) {
|
|
13749
|
+
return 0;
|
|
13750
|
+
}
|
|
13751
|
+
const global = config.getGlobal();
|
|
13752
|
+
const supportedTargets = HooksProcessor.getToolTargets({ global });
|
|
13753
|
+
if (!supportedTargets.includes(tool)) {
|
|
13754
|
+
return 0;
|
|
13755
|
+
}
|
|
13756
|
+
const hooksProcessor = new HooksProcessor({
|
|
13757
|
+
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
13758
|
+
toolTarget: tool,
|
|
13759
|
+
global
|
|
13760
|
+
});
|
|
13761
|
+
const toolFiles = await hooksProcessor.loadToolFiles();
|
|
13762
|
+
if (toolFiles.length === 0) {
|
|
13763
|
+
return 0;
|
|
13764
|
+
}
|
|
13765
|
+
const rulesyncFiles = await hooksProcessor.convertToolFilesToRulesyncFiles(toolFiles);
|
|
13766
|
+
const writtenCount = await hooksProcessor.writeAiFiles(rulesyncFiles);
|
|
13767
|
+
if (config.getVerbose() && writtenCount > 0) {
|
|
13768
|
+
logger.success(`Created ${writtenCount} hooks file(s)`);
|
|
13769
|
+
}
|
|
13770
|
+
return writtenCount;
|
|
13771
|
+
}
|
|
13772
|
+
|
|
13773
|
+
// src/cli/commands/import.ts
|
|
13774
|
+
async function importCommand(options) {
|
|
13775
|
+
if (!options.targets) {
|
|
13776
|
+
logger.error("No tools found in --targets");
|
|
13777
|
+
process.exit(1);
|
|
13778
|
+
}
|
|
13779
|
+
if (options.targets.length > 1) {
|
|
13780
|
+
logger.error("Only one tool can be imported at a time");
|
|
13781
|
+
process.exit(1);
|
|
13782
|
+
}
|
|
13783
|
+
const config = await ConfigResolver.resolve(options);
|
|
13784
|
+
logger.configure({
|
|
13785
|
+
verbose: config.getVerbose(),
|
|
13786
|
+
silent: config.getSilent()
|
|
13787
|
+
});
|
|
13788
|
+
const tool = config.getTargets()[0];
|
|
13789
|
+
logger.info(`Importing files from ${tool}...`);
|
|
13790
|
+
const result = await importFromTool({ config, tool });
|
|
13791
|
+
const totalImported = result.rulesCount + result.ignoreCount + result.mcpCount + result.commandsCount + result.subagentsCount + result.skillsCount + result.hooksCount;
|
|
13792
|
+
if (totalImported === 0) {
|
|
13793
|
+
const enabledFeatures = config.getFeatures().join(", ");
|
|
13794
|
+
logger.warn(`No files imported for enabled features: ${enabledFeatures}`);
|
|
13795
|
+
return;
|
|
13796
|
+
}
|
|
13797
|
+
const parts = [];
|
|
13798
|
+
if (result.rulesCount > 0) parts.push(`${result.rulesCount} rules`);
|
|
13799
|
+
if (result.ignoreCount > 0) parts.push(`${result.ignoreCount} ignore files`);
|
|
13800
|
+
if (result.mcpCount > 0) parts.push(`${result.mcpCount} MCP files`);
|
|
13801
|
+
if (result.commandsCount > 0) parts.push(`${result.commandsCount} commands`);
|
|
13802
|
+
if (result.subagentsCount > 0) parts.push(`${result.subagentsCount} subagents`);
|
|
13803
|
+
if (result.skillsCount > 0) parts.push(`${result.skillsCount} skills`);
|
|
13804
|
+
if (result.hooksCount > 0) parts.push(`${result.hooksCount} hooks`);
|
|
13805
|
+
logger.success(`Imported ${totalImported} file(s) total (${parts.join(" + ")})`);
|
|
13806
|
+
}
|
|
12966
13807
|
|
|
12967
13808
|
// src/cli/commands/init.ts
|
|
12968
|
-
var
|
|
13809
|
+
var import_node_path104 = require("path");
|
|
12969
13810
|
async function initCommand() {
|
|
12970
13811
|
logger.info("Initializing rulesync...");
|
|
12971
13812
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -13144,14 +13985,14 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
13144
13985
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
13145
13986
|
await ensureDir(skillPaths.relativeDirPath);
|
|
13146
13987
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
13147
|
-
const ruleFilepath = (0,
|
|
13988
|
+
const ruleFilepath = (0, import_node_path104.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
13148
13989
|
if (!await fileExists(ruleFilepath)) {
|
|
13149
13990
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
13150
13991
|
logger.success(`Created ${ruleFilepath}`);
|
|
13151
13992
|
} else {
|
|
13152
13993
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
13153
13994
|
}
|
|
13154
|
-
const mcpFilepath = (0,
|
|
13995
|
+
const mcpFilepath = (0, import_node_path104.join)(
|
|
13155
13996
|
mcpPaths.recommended.relativeDirPath,
|
|
13156
13997
|
mcpPaths.recommended.relativeFilePath
|
|
13157
13998
|
);
|
|
@@ -13161,30 +14002,30 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
13161
14002
|
} else {
|
|
13162
14003
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
13163
14004
|
}
|
|
13164
|
-
const commandFilepath = (0,
|
|
14005
|
+
const commandFilepath = (0, import_node_path104.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
13165
14006
|
if (!await fileExists(commandFilepath)) {
|
|
13166
14007
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
13167
14008
|
logger.success(`Created ${commandFilepath}`);
|
|
13168
14009
|
} else {
|
|
13169
14010
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
13170
14011
|
}
|
|
13171
|
-
const subagentFilepath = (0,
|
|
14012
|
+
const subagentFilepath = (0, import_node_path104.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
13172
14013
|
if (!await fileExists(subagentFilepath)) {
|
|
13173
14014
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
13174
14015
|
logger.success(`Created ${subagentFilepath}`);
|
|
13175
14016
|
} else {
|
|
13176
14017
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
13177
14018
|
}
|
|
13178
|
-
const skillDirPath = (0,
|
|
14019
|
+
const skillDirPath = (0, import_node_path104.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
13179
14020
|
await ensureDir(skillDirPath);
|
|
13180
|
-
const skillFilepath = (0,
|
|
14021
|
+
const skillFilepath = (0, import_node_path104.join)(skillDirPath, SKILL_FILE_NAME);
|
|
13181
14022
|
if (!await fileExists(skillFilepath)) {
|
|
13182
14023
|
await writeFileContent(skillFilepath, sampleSkillFile.content);
|
|
13183
14024
|
logger.success(`Created ${skillFilepath}`);
|
|
13184
14025
|
} else {
|
|
13185
14026
|
logger.info(`Skipped ${skillFilepath} (already exists)`);
|
|
13186
14027
|
}
|
|
13187
|
-
const ignoreFilepath = (0,
|
|
14028
|
+
const ignoreFilepath = (0, import_node_path104.join)(
|
|
13188
14029
|
ignorePaths.recommended.relativeDirPath,
|
|
13189
14030
|
ignorePaths.recommended.relativeFilePath
|
|
13190
14031
|
);
|
|
@@ -13200,15 +14041,15 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
13200
14041
|
var import_fastmcp = require("fastmcp");
|
|
13201
14042
|
|
|
13202
14043
|
// src/mcp/tools.ts
|
|
13203
|
-
var
|
|
14044
|
+
var import_mini55 = require("zod/mini");
|
|
13204
14045
|
|
|
13205
14046
|
// src/mcp/commands.ts
|
|
13206
|
-
var
|
|
13207
|
-
var
|
|
14047
|
+
var import_node_path105 = require("path");
|
|
14048
|
+
var import_mini49 = require("zod/mini");
|
|
13208
14049
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
13209
14050
|
var maxCommandsCount = 1e3;
|
|
13210
14051
|
async function listCommands() {
|
|
13211
|
-
const commandsDir = (0,
|
|
14052
|
+
const commandsDir = (0, import_node_path105.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
13212
14053
|
try {
|
|
13213
14054
|
const files = await listDirectoryFiles(commandsDir);
|
|
13214
14055
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -13220,7 +14061,7 @@ async function listCommands() {
|
|
|
13220
14061
|
});
|
|
13221
14062
|
const frontmatter = command.getFrontmatter();
|
|
13222
14063
|
return {
|
|
13223
|
-
relativePathFromCwd: (0,
|
|
14064
|
+
relativePathFromCwd: (0, import_node_path105.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
13224
14065
|
frontmatter
|
|
13225
14066
|
};
|
|
13226
14067
|
} catch (error) {
|
|
@@ -13240,13 +14081,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
13240
14081
|
relativePath: relativePathFromCwd,
|
|
13241
14082
|
intendedRootDir: process.cwd()
|
|
13242
14083
|
});
|
|
13243
|
-
const filename = (0,
|
|
14084
|
+
const filename = (0, import_node_path105.basename)(relativePathFromCwd);
|
|
13244
14085
|
try {
|
|
13245
14086
|
const command = await RulesyncCommand.fromFile({
|
|
13246
14087
|
relativeFilePath: filename
|
|
13247
14088
|
});
|
|
13248
14089
|
return {
|
|
13249
|
-
relativePathFromCwd: (0,
|
|
14090
|
+
relativePathFromCwd: (0, import_node_path105.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
13250
14091
|
frontmatter: command.getFrontmatter(),
|
|
13251
14092
|
body: command.getBody()
|
|
13252
14093
|
};
|
|
@@ -13265,7 +14106,7 @@ async function putCommand({
|
|
|
13265
14106
|
relativePath: relativePathFromCwd,
|
|
13266
14107
|
intendedRootDir: process.cwd()
|
|
13267
14108
|
});
|
|
13268
|
-
const filename = (0,
|
|
14109
|
+
const filename = (0, import_node_path105.basename)(relativePathFromCwd);
|
|
13269
14110
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
13270
14111
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
13271
14112
|
throw new Error(
|
|
@@ -13275,7 +14116,7 @@ async function putCommand({
|
|
|
13275
14116
|
try {
|
|
13276
14117
|
const existingCommands = await listCommands();
|
|
13277
14118
|
const isUpdate = existingCommands.some(
|
|
13278
|
-
(command2) => command2.relativePathFromCwd === (0,
|
|
14119
|
+
(command2) => command2.relativePathFromCwd === (0, import_node_path105.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
13279
14120
|
);
|
|
13280
14121
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
13281
14122
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -13290,11 +14131,11 @@ async function putCommand({
|
|
|
13290
14131
|
fileContent,
|
|
13291
14132
|
validate: true
|
|
13292
14133
|
});
|
|
13293
|
-
const commandsDir = (0,
|
|
14134
|
+
const commandsDir = (0, import_node_path105.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
13294
14135
|
await ensureDir(commandsDir);
|
|
13295
14136
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
13296
14137
|
return {
|
|
13297
|
-
relativePathFromCwd: (0,
|
|
14138
|
+
relativePathFromCwd: (0, import_node_path105.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
13298
14139
|
frontmatter: command.getFrontmatter(),
|
|
13299
14140
|
body: command.getBody()
|
|
13300
14141
|
};
|
|
@@ -13309,12 +14150,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
13309
14150
|
relativePath: relativePathFromCwd,
|
|
13310
14151
|
intendedRootDir: process.cwd()
|
|
13311
14152
|
});
|
|
13312
|
-
const filename = (0,
|
|
13313
|
-
const fullPath = (0,
|
|
14153
|
+
const filename = (0, import_node_path105.basename)(relativePathFromCwd);
|
|
14154
|
+
const fullPath = (0, import_node_path105.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
13314
14155
|
try {
|
|
13315
14156
|
await removeFile(fullPath);
|
|
13316
14157
|
return {
|
|
13317
|
-
relativePathFromCwd: (0,
|
|
14158
|
+
relativePathFromCwd: (0, import_node_path105.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
13318
14159
|
};
|
|
13319
14160
|
} catch (error) {
|
|
13320
14161
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -13323,23 +14164,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
13323
14164
|
}
|
|
13324
14165
|
}
|
|
13325
14166
|
var commandToolSchemas = {
|
|
13326
|
-
listCommands:
|
|
13327
|
-
getCommand:
|
|
13328
|
-
relativePathFromCwd:
|
|
14167
|
+
listCommands: import_mini49.z.object({}),
|
|
14168
|
+
getCommand: import_mini49.z.object({
|
|
14169
|
+
relativePathFromCwd: import_mini49.z.string()
|
|
13329
14170
|
}),
|
|
13330
|
-
putCommand:
|
|
13331
|
-
relativePathFromCwd:
|
|
14171
|
+
putCommand: import_mini49.z.object({
|
|
14172
|
+
relativePathFromCwd: import_mini49.z.string(),
|
|
13332
14173
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
13333
|
-
body:
|
|
14174
|
+
body: import_mini49.z.string()
|
|
13334
14175
|
}),
|
|
13335
|
-
deleteCommand:
|
|
13336
|
-
relativePathFromCwd:
|
|
14176
|
+
deleteCommand: import_mini49.z.object({
|
|
14177
|
+
relativePathFromCwd: import_mini49.z.string()
|
|
13337
14178
|
})
|
|
13338
14179
|
};
|
|
13339
14180
|
var commandTools = {
|
|
13340
14181
|
listCommands: {
|
|
13341
14182
|
name: "listCommands",
|
|
13342
|
-
description: `List all commands from ${(0,
|
|
14183
|
+
description: `List all commands from ${(0, import_node_path105.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13343
14184
|
parameters: commandToolSchemas.listCommands,
|
|
13344
14185
|
execute: async () => {
|
|
13345
14186
|
const commands = await listCommands();
|
|
@@ -13381,11 +14222,11 @@ var commandTools = {
|
|
|
13381
14222
|
};
|
|
13382
14223
|
|
|
13383
14224
|
// src/mcp/ignore.ts
|
|
13384
|
-
var
|
|
13385
|
-
var
|
|
14225
|
+
var import_node_path106 = require("path");
|
|
14226
|
+
var import_mini50 = require("zod/mini");
|
|
13386
14227
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
13387
14228
|
async function getIgnoreFile() {
|
|
13388
|
-
const ignoreFilePath = (0,
|
|
14229
|
+
const ignoreFilePath = (0, import_node_path106.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
13389
14230
|
try {
|
|
13390
14231
|
const content = await readFileContent(ignoreFilePath);
|
|
13391
14232
|
return {
|
|
@@ -13399,7 +14240,7 @@ async function getIgnoreFile() {
|
|
|
13399
14240
|
}
|
|
13400
14241
|
}
|
|
13401
14242
|
async function putIgnoreFile({ content }) {
|
|
13402
|
-
const ignoreFilePath = (0,
|
|
14243
|
+
const ignoreFilePath = (0, import_node_path106.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
13403
14244
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
13404
14245
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
13405
14246
|
throw new Error(
|
|
@@ -13420,8 +14261,8 @@ async function putIgnoreFile({ content }) {
|
|
|
13420
14261
|
}
|
|
13421
14262
|
}
|
|
13422
14263
|
async function deleteIgnoreFile() {
|
|
13423
|
-
const aiignorePath = (0,
|
|
13424
|
-
const legacyIgnorePath = (0,
|
|
14264
|
+
const aiignorePath = (0, import_node_path106.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
14265
|
+
const legacyIgnorePath = (0, import_node_path106.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
13425
14266
|
try {
|
|
13426
14267
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
13427
14268
|
return {
|
|
@@ -13439,11 +14280,11 @@ async function deleteIgnoreFile() {
|
|
|
13439
14280
|
}
|
|
13440
14281
|
}
|
|
13441
14282
|
var ignoreToolSchemas = {
|
|
13442
|
-
getIgnoreFile:
|
|
13443
|
-
putIgnoreFile:
|
|
13444
|
-
content:
|
|
14283
|
+
getIgnoreFile: import_mini50.z.object({}),
|
|
14284
|
+
putIgnoreFile: import_mini50.z.object({
|
|
14285
|
+
content: import_mini50.z.string()
|
|
13445
14286
|
}),
|
|
13446
|
-
deleteIgnoreFile:
|
|
14287
|
+
deleteIgnoreFile: import_mini50.z.object({})
|
|
13447
14288
|
};
|
|
13448
14289
|
var ignoreTools = {
|
|
13449
14290
|
getIgnoreFile: {
|
|
@@ -13476,8 +14317,8 @@ var ignoreTools = {
|
|
|
13476
14317
|
};
|
|
13477
14318
|
|
|
13478
14319
|
// src/mcp/mcp.ts
|
|
13479
|
-
var
|
|
13480
|
-
var
|
|
14320
|
+
var import_node_path107 = require("path");
|
|
14321
|
+
var import_mini51 = require("zod/mini");
|
|
13481
14322
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
13482
14323
|
async function getMcpFile() {
|
|
13483
14324
|
const config = await ConfigResolver.resolve({});
|
|
@@ -13486,7 +14327,7 @@ async function getMcpFile() {
|
|
|
13486
14327
|
validate: true,
|
|
13487
14328
|
modularMcp: config.getModularMcp()
|
|
13488
14329
|
});
|
|
13489
|
-
const relativePathFromCwd = (0,
|
|
14330
|
+
const relativePathFromCwd = (0, import_node_path107.join)(
|
|
13490
14331
|
rulesyncMcp.getRelativeDirPath(),
|
|
13491
14332
|
rulesyncMcp.getRelativeFilePath()
|
|
13492
14333
|
);
|
|
@@ -13519,7 +14360,7 @@ async function putMcpFile({ content }) {
|
|
|
13519
14360
|
const paths = RulesyncMcp.getSettablePaths();
|
|
13520
14361
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
13521
14362
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
13522
|
-
const fullPath = (0,
|
|
14363
|
+
const fullPath = (0, import_node_path107.join)(baseDir, relativeDirPath, relativeFilePath);
|
|
13523
14364
|
const rulesyncMcp = new RulesyncMcp({
|
|
13524
14365
|
baseDir,
|
|
13525
14366
|
relativeDirPath,
|
|
@@ -13528,9 +14369,9 @@ async function putMcpFile({ content }) {
|
|
|
13528
14369
|
validate: true,
|
|
13529
14370
|
modularMcp: config.getModularMcp()
|
|
13530
14371
|
});
|
|
13531
|
-
await ensureDir((0,
|
|
14372
|
+
await ensureDir((0, import_node_path107.join)(baseDir, relativeDirPath));
|
|
13532
14373
|
await writeFileContent(fullPath, content);
|
|
13533
|
-
const relativePathFromCwd = (0,
|
|
14374
|
+
const relativePathFromCwd = (0, import_node_path107.join)(relativeDirPath, relativeFilePath);
|
|
13534
14375
|
return {
|
|
13535
14376
|
relativePathFromCwd,
|
|
13536
14377
|
content: rulesyncMcp.getFileContent()
|
|
@@ -13545,15 +14386,15 @@ async function deleteMcpFile() {
|
|
|
13545
14386
|
try {
|
|
13546
14387
|
const baseDir = process.cwd();
|
|
13547
14388
|
const paths = RulesyncMcp.getSettablePaths();
|
|
13548
|
-
const recommendedPath = (0,
|
|
14389
|
+
const recommendedPath = (0, import_node_path107.join)(
|
|
13549
14390
|
baseDir,
|
|
13550
14391
|
paths.recommended.relativeDirPath,
|
|
13551
14392
|
paths.recommended.relativeFilePath
|
|
13552
14393
|
);
|
|
13553
|
-
const legacyPath = (0,
|
|
14394
|
+
const legacyPath = (0, import_node_path107.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
13554
14395
|
await removeFile(recommendedPath);
|
|
13555
14396
|
await removeFile(legacyPath);
|
|
13556
|
-
const relativePathFromCwd = (0,
|
|
14397
|
+
const relativePathFromCwd = (0, import_node_path107.join)(
|
|
13557
14398
|
paths.recommended.relativeDirPath,
|
|
13558
14399
|
paths.recommended.relativeFilePath
|
|
13559
14400
|
);
|
|
@@ -13567,11 +14408,11 @@ async function deleteMcpFile() {
|
|
|
13567
14408
|
}
|
|
13568
14409
|
}
|
|
13569
14410
|
var mcpToolSchemas = {
|
|
13570
|
-
getMcpFile:
|
|
13571
|
-
putMcpFile:
|
|
13572
|
-
content:
|
|
14411
|
+
getMcpFile: import_mini51.z.object({}),
|
|
14412
|
+
putMcpFile: import_mini51.z.object({
|
|
14413
|
+
content: import_mini51.z.string()
|
|
13573
14414
|
}),
|
|
13574
|
-
deleteMcpFile:
|
|
14415
|
+
deleteMcpFile: import_mini51.z.object({})
|
|
13575
14416
|
};
|
|
13576
14417
|
var mcpTools = {
|
|
13577
14418
|
getMcpFile: {
|
|
@@ -13604,12 +14445,12 @@ var mcpTools = {
|
|
|
13604
14445
|
};
|
|
13605
14446
|
|
|
13606
14447
|
// src/mcp/rules.ts
|
|
13607
|
-
var
|
|
13608
|
-
var
|
|
14448
|
+
var import_node_path108 = require("path");
|
|
14449
|
+
var import_mini52 = require("zod/mini");
|
|
13609
14450
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
13610
14451
|
var maxRulesCount = 1e3;
|
|
13611
14452
|
async function listRules() {
|
|
13612
|
-
const rulesDir = (0,
|
|
14453
|
+
const rulesDir = (0, import_node_path108.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
13613
14454
|
try {
|
|
13614
14455
|
const files = await listDirectoryFiles(rulesDir);
|
|
13615
14456
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -13622,7 +14463,7 @@ async function listRules() {
|
|
|
13622
14463
|
});
|
|
13623
14464
|
const frontmatter = rule.getFrontmatter();
|
|
13624
14465
|
return {
|
|
13625
|
-
relativePathFromCwd: (0,
|
|
14466
|
+
relativePathFromCwd: (0, import_node_path108.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
13626
14467
|
frontmatter
|
|
13627
14468
|
};
|
|
13628
14469
|
} catch (error) {
|
|
@@ -13642,14 +14483,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
13642
14483
|
relativePath: relativePathFromCwd,
|
|
13643
14484
|
intendedRootDir: process.cwd()
|
|
13644
14485
|
});
|
|
13645
|
-
const filename = (0,
|
|
14486
|
+
const filename = (0, import_node_path108.basename)(relativePathFromCwd);
|
|
13646
14487
|
try {
|
|
13647
14488
|
const rule = await RulesyncRule.fromFile({
|
|
13648
14489
|
relativeFilePath: filename,
|
|
13649
14490
|
validate: true
|
|
13650
14491
|
});
|
|
13651
14492
|
return {
|
|
13652
|
-
relativePathFromCwd: (0,
|
|
14493
|
+
relativePathFromCwd: (0, import_node_path108.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
13653
14494
|
frontmatter: rule.getFrontmatter(),
|
|
13654
14495
|
body: rule.getBody()
|
|
13655
14496
|
};
|
|
@@ -13668,7 +14509,7 @@ async function putRule({
|
|
|
13668
14509
|
relativePath: relativePathFromCwd,
|
|
13669
14510
|
intendedRootDir: process.cwd()
|
|
13670
14511
|
});
|
|
13671
|
-
const filename = (0,
|
|
14512
|
+
const filename = (0, import_node_path108.basename)(relativePathFromCwd);
|
|
13672
14513
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
13673
14514
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
13674
14515
|
throw new Error(
|
|
@@ -13678,7 +14519,7 @@ async function putRule({
|
|
|
13678
14519
|
try {
|
|
13679
14520
|
const existingRules = await listRules();
|
|
13680
14521
|
const isUpdate = existingRules.some(
|
|
13681
|
-
(rule2) => rule2.relativePathFromCwd === (0,
|
|
14522
|
+
(rule2) => rule2.relativePathFromCwd === (0, import_node_path108.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
13682
14523
|
);
|
|
13683
14524
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
13684
14525
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -13691,11 +14532,11 @@ async function putRule({
|
|
|
13691
14532
|
body,
|
|
13692
14533
|
validate: true
|
|
13693
14534
|
});
|
|
13694
|
-
const rulesDir = (0,
|
|
14535
|
+
const rulesDir = (0, import_node_path108.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
13695
14536
|
await ensureDir(rulesDir);
|
|
13696
14537
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
13697
14538
|
return {
|
|
13698
|
-
relativePathFromCwd: (0,
|
|
14539
|
+
relativePathFromCwd: (0, import_node_path108.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
13699
14540
|
frontmatter: rule.getFrontmatter(),
|
|
13700
14541
|
body: rule.getBody()
|
|
13701
14542
|
};
|
|
@@ -13710,12 +14551,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
13710
14551
|
relativePath: relativePathFromCwd,
|
|
13711
14552
|
intendedRootDir: process.cwd()
|
|
13712
14553
|
});
|
|
13713
|
-
const filename = (0,
|
|
13714
|
-
const fullPath = (0,
|
|
14554
|
+
const filename = (0, import_node_path108.basename)(relativePathFromCwd);
|
|
14555
|
+
const fullPath = (0, import_node_path108.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
13715
14556
|
try {
|
|
13716
14557
|
await removeFile(fullPath);
|
|
13717
14558
|
return {
|
|
13718
|
-
relativePathFromCwd: (0,
|
|
14559
|
+
relativePathFromCwd: (0, import_node_path108.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
13719
14560
|
};
|
|
13720
14561
|
} catch (error) {
|
|
13721
14562
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -13724,23 +14565,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
13724
14565
|
}
|
|
13725
14566
|
}
|
|
13726
14567
|
var ruleToolSchemas = {
|
|
13727
|
-
listRules:
|
|
13728
|
-
getRule:
|
|
13729
|
-
relativePathFromCwd:
|
|
14568
|
+
listRules: import_mini52.z.object({}),
|
|
14569
|
+
getRule: import_mini52.z.object({
|
|
14570
|
+
relativePathFromCwd: import_mini52.z.string()
|
|
13730
14571
|
}),
|
|
13731
|
-
putRule:
|
|
13732
|
-
relativePathFromCwd:
|
|
14572
|
+
putRule: import_mini52.z.object({
|
|
14573
|
+
relativePathFromCwd: import_mini52.z.string(),
|
|
13733
14574
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
13734
|
-
body:
|
|
14575
|
+
body: import_mini52.z.string()
|
|
13735
14576
|
}),
|
|
13736
|
-
deleteRule:
|
|
13737
|
-
relativePathFromCwd:
|
|
14577
|
+
deleteRule: import_mini52.z.object({
|
|
14578
|
+
relativePathFromCwd: import_mini52.z.string()
|
|
13738
14579
|
})
|
|
13739
14580
|
};
|
|
13740
14581
|
var ruleTools = {
|
|
13741
14582
|
listRules: {
|
|
13742
14583
|
name: "listRules",
|
|
13743
|
-
description: `List all rules from ${(0,
|
|
14584
|
+
description: `List all rules from ${(0, import_node_path108.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13744
14585
|
parameters: ruleToolSchemas.listRules,
|
|
13745
14586
|
execute: async () => {
|
|
13746
14587
|
const rules = await listRules();
|
|
@@ -13782,8 +14623,8 @@ var ruleTools = {
|
|
|
13782
14623
|
};
|
|
13783
14624
|
|
|
13784
14625
|
// src/mcp/skills.ts
|
|
13785
|
-
var
|
|
13786
|
-
var
|
|
14626
|
+
var import_node_path109 = require("path");
|
|
14627
|
+
var import_mini53 = require("zod/mini");
|
|
13787
14628
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
13788
14629
|
var maxSkillsCount = 1e3;
|
|
13789
14630
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -13799,19 +14640,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
13799
14640
|
};
|
|
13800
14641
|
}
|
|
13801
14642
|
function extractDirName(relativeDirPathFromCwd) {
|
|
13802
|
-
const dirName = (0,
|
|
14643
|
+
const dirName = (0, import_node_path109.basename)(relativeDirPathFromCwd);
|
|
13803
14644
|
if (!dirName) {
|
|
13804
14645
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
13805
14646
|
}
|
|
13806
14647
|
return dirName;
|
|
13807
14648
|
}
|
|
13808
14649
|
async function listSkills() {
|
|
13809
|
-
const skillsDir = (0,
|
|
14650
|
+
const skillsDir = (0, import_node_path109.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
13810
14651
|
try {
|
|
13811
|
-
const skillDirPaths = await findFilesByGlobs((0,
|
|
14652
|
+
const skillDirPaths = await findFilesByGlobs((0, import_node_path109.join)(skillsDir, "*"), { type: "dir" });
|
|
13812
14653
|
const skills = await Promise.all(
|
|
13813
14654
|
skillDirPaths.map(async (dirPath) => {
|
|
13814
|
-
const dirName = (0,
|
|
14655
|
+
const dirName = (0, import_node_path109.basename)(dirPath);
|
|
13815
14656
|
if (!dirName) return null;
|
|
13816
14657
|
try {
|
|
13817
14658
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -13819,7 +14660,7 @@ async function listSkills() {
|
|
|
13819
14660
|
});
|
|
13820
14661
|
const frontmatter = skill.getFrontmatter();
|
|
13821
14662
|
return {
|
|
13822
|
-
relativeDirPathFromCwd: (0,
|
|
14663
|
+
relativeDirPathFromCwd: (0, import_node_path109.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13823
14664
|
frontmatter
|
|
13824
14665
|
};
|
|
13825
14666
|
} catch (error) {
|
|
@@ -13845,7 +14686,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
13845
14686
|
dirName
|
|
13846
14687
|
});
|
|
13847
14688
|
return {
|
|
13848
|
-
relativeDirPathFromCwd: (0,
|
|
14689
|
+
relativeDirPathFromCwd: (0, import_node_path109.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13849
14690
|
frontmatter: skill.getFrontmatter(),
|
|
13850
14691
|
body: skill.getBody(),
|
|
13851
14692
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -13879,7 +14720,7 @@ async function putSkill({
|
|
|
13879
14720
|
try {
|
|
13880
14721
|
const existingSkills = await listSkills();
|
|
13881
14722
|
const isUpdate = existingSkills.some(
|
|
13882
|
-
(skill2) => skill2.relativeDirPathFromCwd === (0,
|
|
14723
|
+
(skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path109.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
13883
14724
|
);
|
|
13884
14725
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
13885
14726
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -13894,9 +14735,9 @@ async function putSkill({
|
|
|
13894
14735
|
otherFiles: aiDirFiles,
|
|
13895
14736
|
validate: true
|
|
13896
14737
|
});
|
|
13897
|
-
const skillDirPath = (0,
|
|
14738
|
+
const skillDirPath = (0, import_node_path109.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
13898
14739
|
await ensureDir(skillDirPath);
|
|
13899
|
-
const skillFilePath = (0,
|
|
14740
|
+
const skillFilePath = (0, import_node_path109.join)(skillDirPath, SKILL_FILE_NAME);
|
|
13900
14741
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
13901
14742
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
13902
14743
|
for (const file of otherFiles) {
|
|
@@ -13904,15 +14745,15 @@ async function putSkill({
|
|
|
13904
14745
|
relativePath: file.name,
|
|
13905
14746
|
intendedRootDir: skillDirPath
|
|
13906
14747
|
});
|
|
13907
|
-
const filePath = (0,
|
|
13908
|
-
const fileDir = (0,
|
|
14748
|
+
const filePath = (0, import_node_path109.join)(skillDirPath, file.name);
|
|
14749
|
+
const fileDir = (0, import_node_path109.join)(skillDirPath, (0, import_node_path109.dirname)(file.name));
|
|
13909
14750
|
if (fileDir !== skillDirPath) {
|
|
13910
14751
|
await ensureDir(fileDir);
|
|
13911
14752
|
}
|
|
13912
14753
|
await writeFileContent(filePath, file.body);
|
|
13913
14754
|
}
|
|
13914
14755
|
return {
|
|
13915
|
-
relativeDirPathFromCwd: (0,
|
|
14756
|
+
relativeDirPathFromCwd: (0, import_node_path109.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13916
14757
|
frontmatter: skill.getFrontmatter(),
|
|
13917
14758
|
body: skill.getBody(),
|
|
13918
14759
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -13934,13 +14775,13 @@ async function deleteSkill({
|
|
|
13934
14775
|
intendedRootDir: process.cwd()
|
|
13935
14776
|
});
|
|
13936
14777
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
13937
|
-
const skillDirPath = (0,
|
|
14778
|
+
const skillDirPath = (0, import_node_path109.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
13938
14779
|
try {
|
|
13939
14780
|
if (await directoryExists(skillDirPath)) {
|
|
13940
14781
|
await removeDirectory(skillDirPath);
|
|
13941
14782
|
}
|
|
13942
14783
|
return {
|
|
13943
|
-
relativeDirPathFromCwd: (0,
|
|
14784
|
+
relativeDirPathFromCwd: (0, import_node_path109.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
13944
14785
|
};
|
|
13945
14786
|
} catch (error) {
|
|
13946
14787
|
throw new Error(
|
|
@@ -13951,29 +14792,29 @@ async function deleteSkill({
|
|
|
13951
14792
|
);
|
|
13952
14793
|
}
|
|
13953
14794
|
}
|
|
13954
|
-
var McpSkillFileSchema =
|
|
13955
|
-
name:
|
|
13956
|
-
body:
|
|
14795
|
+
var McpSkillFileSchema = import_mini53.z.object({
|
|
14796
|
+
name: import_mini53.z.string(),
|
|
14797
|
+
body: import_mini53.z.string()
|
|
13957
14798
|
});
|
|
13958
14799
|
var skillToolSchemas = {
|
|
13959
|
-
listSkills:
|
|
13960
|
-
getSkill:
|
|
13961
|
-
relativeDirPathFromCwd:
|
|
14800
|
+
listSkills: import_mini53.z.object({}),
|
|
14801
|
+
getSkill: import_mini53.z.object({
|
|
14802
|
+
relativeDirPathFromCwd: import_mini53.z.string()
|
|
13962
14803
|
}),
|
|
13963
|
-
putSkill:
|
|
13964
|
-
relativeDirPathFromCwd:
|
|
14804
|
+
putSkill: import_mini53.z.object({
|
|
14805
|
+
relativeDirPathFromCwd: import_mini53.z.string(),
|
|
13965
14806
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
13966
|
-
body:
|
|
13967
|
-
otherFiles:
|
|
14807
|
+
body: import_mini53.z.string(),
|
|
14808
|
+
otherFiles: import_mini53.z.optional(import_mini53.z.array(McpSkillFileSchema))
|
|
13968
14809
|
}),
|
|
13969
|
-
deleteSkill:
|
|
13970
|
-
relativeDirPathFromCwd:
|
|
14810
|
+
deleteSkill: import_mini53.z.object({
|
|
14811
|
+
relativeDirPathFromCwd: import_mini53.z.string()
|
|
13971
14812
|
})
|
|
13972
14813
|
};
|
|
13973
14814
|
var skillTools = {
|
|
13974
14815
|
listSkills: {
|
|
13975
14816
|
name: "listSkills",
|
|
13976
|
-
description: `List all skills from ${(0,
|
|
14817
|
+
description: `List all skills from ${(0, import_node_path109.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
13977
14818
|
parameters: skillToolSchemas.listSkills,
|
|
13978
14819
|
execute: async () => {
|
|
13979
14820
|
const skills = await listSkills();
|
|
@@ -14016,12 +14857,12 @@ var skillTools = {
|
|
|
14016
14857
|
};
|
|
14017
14858
|
|
|
14018
14859
|
// src/mcp/subagents.ts
|
|
14019
|
-
var
|
|
14020
|
-
var
|
|
14860
|
+
var import_node_path110 = require("path");
|
|
14861
|
+
var import_mini54 = require("zod/mini");
|
|
14021
14862
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
14022
14863
|
var maxSubagentsCount = 1e3;
|
|
14023
14864
|
async function listSubagents() {
|
|
14024
|
-
const subagentsDir = (0,
|
|
14865
|
+
const subagentsDir = (0, import_node_path110.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
14025
14866
|
try {
|
|
14026
14867
|
const files = await listDirectoryFiles(subagentsDir);
|
|
14027
14868
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -14034,7 +14875,7 @@ async function listSubagents() {
|
|
|
14034
14875
|
});
|
|
14035
14876
|
const frontmatter = subagent.getFrontmatter();
|
|
14036
14877
|
return {
|
|
14037
|
-
relativePathFromCwd: (0,
|
|
14878
|
+
relativePathFromCwd: (0, import_node_path110.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
14038
14879
|
frontmatter
|
|
14039
14880
|
};
|
|
14040
14881
|
} catch (error) {
|
|
@@ -14056,14 +14897,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
14056
14897
|
relativePath: relativePathFromCwd,
|
|
14057
14898
|
intendedRootDir: process.cwd()
|
|
14058
14899
|
});
|
|
14059
|
-
const filename = (0,
|
|
14900
|
+
const filename = (0, import_node_path110.basename)(relativePathFromCwd);
|
|
14060
14901
|
try {
|
|
14061
14902
|
const subagent = await RulesyncSubagent.fromFile({
|
|
14062
14903
|
relativeFilePath: filename,
|
|
14063
14904
|
validate: true
|
|
14064
14905
|
});
|
|
14065
14906
|
return {
|
|
14066
|
-
relativePathFromCwd: (0,
|
|
14907
|
+
relativePathFromCwd: (0, import_node_path110.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
14067
14908
|
frontmatter: subagent.getFrontmatter(),
|
|
14068
14909
|
body: subagent.getBody()
|
|
14069
14910
|
};
|
|
@@ -14082,7 +14923,7 @@ async function putSubagent({
|
|
|
14082
14923
|
relativePath: relativePathFromCwd,
|
|
14083
14924
|
intendedRootDir: process.cwd()
|
|
14084
14925
|
});
|
|
14085
|
-
const filename = (0,
|
|
14926
|
+
const filename = (0, import_node_path110.basename)(relativePathFromCwd);
|
|
14086
14927
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
14087
14928
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
14088
14929
|
throw new Error(
|
|
@@ -14092,7 +14933,7 @@ async function putSubagent({
|
|
|
14092
14933
|
try {
|
|
14093
14934
|
const existingSubagents = await listSubagents();
|
|
14094
14935
|
const isUpdate = existingSubagents.some(
|
|
14095
|
-
(subagent2) => subagent2.relativePathFromCwd === (0,
|
|
14936
|
+
(subagent2) => subagent2.relativePathFromCwd === (0, import_node_path110.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
14096
14937
|
);
|
|
14097
14938
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
14098
14939
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -14105,11 +14946,11 @@ async function putSubagent({
|
|
|
14105
14946
|
body,
|
|
14106
14947
|
validate: true
|
|
14107
14948
|
});
|
|
14108
|
-
const subagentsDir = (0,
|
|
14949
|
+
const subagentsDir = (0, import_node_path110.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
14109
14950
|
await ensureDir(subagentsDir);
|
|
14110
14951
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
14111
14952
|
return {
|
|
14112
|
-
relativePathFromCwd: (0,
|
|
14953
|
+
relativePathFromCwd: (0, import_node_path110.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
14113
14954
|
frontmatter: subagent.getFrontmatter(),
|
|
14114
14955
|
body: subagent.getBody()
|
|
14115
14956
|
};
|
|
@@ -14124,12 +14965,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
14124
14965
|
relativePath: relativePathFromCwd,
|
|
14125
14966
|
intendedRootDir: process.cwd()
|
|
14126
14967
|
});
|
|
14127
|
-
const filename = (0,
|
|
14128
|
-
const fullPath = (0,
|
|
14968
|
+
const filename = (0, import_node_path110.basename)(relativePathFromCwd);
|
|
14969
|
+
const fullPath = (0, import_node_path110.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
14129
14970
|
try {
|
|
14130
14971
|
await removeFile(fullPath);
|
|
14131
14972
|
return {
|
|
14132
|
-
relativePathFromCwd: (0,
|
|
14973
|
+
relativePathFromCwd: (0, import_node_path110.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
14133
14974
|
};
|
|
14134
14975
|
} catch (error) {
|
|
14135
14976
|
throw new Error(
|
|
@@ -14141,23 +14982,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
14141
14982
|
}
|
|
14142
14983
|
}
|
|
14143
14984
|
var subagentToolSchemas = {
|
|
14144
|
-
listSubagents:
|
|
14145
|
-
getSubagent:
|
|
14146
|
-
relativePathFromCwd:
|
|
14985
|
+
listSubagents: import_mini54.z.object({}),
|
|
14986
|
+
getSubagent: import_mini54.z.object({
|
|
14987
|
+
relativePathFromCwd: import_mini54.z.string()
|
|
14147
14988
|
}),
|
|
14148
|
-
putSubagent:
|
|
14149
|
-
relativePathFromCwd:
|
|
14989
|
+
putSubagent: import_mini54.z.object({
|
|
14990
|
+
relativePathFromCwd: import_mini54.z.string(),
|
|
14150
14991
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
14151
|
-
body:
|
|
14992
|
+
body: import_mini54.z.string()
|
|
14152
14993
|
}),
|
|
14153
|
-
deleteSubagent:
|
|
14154
|
-
relativePathFromCwd:
|
|
14994
|
+
deleteSubagent: import_mini54.z.object({
|
|
14995
|
+
relativePathFromCwd: import_mini54.z.string()
|
|
14155
14996
|
})
|
|
14156
14997
|
};
|
|
14157
14998
|
var subagentTools = {
|
|
14158
14999
|
listSubagents: {
|
|
14159
15000
|
name: "listSubagents",
|
|
14160
|
-
description: `List all subagents from ${(0,
|
|
15001
|
+
description: `List all subagents from ${(0, import_node_path110.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
14161
15002
|
parameters: subagentToolSchemas.listSubagents,
|
|
14162
15003
|
execute: async () => {
|
|
14163
15004
|
const subagents = await listSubagents();
|
|
@@ -14199,20 +15040,20 @@ var subagentTools = {
|
|
|
14199
15040
|
};
|
|
14200
15041
|
|
|
14201
15042
|
// src/mcp/tools.ts
|
|
14202
|
-
var rulesyncFeatureSchema =
|
|
14203
|
-
var rulesyncOperationSchema =
|
|
14204
|
-
var skillFileSchema =
|
|
14205
|
-
name:
|
|
14206
|
-
body:
|
|
15043
|
+
var rulesyncFeatureSchema = import_mini55.z.enum(["rule", "command", "subagent", "skill", "ignore", "mcp"]);
|
|
15044
|
+
var rulesyncOperationSchema = import_mini55.z.enum(["list", "get", "put", "delete"]);
|
|
15045
|
+
var skillFileSchema = import_mini55.z.object({
|
|
15046
|
+
name: import_mini55.z.string(),
|
|
15047
|
+
body: import_mini55.z.string()
|
|
14207
15048
|
});
|
|
14208
|
-
var rulesyncToolSchema =
|
|
15049
|
+
var rulesyncToolSchema = import_mini55.z.object({
|
|
14209
15050
|
feature: rulesyncFeatureSchema,
|
|
14210
15051
|
operation: rulesyncOperationSchema,
|
|
14211
|
-
targetPathFromCwd:
|
|
14212
|
-
frontmatter:
|
|
14213
|
-
body:
|
|
14214
|
-
otherFiles:
|
|
14215
|
-
content:
|
|
15052
|
+
targetPathFromCwd: import_mini55.z.optional(import_mini55.z.string()),
|
|
15053
|
+
frontmatter: import_mini55.z.optional(import_mini55.z.unknown()),
|
|
15054
|
+
body: import_mini55.z.optional(import_mini55.z.string()),
|
|
15055
|
+
otherFiles: import_mini55.z.optional(import_mini55.z.array(skillFileSchema)),
|
|
15056
|
+
content: import_mini55.z.optional(import_mini55.z.string())
|
|
14216
15057
|
});
|
|
14217
15058
|
var supportedOperationsByFeature = {
|
|
14218
15059
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -14408,7 +15249,7 @@ async function mcpCommand({ version }) {
|
|
|
14408
15249
|
}
|
|
14409
15250
|
|
|
14410
15251
|
// src/cli/index.ts
|
|
14411
|
-
var getVersion = () => "6.
|
|
15252
|
+
var getVersion = () => "6.3.0";
|
|
14412
15253
|
var main = async () => {
|
|
14413
15254
|
const program = new import_commander.Command();
|
|
14414
15255
|
const version = getVersion();
|