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.js
CHANGED
|
@@ -8,7 +8,15 @@ var ANNOUNCEMENT = "".trim();
|
|
|
8
8
|
|
|
9
9
|
// src/types/features.ts
|
|
10
10
|
import { z } from "zod/mini";
|
|
11
|
-
var ALL_FEATURES = [
|
|
11
|
+
var ALL_FEATURES = [
|
|
12
|
+
"rules",
|
|
13
|
+
"ignore",
|
|
14
|
+
"mcp",
|
|
15
|
+
"subagents",
|
|
16
|
+
"commands",
|
|
17
|
+
"skills",
|
|
18
|
+
"hooks"
|
|
19
|
+
];
|
|
12
20
|
var ALL_FEATURES_WITH_WILDCARD = [...ALL_FEATURES, "*"];
|
|
13
21
|
var FeatureSchema = z.enum(ALL_FEATURES);
|
|
14
22
|
var FeaturesSchema = z.array(FeatureSchema);
|
|
@@ -106,6 +114,7 @@ var RULESYNC_RULES_RELATIVE_DIR_PATH = join(RULESYNC_RELATIVE_DIR_PATH, "rules")
|
|
|
106
114
|
var RULESYNC_COMMANDS_RELATIVE_DIR_PATH = join(RULESYNC_RELATIVE_DIR_PATH, "commands");
|
|
107
115
|
var RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH = join(RULESYNC_RELATIVE_DIR_PATH, "subagents");
|
|
108
116
|
var RULESYNC_MCP_RELATIVE_FILE_PATH = join(RULESYNC_RELATIVE_DIR_PATH, "mcp.json");
|
|
117
|
+
var RULESYNC_HOOKS_RELATIVE_FILE_PATH = join(RULESYNC_RELATIVE_DIR_PATH, "hooks.json");
|
|
109
118
|
var RULESYNC_AIIGNORE_FILE_NAME = ".aiignore";
|
|
110
119
|
var RULESYNC_AIIGNORE_RELATIVE_FILE_PATH = join(RULESYNC_RELATIVE_DIR_PATH, ".aiignore");
|
|
111
120
|
var RULESYNC_IGNORE_RELATIVE_FILE_PATH = ".rulesyncignore";
|
|
@@ -503,7 +512,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
503
512
|
|
|
504
513
|
// src/lib/generate.ts
|
|
505
514
|
import { intersection } from "es-toolkit";
|
|
506
|
-
import { join as
|
|
515
|
+
import { join as join101 } from "path";
|
|
507
516
|
|
|
508
517
|
// src/features/commands/commands-processor.ts
|
|
509
518
|
import { basename as basename15, join as join18 } from "path";
|
|
@@ -2580,80 +2589,140 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2580
2589
|
}
|
|
2581
2590
|
};
|
|
2582
2591
|
|
|
2583
|
-
// src/features/
|
|
2592
|
+
// src/features/hooks/hooks-processor.ts
|
|
2593
|
+
import { z as z14 } from "zod/mini";
|
|
2594
|
+
|
|
2595
|
+
// src/types/hooks.ts
|
|
2584
2596
|
import { z as z13 } from "zod/mini";
|
|
2597
|
+
var HookDefinitionSchema = z13.object({
|
|
2598
|
+
command: z13.optional(z13.string()),
|
|
2599
|
+
type: z13.optional(z13.enum(["command", "prompt"])),
|
|
2600
|
+
timeout: z13.optional(z13.number()),
|
|
2601
|
+
matcher: z13.optional(z13.string()),
|
|
2602
|
+
prompt: z13.optional(z13.string()),
|
|
2603
|
+
loop_limit: z13.optional(z13.nullable(z13.number()))
|
|
2604
|
+
});
|
|
2605
|
+
var COMMON_HOOK_EVENTS = [
|
|
2606
|
+
"sessionStart",
|
|
2607
|
+
"sessionEnd",
|
|
2608
|
+
"preToolUse",
|
|
2609
|
+
"postToolUse",
|
|
2610
|
+
"beforeSubmitPrompt",
|
|
2611
|
+
"stop",
|
|
2612
|
+
"subagentStop",
|
|
2613
|
+
"preCompact"
|
|
2614
|
+
];
|
|
2615
|
+
var CURSOR_ONLY_HOOK_EVENTS = [
|
|
2616
|
+
"postToolUseFailure",
|
|
2617
|
+
"subagentStart",
|
|
2618
|
+
"beforeShellExecution",
|
|
2619
|
+
"afterShellExecution",
|
|
2620
|
+
"beforeMCPExecution",
|
|
2621
|
+
"afterMCPExecution",
|
|
2622
|
+
"beforeReadFile",
|
|
2623
|
+
"afterFileEdit",
|
|
2624
|
+
"afterAgentResponse",
|
|
2625
|
+
"afterAgentThought",
|
|
2626
|
+
"beforeTabFileRead",
|
|
2627
|
+
"afterTabFileEdit"
|
|
2628
|
+
];
|
|
2629
|
+
var CLAUDE_ONLY_HOOK_EVENTS = ["permissionRequest", "notification", "setup"];
|
|
2630
|
+
var CURSOR_HOOK_EVENTS = [
|
|
2631
|
+
...COMMON_HOOK_EVENTS,
|
|
2632
|
+
...CURSOR_ONLY_HOOK_EVENTS
|
|
2633
|
+
];
|
|
2634
|
+
var CLAUDE_HOOK_EVENTS = [
|
|
2635
|
+
...COMMON_HOOK_EVENTS,
|
|
2636
|
+
...CLAUDE_ONLY_HOOK_EVENTS
|
|
2637
|
+
];
|
|
2638
|
+
var hooksRecordSchema = z13.record(z13.string(), z13.array(HookDefinitionSchema));
|
|
2639
|
+
var HooksConfigSchema = z13.object({
|
|
2640
|
+
version: z13.optional(z13.number()),
|
|
2641
|
+
hooks: hooksRecordSchema,
|
|
2642
|
+
cursor: z13.optional(z13.object({ hooks: z13.optional(hooksRecordSchema) })),
|
|
2643
|
+
claudecode: z13.optional(z13.object({ hooks: z13.optional(hooksRecordSchema) }))
|
|
2644
|
+
});
|
|
2645
|
+
var CURSOR_TO_CLAUDE_EVENT_NAMES = {
|
|
2646
|
+
sessionStart: "SessionStart",
|
|
2647
|
+
sessionEnd: "SessionEnd",
|
|
2648
|
+
preToolUse: "PreToolUse",
|
|
2649
|
+
postToolUse: "PostToolUse",
|
|
2650
|
+
beforeSubmitPrompt: "UserPromptSubmit",
|
|
2651
|
+
stop: "Stop",
|
|
2652
|
+
subagentStop: "SubagentStop",
|
|
2653
|
+
preCompact: "PreCompact",
|
|
2654
|
+
permissionRequest: "PermissionRequest",
|
|
2655
|
+
notification: "Notification",
|
|
2656
|
+
setup: "Setup"
|
|
2657
|
+
};
|
|
2658
|
+
var CLAUDE_TO_CURSOR_EVENT_NAMES = Object.fromEntries(
|
|
2659
|
+
Object.entries(CURSOR_TO_CLAUDE_EVENT_NAMES).map(([k, v]) => [v, k])
|
|
2660
|
+
);
|
|
2585
2661
|
|
|
2586
|
-
// src/features/
|
|
2662
|
+
// src/features/hooks/claudecode-hooks.ts
|
|
2587
2663
|
import { join as join20 } from "path";
|
|
2588
2664
|
|
|
2589
2665
|
// src/types/tool-file.ts
|
|
2590
2666
|
var ToolFile = class extends AiFile {
|
|
2591
2667
|
};
|
|
2592
2668
|
|
|
2593
|
-
// src/features/
|
|
2669
|
+
// src/features/hooks/rulesync-hooks.ts
|
|
2594
2670
|
import { join as join19 } from "path";
|
|
2595
|
-
var
|
|
2596
|
-
|
|
2597
|
-
|
|
2671
|
+
var RulesyncHooks = class _RulesyncHooks extends RulesyncFile {
|
|
2672
|
+
json;
|
|
2673
|
+
constructor(params) {
|
|
2674
|
+
super({ ...params });
|
|
2675
|
+
this.json = JSON.parse(this.fileContent);
|
|
2676
|
+
if (params.validate) {
|
|
2677
|
+
const result = this.validate();
|
|
2678
|
+
if (!result.success) {
|
|
2679
|
+
throw result.error;
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2598
2682
|
}
|
|
2599
2683
|
static getSettablePaths() {
|
|
2600
2684
|
return {
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
relativeFilePath: RULESYNC_AIIGNORE_FILE_NAME
|
|
2604
|
-
},
|
|
2605
|
-
legacy: {
|
|
2606
|
-
relativeDirPath: ".",
|
|
2607
|
-
relativeFilePath: RULESYNC_IGNORE_RELATIVE_FILE_PATH
|
|
2608
|
-
}
|
|
2685
|
+
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
2686
|
+
relativeFilePath: "hooks.json"
|
|
2609
2687
|
};
|
|
2610
2688
|
}
|
|
2611
|
-
|
|
2612
|
-
const
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
baseDir,
|
|
2616
|
-
paths.recommended.relativeDirPath,
|
|
2617
|
-
paths.recommended.relativeFilePath
|
|
2618
|
-
);
|
|
2619
|
-
const legacyPath = join19(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
2620
|
-
if (await fileExists(recommendedPath)) {
|
|
2621
|
-
const fileContent2 = await readFileContent(recommendedPath);
|
|
2622
|
-
return new _RulesyncIgnore({
|
|
2623
|
-
baseDir,
|
|
2624
|
-
relativeDirPath: paths.recommended.relativeDirPath,
|
|
2625
|
-
relativeFilePath: paths.recommended.relativeFilePath,
|
|
2626
|
-
fileContent: fileContent2
|
|
2627
|
-
});
|
|
2689
|
+
validate() {
|
|
2690
|
+
const result = HooksConfigSchema.safeParse(this.json);
|
|
2691
|
+
if (!result.success) {
|
|
2692
|
+
return { success: false, error: result.error };
|
|
2628
2693
|
}
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2694
|
+
return { success: true, error: null };
|
|
2695
|
+
}
|
|
2696
|
+
static async fromFile({
|
|
2697
|
+
baseDir = process.cwd(),
|
|
2698
|
+
validate = true
|
|
2699
|
+
}) {
|
|
2700
|
+
const paths = _RulesyncHooks.getSettablePaths();
|
|
2701
|
+
const filePath = join19(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
2702
|
+
if (!await fileExists(filePath)) {
|
|
2703
|
+
throw new Error(`No ${RULESYNC_HOOKS_RELATIVE_FILE_PATH} found.`);
|
|
2637
2704
|
}
|
|
2638
|
-
const fileContent = await readFileContent(
|
|
2639
|
-
return new
|
|
2705
|
+
const fileContent = await readFileContent(filePath);
|
|
2706
|
+
return new _RulesyncHooks({
|
|
2640
2707
|
baseDir,
|
|
2641
|
-
relativeDirPath: paths.
|
|
2642
|
-
relativeFilePath: paths.
|
|
2643
|
-
fileContent
|
|
2708
|
+
relativeDirPath: paths.relativeDirPath,
|
|
2709
|
+
relativeFilePath: paths.relativeFilePath,
|
|
2710
|
+
fileContent,
|
|
2711
|
+
validate
|
|
2644
2712
|
});
|
|
2645
2713
|
}
|
|
2714
|
+
getJson() {
|
|
2715
|
+
return this.json;
|
|
2716
|
+
}
|
|
2646
2717
|
};
|
|
2647
2718
|
|
|
2648
|
-
// src/features/
|
|
2649
|
-
var
|
|
2650
|
-
patterns;
|
|
2719
|
+
// src/features/hooks/tool-hooks.ts
|
|
2720
|
+
var ToolHooks = class extends ToolFile {
|
|
2651
2721
|
constructor(params) {
|
|
2652
2722
|
super({
|
|
2653
2723
|
...params,
|
|
2654
2724
|
validate: true
|
|
2655
2725
|
});
|
|
2656
|
-
this.patterns = this.fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
2657
2726
|
if (params.validate) {
|
|
2658
2727
|
const result = this.validate();
|
|
2659
2728
|
if (!result.success) {
|
|
@@ -2661,151 +2730,653 @@ var ToolIgnore = class extends ToolFile {
|
|
|
2661
2730
|
}
|
|
2662
2731
|
}
|
|
2663
2732
|
}
|
|
2664
|
-
static getSettablePaths() {
|
|
2665
|
-
throw new Error("Please implement this method in the subclass.");
|
|
2666
|
-
}
|
|
2667
|
-
getPatterns() {
|
|
2668
|
-
return this.patterns;
|
|
2669
|
-
}
|
|
2670
|
-
validate() {
|
|
2671
|
-
return { success: true, error: null };
|
|
2672
|
-
}
|
|
2673
|
-
static fromRulesyncIgnore(_params) {
|
|
2733
|
+
static getSettablePaths(_options) {
|
|
2674
2734
|
throw new Error("Please implement this method in the subclass.");
|
|
2675
2735
|
}
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2736
|
+
toRulesyncHooksDefault({
|
|
2737
|
+
fileContent = void 0
|
|
2738
|
+
} = {}) {
|
|
2739
|
+
return new RulesyncHooks({
|
|
2740
|
+
baseDir: this.baseDir,
|
|
2679
2741
|
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
2680
|
-
relativeFilePath:
|
|
2681
|
-
fileContent: this.fileContent
|
|
2742
|
+
relativeFilePath: "hooks.json",
|
|
2743
|
+
fileContent: fileContent ?? this.fileContent
|
|
2682
2744
|
});
|
|
2683
2745
|
}
|
|
2684
2746
|
static async fromFile(_params) {
|
|
2685
2747
|
throw new Error("Please implement this method in the subclass.");
|
|
2686
2748
|
}
|
|
2687
|
-
/**
|
|
2688
|
-
* Create a minimal instance for deletion purposes.
|
|
2689
|
-
* This method does not read or parse file content, making it safe to use
|
|
2690
|
-
* even when files have old/incompatible formats.
|
|
2691
|
-
*/
|
|
2692
2749
|
static forDeletion(_params) {
|
|
2693
2750
|
throw new Error("Please implement this method in the subclass.");
|
|
2694
2751
|
}
|
|
2695
2752
|
};
|
|
2696
2753
|
|
|
2697
|
-
// src/features/
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2754
|
+
// src/features/hooks/claudecode-hooks.ts
|
|
2755
|
+
function canonicalToClaudeHooks(config) {
|
|
2756
|
+
const claudeSupported = new Set(CLAUDE_HOOK_EVENTS);
|
|
2757
|
+
const sharedHooks = {};
|
|
2758
|
+
for (const [event, defs] of Object.entries(config.hooks)) {
|
|
2759
|
+
if (claudeSupported.has(event)) {
|
|
2760
|
+
sharedHooks[event] = defs;
|
|
2761
|
+
}
|
|
2704
2762
|
}
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2763
|
+
const effectiveHooks = {
|
|
2764
|
+
...sharedHooks,
|
|
2765
|
+
...config.claudecode?.hooks
|
|
2766
|
+
};
|
|
2767
|
+
const claude = {};
|
|
2768
|
+
for (const [eventName, definitions] of Object.entries(effectiveHooks)) {
|
|
2769
|
+
const claudeEventName = CURSOR_TO_CLAUDE_EVENT_NAMES[eventName] ?? eventName;
|
|
2770
|
+
const byMatcher = /* @__PURE__ */ new Map();
|
|
2771
|
+
for (const def of definitions) {
|
|
2772
|
+
const key = def.matcher ?? "";
|
|
2773
|
+
const list = byMatcher.get(key);
|
|
2774
|
+
if (list) list.push(def);
|
|
2775
|
+
else byMatcher.set(key, [def]);
|
|
2776
|
+
}
|
|
2777
|
+
const entries = [];
|
|
2778
|
+
for (const [matcherKey, defs] of byMatcher) {
|
|
2779
|
+
const hooks = defs.map((def) => {
|
|
2780
|
+
const command = def.command !== void 0 && def.command !== null && !def.command.startsWith("$") ? `$CLAUDE_PROJECT_DIR/${def.command.replace(/^\.\//, "")}` : def.command;
|
|
2781
|
+
return {
|
|
2782
|
+
type: def.type ?? "command",
|
|
2783
|
+
...command !== void 0 && command !== null && { command },
|
|
2784
|
+
...def.timeout !== void 0 && def.timeout !== null && { timeout: def.timeout },
|
|
2785
|
+
...def.prompt !== void 0 && def.prompt !== null && { prompt: def.prompt }
|
|
2786
|
+
};
|
|
2787
|
+
});
|
|
2788
|
+
entries.push(matcherKey ? { matcher: matcherKey, hooks } : { hooks });
|
|
2789
|
+
}
|
|
2790
|
+
claude[claudeEventName] = entries;
|
|
2710
2791
|
}
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2792
|
+
return claude;
|
|
2793
|
+
}
|
|
2794
|
+
function isClaudeMatcherEntry(x) {
|
|
2795
|
+
if (x === null || typeof x !== "object") {
|
|
2796
|
+
return false;
|
|
2797
|
+
}
|
|
2798
|
+
if ("matcher" in x && typeof x.matcher !== "string") {
|
|
2799
|
+
return false;
|
|
2800
|
+
}
|
|
2801
|
+
if ("hooks" in x && !Array.isArray(x.hooks)) {
|
|
2802
|
+
return false;
|
|
2803
|
+
}
|
|
2804
|
+
return true;
|
|
2805
|
+
}
|
|
2806
|
+
function claudeHooksToCanonical(claudeHooks) {
|
|
2807
|
+
if (claudeHooks === null || claudeHooks === void 0 || typeof claudeHooks !== "object") {
|
|
2808
|
+
return {};
|
|
2809
|
+
}
|
|
2810
|
+
const canonical = {};
|
|
2811
|
+
for (const [claudeEventName, matcherEntries] of Object.entries(claudeHooks)) {
|
|
2812
|
+
const eventName = CLAUDE_TO_CURSOR_EVENT_NAMES[claudeEventName] ?? claudeEventName;
|
|
2813
|
+
if (!Array.isArray(matcherEntries)) continue;
|
|
2814
|
+
const defs = [];
|
|
2815
|
+
for (const rawEntry of matcherEntries) {
|
|
2816
|
+
if (!isClaudeMatcherEntry(rawEntry)) continue;
|
|
2817
|
+
const entry = rawEntry;
|
|
2818
|
+
const hooks = entry.hooks ?? [];
|
|
2819
|
+
for (const h of hooks) {
|
|
2820
|
+
const cmd = typeof h.command === "string" ? h.command : void 0;
|
|
2821
|
+
const command = typeof cmd === "string" && cmd.includes("$CLAUDE_PROJECT_DIR/") ? cmd.replace(/^\$CLAUDE_PROJECT_DIR\/?/, "./") : cmd;
|
|
2822
|
+
const hookType = h.type === "command" || h.type === "prompt" ? h.type : "command";
|
|
2823
|
+
const timeout = typeof h.timeout === "number" ? h.timeout : void 0;
|
|
2824
|
+
const prompt = typeof h.prompt === "string" ? h.prompt : void 0;
|
|
2825
|
+
defs.push({
|
|
2826
|
+
type: hookType,
|
|
2827
|
+
...command !== void 0 && command !== null && { command },
|
|
2828
|
+
...timeout !== void 0 && timeout !== null && { timeout },
|
|
2829
|
+
...prompt !== void 0 && prompt !== null && { prompt },
|
|
2830
|
+
...entry.matcher !== void 0 && entry.matcher !== null && entry.matcher !== "" && { matcher: entry.matcher }
|
|
2831
|
+
});
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
if (defs.length > 0) {
|
|
2835
|
+
canonical[eventName] = defs;
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
return canonical;
|
|
2839
|
+
}
|
|
2840
|
+
var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
2841
|
+
constructor(params) {
|
|
2842
|
+
super({
|
|
2843
|
+
...params,
|
|
2844
|
+
fileContent: params.fileContent ?? "{}"
|
|
2845
|
+
});
|
|
2846
|
+
}
|
|
2847
|
+
isDeletable() {
|
|
2848
|
+
return false;
|
|
2849
|
+
}
|
|
2850
|
+
static getSettablePaths(_options = {}) {
|
|
2851
|
+
return { relativeDirPath: ".claude", relativeFilePath: "settings.json" };
|
|
2852
|
+
}
|
|
2853
|
+
static async fromFile({
|
|
2716
2854
|
baseDir = process.cwd(),
|
|
2717
|
-
|
|
2855
|
+
validate = true,
|
|
2856
|
+
global = false
|
|
2718
2857
|
}) {
|
|
2719
|
-
|
|
2858
|
+
const paths = _ClaudecodeHooks.getSettablePaths({ global });
|
|
2859
|
+
const filePath = join20(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
2860
|
+
const fileContent = await readOrInitializeFileContent(
|
|
2861
|
+
filePath,
|
|
2862
|
+
JSON.stringify({ hooks: {} }, null, 2)
|
|
2863
|
+
);
|
|
2864
|
+
return new _ClaudecodeHooks({
|
|
2720
2865
|
baseDir,
|
|
2721
|
-
relativeDirPath:
|
|
2722
|
-
relativeFilePath:
|
|
2723
|
-
fileContent
|
|
2866
|
+
relativeDirPath: paths.relativeDirPath,
|
|
2867
|
+
relativeFilePath: paths.relativeFilePath,
|
|
2868
|
+
fileContent,
|
|
2869
|
+
validate
|
|
2724
2870
|
});
|
|
2725
2871
|
}
|
|
2726
|
-
|
|
2727
|
-
* Create AugmentcodeIgnore from file path
|
|
2728
|
-
* Reads and parses .augmentignore file
|
|
2729
|
-
*/
|
|
2730
|
-
static async fromFile({
|
|
2872
|
+
static async fromRulesyncHooks({
|
|
2731
2873
|
baseDir = process.cwd(),
|
|
2732
|
-
|
|
2874
|
+
rulesyncHooks,
|
|
2875
|
+
validate = true,
|
|
2876
|
+
global = false
|
|
2733
2877
|
}) {
|
|
2734
|
-
const
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
)
|
|
2878
|
+
const paths = _ClaudecodeHooks.getSettablePaths({ global });
|
|
2879
|
+
const filePath = join20(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
2880
|
+
const existingContent = await readOrInitializeFileContent(
|
|
2881
|
+
filePath,
|
|
2882
|
+
JSON.stringify({}, null, 2)
|
|
2740
2883
|
);
|
|
2741
|
-
|
|
2884
|
+
let settings;
|
|
2885
|
+
try {
|
|
2886
|
+
settings = JSON.parse(existingContent);
|
|
2887
|
+
} catch (error) {
|
|
2888
|
+
throw new Error(
|
|
2889
|
+
`Failed to parse existing Claude settings at ${filePath}: ${formatError(error)}`,
|
|
2890
|
+
{ cause: error }
|
|
2891
|
+
);
|
|
2892
|
+
}
|
|
2893
|
+
const config = rulesyncHooks.getJson();
|
|
2894
|
+
const claudeHooks = canonicalToClaudeHooks(config);
|
|
2895
|
+
const merged = { ...settings, hooks: claudeHooks };
|
|
2896
|
+
const fileContent = JSON.stringify(merged, null, 2);
|
|
2897
|
+
return new _ClaudecodeHooks({
|
|
2742
2898
|
baseDir,
|
|
2743
|
-
relativeDirPath:
|
|
2744
|
-
relativeFilePath:
|
|
2899
|
+
relativeDirPath: paths.relativeDirPath,
|
|
2900
|
+
relativeFilePath: paths.relativeFilePath,
|
|
2745
2901
|
fileContent,
|
|
2746
2902
|
validate
|
|
2747
2903
|
});
|
|
2748
2904
|
}
|
|
2905
|
+
toRulesyncHooks() {
|
|
2906
|
+
let settings;
|
|
2907
|
+
try {
|
|
2908
|
+
settings = JSON.parse(this.getFileContent());
|
|
2909
|
+
} catch (error) {
|
|
2910
|
+
throw new Error(`Failed to parse Claude hooks content: ${formatError(error)}`, {
|
|
2911
|
+
cause: error
|
|
2912
|
+
});
|
|
2913
|
+
}
|
|
2914
|
+
const hooks = claudeHooksToCanonical(settings.hooks);
|
|
2915
|
+
return this.toRulesyncHooksDefault({
|
|
2916
|
+
fileContent: JSON.stringify({ version: 1, hooks }, null, 2)
|
|
2917
|
+
});
|
|
2918
|
+
}
|
|
2919
|
+
validate() {
|
|
2920
|
+
return { success: true, error: null };
|
|
2921
|
+
}
|
|
2749
2922
|
static forDeletion({
|
|
2750
2923
|
baseDir = process.cwd(),
|
|
2751
2924
|
relativeDirPath,
|
|
2752
2925
|
relativeFilePath
|
|
2753
2926
|
}) {
|
|
2754
|
-
return new
|
|
2927
|
+
return new _ClaudecodeHooks({
|
|
2755
2928
|
baseDir,
|
|
2756
2929
|
relativeDirPath,
|
|
2757
2930
|
relativeFilePath,
|
|
2758
|
-
fileContent:
|
|
2931
|
+
fileContent: JSON.stringify({ hooks: {} }, null, 2),
|
|
2759
2932
|
validate: false
|
|
2760
2933
|
});
|
|
2761
2934
|
}
|
|
2762
2935
|
};
|
|
2763
2936
|
|
|
2764
|
-
// src/features/
|
|
2765
|
-
import { uniq } from "es-toolkit";
|
|
2937
|
+
// src/features/hooks/cursor-hooks.ts
|
|
2766
2938
|
import { join as join21 } from "path";
|
|
2767
|
-
var
|
|
2939
|
+
var CursorHooks = class _CursorHooks extends ToolHooks {
|
|
2768
2940
|
constructor(params) {
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2941
|
+
const { rulesyncHooks: _r, ...rest } = params;
|
|
2942
|
+
super({
|
|
2943
|
+
...rest,
|
|
2944
|
+
fileContent: rest.fileContent ?? "{}"
|
|
2945
|
+
});
|
|
2772
2946
|
}
|
|
2773
2947
|
static getSettablePaths() {
|
|
2774
2948
|
return {
|
|
2775
|
-
relativeDirPath: ".
|
|
2776
|
-
relativeFilePath: "
|
|
2949
|
+
relativeDirPath: ".cursor",
|
|
2950
|
+
relativeFilePath: "hooks.json"
|
|
2777
2951
|
};
|
|
2778
2952
|
}
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
const fileContent = rulesyncPatterns.join("\n");
|
|
2794
|
-
return new RulesyncIgnore({
|
|
2795
|
-
baseDir: this.baseDir,
|
|
2796
|
-
relativeDirPath: RulesyncIgnore.getSettablePaths().recommended.relativeDirPath,
|
|
2797
|
-
relativeFilePath: RulesyncIgnore.getSettablePaths().recommended.relativeFilePath,
|
|
2798
|
-
fileContent
|
|
2953
|
+
static async fromFile({
|
|
2954
|
+
baseDir = process.cwd(),
|
|
2955
|
+
validate = true
|
|
2956
|
+
}) {
|
|
2957
|
+
const paths = _CursorHooks.getSettablePaths();
|
|
2958
|
+
const fileContent = await readFileContent(
|
|
2959
|
+
join21(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
2960
|
+
);
|
|
2961
|
+
return new _CursorHooks({
|
|
2962
|
+
baseDir,
|
|
2963
|
+
relativeDirPath: paths.relativeDirPath,
|
|
2964
|
+
relativeFilePath: paths.relativeFilePath,
|
|
2965
|
+
fileContent,
|
|
2966
|
+
validate
|
|
2799
2967
|
});
|
|
2800
2968
|
}
|
|
2801
|
-
static
|
|
2969
|
+
static fromRulesyncHooks({
|
|
2802
2970
|
baseDir = process.cwd(),
|
|
2803
|
-
|
|
2971
|
+
rulesyncHooks,
|
|
2972
|
+
validate = true
|
|
2804
2973
|
}) {
|
|
2805
|
-
const
|
|
2806
|
-
const
|
|
2974
|
+
const config = rulesyncHooks.getJson();
|
|
2975
|
+
const cursorSupported = new Set(CURSOR_HOOK_EVENTS);
|
|
2976
|
+
const sharedHooks = {};
|
|
2977
|
+
for (const [event, defs] of Object.entries(config.hooks)) {
|
|
2978
|
+
if (cursorSupported.has(event)) {
|
|
2979
|
+
sharedHooks[event] = defs;
|
|
2980
|
+
}
|
|
2981
|
+
}
|
|
2982
|
+
const mergedHooks = {
|
|
2983
|
+
...sharedHooks,
|
|
2984
|
+
...config.cursor?.hooks
|
|
2985
|
+
};
|
|
2986
|
+
const cursorConfig = {
|
|
2987
|
+
version: config.version ?? 1,
|
|
2988
|
+
hooks: mergedHooks
|
|
2989
|
+
};
|
|
2990
|
+
const fileContent = JSON.stringify(cursorConfig, null, 2);
|
|
2991
|
+
const paths = _CursorHooks.getSettablePaths();
|
|
2992
|
+
return new _CursorHooks({
|
|
2993
|
+
baseDir,
|
|
2994
|
+
relativeDirPath: paths.relativeDirPath,
|
|
2995
|
+
relativeFilePath: paths.relativeFilePath,
|
|
2996
|
+
fileContent,
|
|
2997
|
+
validate,
|
|
2998
|
+
rulesyncHooks
|
|
2999
|
+
});
|
|
3000
|
+
}
|
|
3001
|
+
toRulesyncHooks() {
|
|
3002
|
+
const content = this.getFileContent();
|
|
3003
|
+
const parsed = JSON.parse(content);
|
|
3004
|
+
const hooks = parsed.hooks ?? {};
|
|
3005
|
+
const version = parsed.version ?? 1;
|
|
3006
|
+
return this.toRulesyncHooksDefault({
|
|
3007
|
+
fileContent: JSON.stringify({ version, hooks }, null, 2)
|
|
3008
|
+
});
|
|
3009
|
+
}
|
|
3010
|
+
validate() {
|
|
3011
|
+
return { success: true, error: null };
|
|
3012
|
+
}
|
|
3013
|
+
static forDeletion({
|
|
3014
|
+
baseDir = process.cwd(),
|
|
3015
|
+
relativeDirPath,
|
|
3016
|
+
relativeFilePath
|
|
3017
|
+
}) {
|
|
3018
|
+
return new _CursorHooks({
|
|
3019
|
+
baseDir,
|
|
3020
|
+
relativeDirPath,
|
|
3021
|
+
relativeFilePath,
|
|
3022
|
+
fileContent: "{}",
|
|
3023
|
+
validate: false
|
|
3024
|
+
});
|
|
3025
|
+
}
|
|
3026
|
+
};
|
|
3027
|
+
|
|
3028
|
+
// src/features/hooks/hooks-processor.ts
|
|
3029
|
+
var hooksProcessorToolTargetTuple = ["cursor", "claudecode"];
|
|
3030
|
+
var HooksProcessorToolTargetSchema = z14.enum(hooksProcessorToolTargetTuple);
|
|
3031
|
+
var toolHooksFactories = /* @__PURE__ */ new Map([
|
|
3032
|
+
[
|
|
3033
|
+
"cursor",
|
|
3034
|
+
{
|
|
3035
|
+
class: CursorHooks,
|
|
3036
|
+
meta: { supportsProject: true, supportsGlobal: false }
|
|
3037
|
+
}
|
|
3038
|
+
],
|
|
3039
|
+
[
|
|
3040
|
+
"claudecode",
|
|
3041
|
+
{
|
|
3042
|
+
class: ClaudecodeHooks,
|
|
3043
|
+
meta: { supportsProject: true, supportsGlobal: true }
|
|
3044
|
+
}
|
|
3045
|
+
]
|
|
3046
|
+
]);
|
|
3047
|
+
var hooksProcessorToolTargets = [...toolHooksFactories.keys()];
|
|
3048
|
+
var hooksProcessorToolTargetsGlobal = [...toolHooksFactories.entries()].filter(([, f]) => f.meta.supportsGlobal).map(([t]) => t);
|
|
3049
|
+
var HooksProcessor = class extends FeatureProcessor {
|
|
3050
|
+
toolTarget;
|
|
3051
|
+
global;
|
|
3052
|
+
constructor({
|
|
3053
|
+
baseDir = process.cwd(),
|
|
3054
|
+
toolTarget,
|
|
3055
|
+
global = false
|
|
3056
|
+
}) {
|
|
3057
|
+
super({ baseDir });
|
|
3058
|
+
const result = HooksProcessorToolTargetSchema.safeParse(toolTarget);
|
|
3059
|
+
if (!result.success) {
|
|
3060
|
+
throw new Error(
|
|
3061
|
+
`Invalid tool target for HooksProcessor: ${toolTarget}. ${formatError(result.error)}`
|
|
3062
|
+
);
|
|
3063
|
+
}
|
|
3064
|
+
this.toolTarget = result.data;
|
|
3065
|
+
this.global = global;
|
|
3066
|
+
}
|
|
3067
|
+
async loadRulesyncFiles() {
|
|
3068
|
+
try {
|
|
3069
|
+
return [
|
|
3070
|
+
await RulesyncHooks.fromFile({
|
|
3071
|
+
baseDir: this.baseDir,
|
|
3072
|
+
validate: true
|
|
3073
|
+
})
|
|
3074
|
+
];
|
|
3075
|
+
} catch (error) {
|
|
3076
|
+
logger.error(`Failed to load Rulesync hooks file: ${formatError(error)}`);
|
|
3077
|
+
return [];
|
|
3078
|
+
}
|
|
3079
|
+
}
|
|
3080
|
+
async loadToolFiles({ forDeletion = false } = {}) {
|
|
3081
|
+
try {
|
|
3082
|
+
const factory = toolHooksFactories.get(this.toolTarget);
|
|
3083
|
+
if (!factory) throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
3084
|
+
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
3085
|
+
if (forDeletion) {
|
|
3086
|
+
const toolHooks2 = factory.class.forDeletion({
|
|
3087
|
+
baseDir: this.baseDir,
|
|
3088
|
+
relativeDirPath: paths.relativeDirPath,
|
|
3089
|
+
relativeFilePath: paths.relativeFilePath,
|
|
3090
|
+
global: this.global
|
|
3091
|
+
});
|
|
3092
|
+
const list = toolHooks2.isDeletable?.() !== false ? [toolHooks2] : [];
|
|
3093
|
+
logger.info(
|
|
3094
|
+
`Successfully loaded ${list.length} ${this.toolTarget} hooks files for deletion`
|
|
3095
|
+
);
|
|
3096
|
+
return list;
|
|
3097
|
+
}
|
|
3098
|
+
const fromFile = this.toolTarget === "cursor" ? CursorHooks.fromFile({ baseDir: this.baseDir, validate: true }) : ClaudecodeHooks.fromFile({
|
|
3099
|
+
baseDir: this.baseDir,
|
|
3100
|
+
validate: true,
|
|
3101
|
+
global: this.global
|
|
3102
|
+
});
|
|
3103
|
+
const toolHooks = await fromFile;
|
|
3104
|
+
logger.info(`Successfully loaded 1 ${this.toolTarget} hooks file`);
|
|
3105
|
+
return [toolHooks];
|
|
3106
|
+
} catch (error) {
|
|
3107
|
+
const msg = `Failed to load hooks files for tool target: ${this.toolTarget}: ${formatError(error)}`;
|
|
3108
|
+
if (error instanceof Error && error.message.includes("no such file or directory")) {
|
|
3109
|
+
logger.debug(msg);
|
|
3110
|
+
} else {
|
|
3111
|
+
logger.error(msg);
|
|
3112
|
+
}
|
|
3113
|
+
return [];
|
|
3114
|
+
}
|
|
3115
|
+
}
|
|
3116
|
+
async convertRulesyncFilesToToolFiles(rulesyncFiles) {
|
|
3117
|
+
const rulesyncHooks = rulesyncFiles.find((f) => f instanceof RulesyncHooks);
|
|
3118
|
+
if (!rulesyncHooks) {
|
|
3119
|
+
throw new Error(`No ${RULESYNC_HOOKS_RELATIVE_FILE_PATH} found.`);
|
|
3120
|
+
}
|
|
3121
|
+
const config = rulesyncHooks.getJson();
|
|
3122
|
+
const supportedSet = new Set(
|
|
3123
|
+
this.toolTarget === "cursor" ? CURSOR_HOOK_EVENTS : CLAUDE_HOOK_EVENTS
|
|
3124
|
+
);
|
|
3125
|
+
const configEventNames = /* @__PURE__ */ new Set([
|
|
3126
|
+
...Object.keys(config.hooks),
|
|
3127
|
+
...this.toolTarget === "cursor" ? Object.keys(config.cursor?.hooks ?? {}) : Object.keys(config.claudecode?.hooks ?? {})
|
|
3128
|
+
]);
|
|
3129
|
+
const skipped = [...configEventNames].filter((e) => !supportedSet.has(e));
|
|
3130
|
+
if (skipped.length > 0) {
|
|
3131
|
+
logger.warn(
|
|
3132
|
+
`Skipped hook event(s) for ${this.toolTarget} (not supported): ${skipped.join(", ")}`
|
|
3133
|
+
);
|
|
3134
|
+
}
|
|
3135
|
+
const factory = toolHooksFactories.get(this.toolTarget);
|
|
3136
|
+
if (!factory) throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
3137
|
+
const toolHooks = this.toolTarget === "cursor" ? CursorHooks.fromRulesyncHooks({
|
|
3138
|
+
baseDir: this.baseDir,
|
|
3139
|
+
rulesyncHooks,
|
|
3140
|
+
validate: true
|
|
3141
|
+
}) : await ClaudecodeHooks.fromRulesyncHooks({
|
|
3142
|
+
baseDir: this.baseDir,
|
|
3143
|
+
rulesyncHooks,
|
|
3144
|
+
validate: true,
|
|
3145
|
+
global: this.global
|
|
3146
|
+
});
|
|
3147
|
+
return [toolHooks];
|
|
3148
|
+
}
|
|
3149
|
+
async convertToolFilesToRulesyncFiles(toolFiles) {
|
|
3150
|
+
const hooks = toolFiles.filter((f) => f instanceof ToolHooks);
|
|
3151
|
+
return hooks.map((h) => h.toRulesyncHooks());
|
|
3152
|
+
}
|
|
3153
|
+
static getToolTargets({ global = false } = {}) {
|
|
3154
|
+
return global ? hooksProcessorToolTargetsGlobal : hooksProcessorToolTargets;
|
|
3155
|
+
}
|
|
3156
|
+
};
|
|
3157
|
+
|
|
3158
|
+
// src/features/ignore/ignore-processor.ts
|
|
3159
|
+
import { z as z15 } from "zod/mini";
|
|
3160
|
+
|
|
3161
|
+
// src/features/ignore/augmentcode-ignore.ts
|
|
3162
|
+
import { join as join23 } from "path";
|
|
3163
|
+
|
|
3164
|
+
// src/features/ignore/rulesync-ignore.ts
|
|
3165
|
+
import { join as join22 } from "path";
|
|
3166
|
+
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
3167
|
+
validate() {
|
|
3168
|
+
return { success: true, error: null };
|
|
3169
|
+
}
|
|
3170
|
+
static getSettablePaths() {
|
|
3171
|
+
return {
|
|
3172
|
+
recommended: {
|
|
3173
|
+
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
3174
|
+
relativeFilePath: RULESYNC_AIIGNORE_FILE_NAME
|
|
3175
|
+
},
|
|
3176
|
+
legacy: {
|
|
3177
|
+
relativeDirPath: ".",
|
|
3178
|
+
relativeFilePath: RULESYNC_IGNORE_RELATIVE_FILE_PATH
|
|
3179
|
+
}
|
|
3180
|
+
};
|
|
3181
|
+
}
|
|
3182
|
+
static async fromFile() {
|
|
3183
|
+
const baseDir = process.cwd();
|
|
3184
|
+
const paths = this.getSettablePaths();
|
|
3185
|
+
const recommendedPath = join22(
|
|
3186
|
+
baseDir,
|
|
3187
|
+
paths.recommended.relativeDirPath,
|
|
3188
|
+
paths.recommended.relativeFilePath
|
|
3189
|
+
);
|
|
3190
|
+
const legacyPath = join22(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
3191
|
+
if (await fileExists(recommendedPath)) {
|
|
3192
|
+
const fileContent2 = await readFileContent(recommendedPath);
|
|
3193
|
+
return new _RulesyncIgnore({
|
|
3194
|
+
baseDir,
|
|
3195
|
+
relativeDirPath: paths.recommended.relativeDirPath,
|
|
3196
|
+
relativeFilePath: paths.recommended.relativeFilePath,
|
|
3197
|
+
fileContent: fileContent2
|
|
3198
|
+
});
|
|
3199
|
+
}
|
|
3200
|
+
if (await fileExists(legacyPath)) {
|
|
3201
|
+
const fileContent2 = await readFileContent(legacyPath);
|
|
3202
|
+
return new _RulesyncIgnore({
|
|
3203
|
+
baseDir,
|
|
3204
|
+
relativeDirPath: paths.legacy.relativeDirPath,
|
|
3205
|
+
relativeFilePath: paths.legacy.relativeFilePath,
|
|
3206
|
+
fileContent: fileContent2
|
|
3207
|
+
});
|
|
3208
|
+
}
|
|
3209
|
+
const fileContent = await readFileContent(recommendedPath);
|
|
3210
|
+
return new _RulesyncIgnore({
|
|
3211
|
+
baseDir,
|
|
3212
|
+
relativeDirPath: paths.recommended.relativeDirPath,
|
|
3213
|
+
relativeFilePath: paths.recommended.relativeFilePath,
|
|
3214
|
+
fileContent
|
|
3215
|
+
});
|
|
3216
|
+
}
|
|
3217
|
+
};
|
|
3218
|
+
|
|
3219
|
+
// src/features/ignore/tool-ignore.ts
|
|
3220
|
+
var ToolIgnore = class extends ToolFile {
|
|
3221
|
+
patterns;
|
|
3222
|
+
constructor(params) {
|
|
3223
|
+
super({
|
|
3224
|
+
...params,
|
|
3225
|
+
validate: true
|
|
3226
|
+
});
|
|
3227
|
+
this.patterns = this.fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
3228
|
+
if (params.validate) {
|
|
3229
|
+
const result = this.validate();
|
|
3230
|
+
if (!result.success) {
|
|
3231
|
+
throw result.error;
|
|
3232
|
+
}
|
|
3233
|
+
}
|
|
3234
|
+
}
|
|
3235
|
+
static getSettablePaths() {
|
|
3236
|
+
throw new Error("Please implement this method in the subclass.");
|
|
3237
|
+
}
|
|
3238
|
+
getPatterns() {
|
|
3239
|
+
return this.patterns;
|
|
3240
|
+
}
|
|
3241
|
+
validate() {
|
|
3242
|
+
return { success: true, error: null };
|
|
3243
|
+
}
|
|
3244
|
+
static fromRulesyncIgnore(_params) {
|
|
3245
|
+
throw new Error("Please implement this method in the subclass.");
|
|
3246
|
+
}
|
|
3247
|
+
toRulesyncIgnoreDefault() {
|
|
3248
|
+
return new RulesyncIgnore({
|
|
3249
|
+
baseDir: ".",
|
|
3250
|
+
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
3251
|
+
relativeFilePath: RULESYNC_AIIGNORE_FILE_NAME,
|
|
3252
|
+
fileContent: this.fileContent
|
|
3253
|
+
});
|
|
3254
|
+
}
|
|
3255
|
+
static async fromFile(_params) {
|
|
3256
|
+
throw new Error("Please implement this method in the subclass.");
|
|
3257
|
+
}
|
|
3258
|
+
/**
|
|
3259
|
+
* Create a minimal instance for deletion purposes.
|
|
3260
|
+
* This method does not read or parse file content, making it safe to use
|
|
3261
|
+
* even when files have old/incompatible formats.
|
|
3262
|
+
*/
|
|
3263
|
+
static forDeletion(_params) {
|
|
3264
|
+
throw new Error("Please implement this method in the subclass.");
|
|
3265
|
+
}
|
|
3266
|
+
};
|
|
3267
|
+
|
|
3268
|
+
// src/features/ignore/augmentcode-ignore.ts
|
|
3269
|
+
var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
3270
|
+
static getSettablePaths() {
|
|
3271
|
+
return {
|
|
3272
|
+
relativeDirPath: ".",
|
|
3273
|
+
relativeFilePath: ".augmentignore"
|
|
3274
|
+
};
|
|
3275
|
+
}
|
|
3276
|
+
/**
|
|
3277
|
+
* Convert to RulesyncIgnore format
|
|
3278
|
+
*/
|
|
3279
|
+
toRulesyncIgnore() {
|
|
3280
|
+
return this.toRulesyncIgnoreDefault();
|
|
3281
|
+
}
|
|
3282
|
+
/**
|
|
3283
|
+
* Create AugmentcodeIgnore from RulesyncIgnore
|
|
3284
|
+
* Supports conversion from unified rulesync format to AugmentCode specific format
|
|
3285
|
+
*/
|
|
3286
|
+
static fromRulesyncIgnore({
|
|
3287
|
+
baseDir = process.cwd(),
|
|
3288
|
+
rulesyncIgnore
|
|
3289
|
+
}) {
|
|
3290
|
+
return new _AugmentcodeIgnore({
|
|
3291
|
+
baseDir,
|
|
3292
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
3293
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
3294
|
+
fileContent: rulesyncIgnore.getFileContent()
|
|
3295
|
+
});
|
|
3296
|
+
}
|
|
3297
|
+
/**
|
|
3298
|
+
* Create AugmentcodeIgnore from file path
|
|
3299
|
+
* Reads and parses .augmentignore file
|
|
3300
|
+
*/
|
|
3301
|
+
static async fromFile({
|
|
3302
|
+
baseDir = process.cwd(),
|
|
3303
|
+
validate = true
|
|
3304
|
+
}) {
|
|
3305
|
+
const fileContent = await readFileContent(
|
|
3306
|
+
join23(
|
|
3307
|
+
baseDir,
|
|
3308
|
+
this.getSettablePaths().relativeDirPath,
|
|
3309
|
+
this.getSettablePaths().relativeFilePath
|
|
3310
|
+
)
|
|
3311
|
+
);
|
|
3312
|
+
return new _AugmentcodeIgnore({
|
|
3313
|
+
baseDir,
|
|
3314
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
3315
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
3316
|
+
fileContent,
|
|
3317
|
+
validate
|
|
3318
|
+
});
|
|
3319
|
+
}
|
|
3320
|
+
static forDeletion({
|
|
3321
|
+
baseDir = process.cwd(),
|
|
3322
|
+
relativeDirPath,
|
|
3323
|
+
relativeFilePath
|
|
3324
|
+
}) {
|
|
3325
|
+
return new _AugmentcodeIgnore({
|
|
3326
|
+
baseDir,
|
|
3327
|
+
relativeDirPath,
|
|
3328
|
+
relativeFilePath,
|
|
3329
|
+
fileContent: "",
|
|
3330
|
+
validate: false
|
|
3331
|
+
});
|
|
3332
|
+
}
|
|
3333
|
+
};
|
|
3334
|
+
|
|
3335
|
+
// src/features/ignore/claudecode-ignore.ts
|
|
3336
|
+
import { uniq } from "es-toolkit";
|
|
3337
|
+
import { join as join24 } from "path";
|
|
3338
|
+
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
3339
|
+
constructor(params) {
|
|
3340
|
+
super(params);
|
|
3341
|
+
const jsonValue = JSON.parse(this.fileContent);
|
|
3342
|
+
this.patterns = jsonValue.permissions?.deny ?? [];
|
|
3343
|
+
}
|
|
3344
|
+
static getSettablePaths() {
|
|
3345
|
+
return {
|
|
3346
|
+
relativeDirPath: ".claude",
|
|
3347
|
+
relativeFilePath: "settings.local.json"
|
|
3348
|
+
};
|
|
3349
|
+
}
|
|
3350
|
+
/**
|
|
3351
|
+
* ClaudecodeIgnore uses settings.local.json which is a user-managed config file.
|
|
3352
|
+
* It should not be deleted by rulesync.
|
|
3353
|
+
*/
|
|
3354
|
+
isDeletable() {
|
|
3355
|
+
return false;
|
|
3356
|
+
}
|
|
3357
|
+
toRulesyncIgnore() {
|
|
3358
|
+
const rulesyncPatterns = this.patterns.map((pattern) => {
|
|
3359
|
+
if (pattern.startsWith("Read(") && pattern.endsWith(")")) {
|
|
3360
|
+
return pattern.slice(5, -1);
|
|
3361
|
+
}
|
|
3362
|
+
return pattern;
|
|
3363
|
+
}).filter((pattern) => pattern.length > 0);
|
|
3364
|
+
const fileContent = rulesyncPatterns.join("\n");
|
|
3365
|
+
return new RulesyncIgnore({
|
|
3366
|
+
baseDir: this.baseDir,
|
|
3367
|
+
relativeDirPath: RulesyncIgnore.getSettablePaths().recommended.relativeDirPath,
|
|
3368
|
+
relativeFilePath: RulesyncIgnore.getSettablePaths().recommended.relativeFilePath,
|
|
3369
|
+
fileContent
|
|
3370
|
+
});
|
|
3371
|
+
}
|
|
3372
|
+
static async fromRulesyncIgnore({
|
|
3373
|
+
baseDir = process.cwd(),
|
|
3374
|
+
rulesyncIgnore
|
|
3375
|
+
}) {
|
|
3376
|
+
const fileContent = rulesyncIgnore.getFileContent();
|
|
3377
|
+
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
2807
3378
|
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
2808
|
-
const filePath =
|
|
3379
|
+
const filePath = join24(
|
|
2809
3380
|
baseDir,
|
|
2810
3381
|
this.getSettablePaths().relativeDirPath,
|
|
2811
3382
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2841,7 +3412,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2841
3412
|
validate = true
|
|
2842
3413
|
}) {
|
|
2843
3414
|
const fileContent = await readFileContent(
|
|
2844
|
-
|
|
3415
|
+
join24(
|
|
2845
3416
|
baseDir,
|
|
2846
3417
|
this.getSettablePaths().relativeDirPath,
|
|
2847
3418
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2871,7 +3442,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2871
3442
|
};
|
|
2872
3443
|
|
|
2873
3444
|
// src/features/ignore/cline-ignore.ts
|
|
2874
|
-
import { join as
|
|
3445
|
+
import { join as join25 } from "path";
|
|
2875
3446
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
2876
3447
|
static getSettablePaths() {
|
|
2877
3448
|
return {
|
|
@@ -2908,7 +3479,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2908
3479
|
validate = true
|
|
2909
3480
|
}) {
|
|
2910
3481
|
const fileContent = await readFileContent(
|
|
2911
|
-
|
|
3482
|
+
join25(
|
|
2912
3483
|
baseDir,
|
|
2913
3484
|
this.getSettablePaths().relativeDirPath,
|
|
2914
3485
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2938,7 +3509,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2938
3509
|
};
|
|
2939
3510
|
|
|
2940
3511
|
// src/features/ignore/cursor-ignore.ts
|
|
2941
|
-
import { join as
|
|
3512
|
+
import { join as join26 } from "path";
|
|
2942
3513
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
2943
3514
|
static getSettablePaths() {
|
|
2944
3515
|
return {
|
|
@@ -2971,7 +3542,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2971
3542
|
validate = true
|
|
2972
3543
|
}) {
|
|
2973
3544
|
const fileContent = await readFileContent(
|
|
2974
|
-
|
|
3545
|
+
join26(
|
|
2975
3546
|
baseDir,
|
|
2976
3547
|
this.getSettablePaths().relativeDirPath,
|
|
2977
3548
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3001,7 +3572,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
3001
3572
|
};
|
|
3002
3573
|
|
|
3003
3574
|
// src/features/ignore/geminicli-ignore.ts
|
|
3004
|
-
import { join as
|
|
3575
|
+
import { join as join27 } from "path";
|
|
3005
3576
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
3006
3577
|
static getSettablePaths() {
|
|
3007
3578
|
return {
|
|
@@ -3028,7 +3599,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
3028
3599
|
validate = true
|
|
3029
3600
|
}) {
|
|
3030
3601
|
const fileContent = await readFileContent(
|
|
3031
|
-
|
|
3602
|
+
join27(
|
|
3032
3603
|
baseDir,
|
|
3033
3604
|
this.getSettablePaths().relativeDirPath,
|
|
3034
3605
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3058,7 +3629,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
3058
3629
|
};
|
|
3059
3630
|
|
|
3060
3631
|
// src/features/ignore/junie-ignore.ts
|
|
3061
|
-
import { join as
|
|
3632
|
+
import { join as join28 } from "path";
|
|
3062
3633
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
3063
3634
|
static getSettablePaths() {
|
|
3064
3635
|
return {
|
|
@@ -3085,7 +3656,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
3085
3656
|
validate = true
|
|
3086
3657
|
}) {
|
|
3087
3658
|
const fileContent = await readFileContent(
|
|
3088
|
-
|
|
3659
|
+
join28(
|
|
3089
3660
|
baseDir,
|
|
3090
3661
|
this.getSettablePaths().relativeDirPath,
|
|
3091
3662
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3115,7 +3686,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
3115
3686
|
};
|
|
3116
3687
|
|
|
3117
3688
|
// src/features/ignore/kilo-ignore.ts
|
|
3118
|
-
import { join as
|
|
3689
|
+
import { join as join29 } from "path";
|
|
3119
3690
|
var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
3120
3691
|
static getSettablePaths() {
|
|
3121
3692
|
return {
|
|
@@ -3152,7 +3723,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
3152
3723
|
validate = true
|
|
3153
3724
|
}) {
|
|
3154
3725
|
const fileContent = await readFileContent(
|
|
3155
|
-
|
|
3726
|
+
join29(
|
|
3156
3727
|
baseDir,
|
|
3157
3728
|
this.getSettablePaths().relativeDirPath,
|
|
3158
3729
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3182,7 +3753,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
3182
3753
|
};
|
|
3183
3754
|
|
|
3184
3755
|
// src/features/ignore/kiro-ignore.ts
|
|
3185
|
-
import { join as
|
|
3756
|
+
import { join as join30 } from "path";
|
|
3186
3757
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
3187
3758
|
static getSettablePaths() {
|
|
3188
3759
|
return {
|
|
@@ -3209,7 +3780,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
3209
3780
|
validate = true
|
|
3210
3781
|
}) {
|
|
3211
3782
|
const fileContent = await readFileContent(
|
|
3212
|
-
|
|
3783
|
+
join30(
|
|
3213
3784
|
baseDir,
|
|
3214
3785
|
this.getSettablePaths().relativeDirPath,
|
|
3215
3786
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3239,7 +3810,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
3239
3810
|
};
|
|
3240
3811
|
|
|
3241
3812
|
// src/features/ignore/qwencode-ignore.ts
|
|
3242
|
-
import { join as
|
|
3813
|
+
import { join as join31 } from "path";
|
|
3243
3814
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
3244
3815
|
static getSettablePaths() {
|
|
3245
3816
|
return {
|
|
@@ -3266,7 +3837,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
3266
3837
|
validate = true
|
|
3267
3838
|
}) {
|
|
3268
3839
|
const fileContent = await readFileContent(
|
|
3269
|
-
|
|
3840
|
+
join31(
|
|
3270
3841
|
baseDir,
|
|
3271
3842
|
this.getSettablePaths().relativeDirPath,
|
|
3272
3843
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3296,7 +3867,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
3296
3867
|
};
|
|
3297
3868
|
|
|
3298
3869
|
// src/features/ignore/roo-ignore.ts
|
|
3299
|
-
import { join as
|
|
3870
|
+
import { join as join32 } from "path";
|
|
3300
3871
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
3301
3872
|
static getSettablePaths() {
|
|
3302
3873
|
return {
|
|
@@ -3323,7 +3894,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
3323
3894
|
validate = true
|
|
3324
3895
|
}) {
|
|
3325
3896
|
const fileContent = await readFileContent(
|
|
3326
|
-
|
|
3897
|
+
join32(
|
|
3327
3898
|
baseDir,
|
|
3328
3899
|
this.getSettablePaths().relativeDirPath,
|
|
3329
3900
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3353,7 +3924,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
3353
3924
|
};
|
|
3354
3925
|
|
|
3355
3926
|
// src/features/ignore/windsurf-ignore.ts
|
|
3356
|
-
import { join as
|
|
3927
|
+
import { join as join33 } from "path";
|
|
3357
3928
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
3358
3929
|
static getSettablePaths() {
|
|
3359
3930
|
return {
|
|
@@ -3380,7 +3951,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3380
3951
|
validate = true
|
|
3381
3952
|
}) {
|
|
3382
3953
|
const fileContent = await readFileContent(
|
|
3383
|
-
|
|
3954
|
+
join33(
|
|
3384
3955
|
baseDir,
|
|
3385
3956
|
this.getSettablePaths().relativeDirPath,
|
|
3386
3957
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3411,7 +3982,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3411
3982
|
|
|
3412
3983
|
// src/features/ignore/zed-ignore.ts
|
|
3413
3984
|
import { uniq as uniq2 } from "es-toolkit";
|
|
3414
|
-
import { join as
|
|
3985
|
+
import { join as join34 } from "path";
|
|
3415
3986
|
var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
3416
3987
|
constructor(params) {
|
|
3417
3988
|
super(params);
|
|
@@ -3447,7 +4018,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
3447
4018
|
}) {
|
|
3448
4019
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
3449
4020
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
3450
|
-
const filePath =
|
|
4021
|
+
const filePath = join34(
|
|
3451
4022
|
baseDir,
|
|
3452
4023
|
this.getSettablePaths().relativeDirPath,
|
|
3453
4024
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3474,7 +4045,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
3474
4045
|
validate = true
|
|
3475
4046
|
}) {
|
|
3476
4047
|
const fileContent = await readFileContent(
|
|
3477
|
-
|
|
4048
|
+
join34(
|
|
3478
4049
|
baseDir,
|
|
3479
4050
|
this.getSettablePaths().relativeDirPath,
|
|
3480
4051
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3519,7 +4090,7 @@ var ignoreProcessorToolTargets = [
|
|
|
3519
4090
|
"windsurf",
|
|
3520
4091
|
"zed"
|
|
3521
4092
|
];
|
|
3522
|
-
var IgnoreProcessorToolTargetSchema =
|
|
4093
|
+
var IgnoreProcessorToolTargetSchema = z15.enum(ignoreProcessorToolTargets);
|
|
3523
4094
|
var toolIgnoreFactories = /* @__PURE__ */ new Map([
|
|
3524
4095
|
["augmentcode", { class: AugmentcodeIgnore }],
|
|
3525
4096
|
["claudecode", { class: ClaudecodeIgnore }],
|
|
@@ -3653,45 +4224,45 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
3653
4224
|
};
|
|
3654
4225
|
|
|
3655
4226
|
// src/features/mcp/mcp-processor.ts
|
|
3656
|
-
import { z as
|
|
4227
|
+
import { z as z20 } from "zod/mini";
|
|
3657
4228
|
|
|
3658
4229
|
// src/features/mcp/claudecode-mcp.ts
|
|
3659
|
-
import { join as
|
|
4230
|
+
import { join as join37 } from "path";
|
|
3660
4231
|
|
|
3661
4232
|
// src/features/mcp/modular-mcp.ts
|
|
3662
|
-
import { join as
|
|
3663
|
-
import { z as
|
|
4233
|
+
import { join as join35 } from "path";
|
|
4234
|
+
import { z as z17 } from "zod/mini";
|
|
3664
4235
|
|
|
3665
4236
|
// src/types/mcp.ts
|
|
3666
|
-
import { z as
|
|
3667
|
-
var McpServerSchema =
|
|
3668
|
-
type:
|
|
3669
|
-
command:
|
|
3670
|
-
args:
|
|
3671
|
-
url:
|
|
3672
|
-
httpUrl:
|
|
3673
|
-
env:
|
|
3674
|
-
disabled:
|
|
3675
|
-
networkTimeout:
|
|
3676
|
-
timeout:
|
|
3677
|
-
trust:
|
|
3678
|
-
cwd:
|
|
3679
|
-
transport:
|
|
3680
|
-
alwaysAllow:
|
|
3681
|
-
tools:
|
|
3682
|
-
kiroAutoApprove:
|
|
3683
|
-
kiroAutoBlock:
|
|
3684
|
-
headers:
|
|
4237
|
+
import { z as z16 } from "zod/mini";
|
|
4238
|
+
var McpServerSchema = z16.object({
|
|
4239
|
+
type: z16.optional(z16.enum(["stdio", "sse", "http"])),
|
|
4240
|
+
command: z16.optional(z16.union([z16.string(), z16.array(z16.string())])),
|
|
4241
|
+
args: z16.optional(z16.array(z16.string())),
|
|
4242
|
+
url: z16.optional(z16.string()),
|
|
4243
|
+
httpUrl: z16.optional(z16.string()),
|
|
4244
|
+
env: z16.optional(z16.record(z16.string(), z16.string())),
|
|
4245
|
+
disabled: z16.optional(z16.boolean()),
|
|
4246
|
+
networkTimeout: z16.optional(z16.number()),
|
|
4247
|
+
timeout: z16.optional(z16.number()),
|
|
4248
|
+
trust: z16.optional(z16.boolean()),
|
|
4249
|
+
cwd: z16.optional(z16.string()),
|
|
4250
|
+
transport: z16.optional(z16.enum(["stdio", "sse", "http"])),
|
|
4251
|
+
alwaysAllow: z16.optional(z16.array(z16.string())),
|
|
4252
|
+
tools: z16.optional(z16.array(z16.string())),
|
|
4253
|
+
kiroAutoApprove: z16.optional(z16.array(z16.string())),
|
|
4254
|
+
kiroAutoBlock: z16.optional(z16.array(z16.string())),
|
|
4255
|
+
headers: z16.optional(z16.record(z16.string(), z16.string()))
|
|
3685
4256
|
});
|
|
3686
|
-
var McpServersSchema =
|
|
4257
|
+
var McpServersSchema = z16.record(z16.string(), McpServerSchema);
|
|
3687
4258
|
|
|
3688
4259
|
// src/features/mcp/modular-mcp.ts
|
|
3689
|
-
var ModularMcpServerSchema =
|
|
3690
|
-
description:
|
|
4260
|
+
var ModularMcpServerSchema = z17.extend(McpServerSchema, {
|
|
4261
|
+
description: z17.string()
|
|
3691
4262
|
// Required for modular-mcp
|
|
3692
4263
|
});
|
|
3693
|
-
var ModularMcpConfigSchema =
|
|
3694
|
-
mcpServers:
|
|
4264
|
+
var ModularMcpConfigSchema = z17.object({
|
|
4265
|
+
mcpServers: z17.record(z17.string(), ModularMcpServerSchema)
|
|
3695
4266
|
});
|
|
3696
4267
|
var ModularMcp = class _ModularMcp extends AiFile {
|
|
3697
4268
|
json;
|
|
@@ -3747,7 +4318,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3747
4318
|
args: [
|
|
3748
4319
|
"-y",
|
|
3749
4320
|
"@kimuson/modular-mcp",
|
|
3750
|
-
|
|
4321
|
+
join35(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3751
4322
|
],
|
|
3752
4323
|
env: {}
|
|
3753
4324
|
}
|
|
@@ -3785,22 +4356,22 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3785
4356
|
|
|
3786
4357
|
// src/features/mcp/rulesync-mcp.ts
|
|
3787
4358
|
import { omit } from "es-toolkit/object";
|
|
3788
|
-
import { join as
|
|
3789
|
-
import { z as
|
|
3790
|
-
var RulesyncMcpServerSchema =
|
|
3791
|
-
|
|
3792
|
-
targets:
|
|
3793
|
-
description:
|
|
3794
|
-
exposed:
|
|
4359
|
+
import { join as join36 } from "path";
|
|
4360
|
+
import { z as z18 } from "zod/mini";
|
|
4361
|
+
var RulesyncMcpServerSchema = z18.union([
|
|
4362
|
+
z18.extend(McpServerSchema, {
|
|
4363
|
+
targets: z18.optional(RulesyncTargetsSchema),
|
|
4364
|
+
description: z18.optional(z18.string()),
|
|
4365
|
+
exposed: z18.optional(z18.literal(false))
|
|
3795
4366
|
}),
|
|
3796
|
-
|
|
3797
|
-
targets:
|
|
3798
|
-
description:
|
|
3799
|
-
exposed:
|
|
4367
|
+
z18.extend(McpServerSchema, {
|
|
4368
|
+
targets: z18.optional(RulesyncTargetsSchema),
|
|
4369
|
+
description: z18.undefined(),
|
|
4370
|
+
exposed: z18.literal(true)
|
|
3800
4371
|
})
|
|
3801
4372
|
]);
|
|
3802
|
-
var RulesyncMcpConfigSchema =
|
|
3803
|
-
mcpServers:
|
|
4373
|
+
var RulesyncMcpConfigSchema = z18.object({
|
|
4374
|
+
mcpServers: z18.record(z18.string(), RulesyncMcpServerSchema)
|
|
3804
4375
|
});
|
|
3805
4376
|
var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
3806
4377
|
json;
|
|
@@ -3841,12 +4412,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
3841
4412
|
}) {
|
|
3842
4413
|
const baseDir = process.cwd();
|
|
3843
4414
|
const paths = this.getSettablePaths();
|
|
3844
|
-
const recommendedPath =
|
|
4415
|
+
const recommendedPath = join36(
|
|
3845
4416
|
baseDir,
|
|
3846
4417
|
paths.recommended.relativeDirPath,
|
|
3847
4418
|
paths.recommended.relativeFilePath
|
|
3848
4419
|
);
|
|
3849
|
-
const legacyPath =
|
|
4420
|
+
const legacyPath = join36(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
3850
4421
|
if (await fileExists(recommendedPath)) {
|
|
3851
4422
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
3852
4423
|
return new _RulesyncMcp({
|
|
@@ -3990,7 +4561,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3990
4561
|
}) {
|
|
3991
4562
|
const paths = this.getSettablePaths({ global });
|
|
3992
4563
|
const fileContent = await readOrInitializeFileContent(
|
|
3993
|
-
|
|
4564
|
+
join37(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3994
4565
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3995
4566
|
);
|
|
3996
4567
|
const json = JSON.parse(fileContent);
|
|
@@ -4012,7 +4583,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
4012
4583
|
}) {
|
|
4013
4584
|
const paths = this.getSettablePaths({ global });
|
|
4014
4585
|
const fileContent = await readOrInitializeFileContent(
|
|
4015
|
-
|
|
4586
|
+
join37(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4016
4587
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4017
4588
|
);
|
|
4018
4589
|
const json = JSON.parse(fileContent);
|
|
@@ -4062,7 +4633,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
4062
4633
|
};
|
|
4063
4634
|
|
|
4064
4635
|
// src/features/mcp/cline-mcp.ts
|
|
4065
|
-
import { join as
|
|
4636
|
+
import { join as join38 } from "path";
|
|
4066
4637
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
4067
4638
|
json;
|
|
4068
4639
|
constructor(params) {
|
|
@@ -4083,7 +4654,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
4083
4654
|
validate = true
|
|
4084
4655
|
}) {
|
|
4085
4656
|
const fileContent = await readFileContent(
|
|
4086
|
-
|
|
4657
|
+
join38(
|
|
4087
4658
|
baseDir,
|
|
4088
4659
|
this.getSettablePaths().relativeDirPath,
|
|
4089
4660
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4132,7 +4703,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
4132
4703
|
};
|
|
4133
4704
|
|
|
4134
4705
|
// src/features/mcp/codexcli-mcp.ts
|
|
4135
|
-
import { join as
|
|
4706
|
+
import { join as join39 } from "path";
|
|
4136
4707
|
import * as smolToml from "smol-toml";
|
|
4137
4708
|
var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
4138
4709
|
toml;
|
|
@@ -4168,7 +4739,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4168
4739
|
}) {
|
|
4169
4740
|
const paths = this.getSettablePaths({ global });
|
|
4170
4741
|
const fileContent = await readFileContent(
|
|
4171
|
-
|
|
4742
|
+
join39(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
4172
4743
|
);
|
|
4173
4744
|
return new _CodexcliMcp({
|
|
4174
4745
|
baseDir,
|
|
@@ -4185,7 +4756,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4185
4756
|
global = false
|
|
4186
4757
|
}) {
|
|
4187
4758
|
const paths = this.getSettablePaths({ global });
|
|
4188
|
-
const configTomlFilePath =
|
|
4759
|
+
const configTomlFilePath = join39(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
4189
4760
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
4190
4761
|
configTomlFilePath,
|
|
4191
4762
|
smolToml.stringify({})
|
|
@@ -4239,7 +4810,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
4239
4810
|
};
|
|
4240
4811
|
|
|
4241
4812
|
// src/features/mcp/copilot-mcp.ts
|
|
4242
|
-
import { join as
|
|
4813
|
+
import { join as join40 } from "path";
|
|
4243
4814
|
function convertToCopilotFormat(mcpServers) {
|
|
4244
4815
|
return { servers: mcpServers };
|
|
4245
4816
|
}
|
|
@@ -4266,7 +4837,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
4266
4837
|
validate = true
|
|
4267
4838
|
}) {
|
|
4268
4839
|
const fileContent = await readFileContent(
|
|
4269
|
-
|
|
4840
|
+
join40(
|
|
4270
4841
|
baseDir,
|
|
4271
4842
|
this.getSettablePaths().relativeDirPath,
|
|
4272
4843
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4319,7 +4890,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
4319
4890
|
};
|
|
4320
4891
|
|
|
4321
4892
|
// src/features/mcp/cursor-mcp.ts
|
|
4322
|
-
import { join as
|
|
4893
|
+
import { join as join41 } from "path";
|
|
4323
4894
|
var CURSOR_ENV_VAR_PATTERN = /\$\{env:([^}]+)\}/g;
|
|
4324
4895
|
function isMcpServers(value) {
|
|
4325
4896
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
@@ -4380,7 +4951,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4380
4951
|
validate = true
|
|
4381
4952
|
}) {
|
|
4382
4953
|
const fileContent = await readFileContent(
|
|
4383
|
-
|
|
4954
|
+
join41(
|
|
4384
4955
|
baseDir,
|
|
4385
4956
|
this.getSettablePaths().relativeDirPath,
|
|
4386
4957
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4448,7 +5019,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4448
5019
|
};
|
|
4449
5020
|
|
|
4450
5021
|
// src/features/mcp/geminicli-mcp.ts
|
|
4451
|
-
import { join as
|
|
5022
|
+
import { join as join42 } from "path";
|
|
4452
5023
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
4453
5024
|
json;
|
|
4454
5025
|
constructor(params) {
|
|
@@ -4477,7 +5048,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4477
5048
|
}) {
|
|
4478
5049
|
const paths = this.getSettablePaths({ global });
|
|
4479
5050
|
const fileContent = await readOrInitializeFileContent(
|
|
4480
|
-
|
|
5051
|
+
join42(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4481
5052
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4482
5053
|
);
|
|
4483
5054
|
const json = JSON.parse(fileContent);
|
|
@@ -4498,7 +5069,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4498
5069
|
}) {
|
|
4499
5070
|
const paths = this.getSettablePaths({ global });
|
|
4500
5071
|
const fileContent = await readOrInitializeFileContent(
|
|
4501
|
-
|
|
5072
|
+
join42(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4502
5073
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4503
5074
|
);
|
|
4504
5075
|
const json = JSON.parse(fileContent);
|
|
@@ -4543,7 +5114,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4543
5114
|
};
|
|
4544
5115
|
|
|
4545
5116
|
// src/features/mcp/junie-mcp.ts
|
|
4546
|
-
import { join as
|
|
5117
|
+
import { join as join43 } from "path";
|
|
4547
5118
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
4548
5119
|
json;
|
|
4549
5120
|
constructor(params) {
|
|
@@ -4555,7 +5126,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4555
5126
|
}
|
|
4556
5127
|
static getSettablePaths() {
|
|
4557
5128
|
return {
|
|
4558
|
-
relativeDirPath:
|
|
5129
|
+
relativeDirPath: join43(".junie", "mcp"),
|
|
4559
5130
|
relativeFilePath: "mcp.json"
|
|
4560
5131
|
};
|
|
4561
5132
|
}
|
|
@@ -4564,7 +5135,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4564
5135
|
validate = true
|
|
4565
5136
|
}) {
|
|
4566
5137
|
const fileContent = await readFileContent(
|
|
4567
|
-
|
|
5138
|
+
join43(
|
|
4568
5139
|
baseDir,
|
|
4569
5140
|
this.getSettablePaths().relativeDirPath,
|
|
4570
5141
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4613,7 +5184,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4613
5184
|
};
|
|
4614
5185
|
|
|
4615
5186
|
// src/features/mcp/kilo-mcp.ts
|
|
4616
|
-
import { join as
|
|
5187
|
+
import { join as join44 } from "path";
|
|
4617
5188
|
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
4618
5189
|
json;
|
|
4619
5190
|
constructor(params) {
|
|
@@ -4635,7 +5206,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4635
5206
|
}) {
|
|
4636
5207
|
const paths = this.getSettablePaths();
|
|
4637
5208
|
const fileContent = await readOrInitializeFileContent(
|
|
4638
|
-
|
|
5209
|
+
join44(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4639
5210
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4640
5211
|
);
|
|
4641
5212
|
return new _KiloMcp({
|
|
@@ -4689,7 +5260,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4689
5260
|
};
|
|
4690
5261
|
|
|
4691
5262
|
// src/features/mcp/kiro-mcp.ts
|
|
4692
|
-
import { join as
|
|
5263
|
+
import { join as join45 } from "path";
|
|
4693
5264
|
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
4694
5265
|
json;
|
|
4695
5266
|
constructor(params) {
|
|
@@ -4701,7 +5272,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4701
5272
|
}
|
|
4702
5273
|
static getSettablePaths() {
|
|
4703
5274
|
return {
|
|
4704
|
-
relativeDirPath:
|
|
5275
|
+
relativeDirPath: join45(".kiro", "settings"),
|
|
4705
5276
|
relativeFilePath: "mcp.json"
|
|
4706
5277
|
};
|
|
4707
5278
|
}
|
|
@@ -4711,7 +5282,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4711
5282
|
}) {
|
|
4712
5283
|
const paths = this.getSettablePaths();
|
|
4713
5284
|
const fileContent = await readOrInitializeFileContent(
|
|
4714
|
-
|
|
5285
|
+
join45(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4715
5286
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4716
5287
|
);
|
|
4717
5288
|
return new _KiroMcp({
|
|
@@ -4764,29 +5335,29 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
4764
5335
|
}
|
|
4765
5336
|
};
|
|
4766
5337
|
|
|
4767
|
-
// src/features/mcp/opencode-mcp.ts
|
|
4768
|
-
import { join as
|
|
4769
|
-
import { z as
|
|
4770
|
-
var OpencodeMcpLocalServerSchema =
|
|
4771
|
-
type:
|
|
4772
|
-
command:
|
|
4773
|
-
environment:
|
|
4774
|
-
enabled:
|
|
4775
|
-
cwd:
|
|
5338
|
+
// src/features/mcp/opencode-mcp.ts
|
|
5339
|
+
import { join as join46 } from "path";
|
|
5340
|
+
import { z as z19 } from "zod/mini";
|
|
5341
|
+
var OpencodeMcpLocalServerSchema = z19.object({
|
|
5342
|
+
type: z19.literal("local"),
|
|
5343
|
+
command: z19.array(z19.string()),
|
|
5344
|
+
environment: z19.optional(z19.record(z19.string(), z19.string())),
|
|
5345
|
+
enabled: z19._default(z19.boolean(), true),
|
|
5346
|
+
cwd: z19.optional(z19.string())
|
|
4776
5347
|
});
|
|
4777
|
-
var OpencodeMcpRemoteServerSchema =
|
|
4778
|
-
type:
|
|
4779
|
-
url:
|
|
4780
|
-
headers:
|
|
4781
|
-
enabled:
|
|
5348
|
+
var OpencodeMcpRemoteServerSchema = z19.object({
|
|
5349
|
+
type: z19.literal("remote"),
|
|
5350
|
+
url: z19.string(),
|
|
5351
|
+
headers: z19.optional(z19.record(z19.string(), z19.string())),
|
|
5352
|
+
enabled: z19._default(z19.boolean(), true)
|
|
4782
5353
|
});
|
|
4783
|
-
var OpencodeMcpServerSchema =
|
|
5354
|
+
var OpencodeMcpServerSchema = z19.union([
|
|
4784
5355
|
OpencodeMcpLocalServerSchema,
|
|
4785
5356
|
OpencodeMcpRemoteServerSchema
|
|
4786
5357
|
]);
|
|
4787
|
-
var OpencodeConfigSchema =
|
|
4788
|
-
$schema:
|
|
4789
|
-
mcp:
|
|
5358
|
+
var OpencodeConfigSchema = z19.looseObject({
|
|
5359
|
+
$schema: z19.optional(z19.string()),
|
|
5360
|
+
mcp: z19.optional(z19.record(z19.string(), OpencodeMcpServerSchema))
|
|
4790
5361
|
});
|
|
4791
5362
|
function convertFromOpencodeFormat(opencodeMcp) {
|
|
4792
5363
|
return Object.fromEntries(
|
|
@@ -4889,7 +5460,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4889
5460
|
}) {
|
|
4890
5461
|
const paths = this.getSettablePaths({ global });
|
|
4891
5462
|
const fileContent = await readOrInitializeFileContent(
|
|
4892
|
-
|
|
5463
|
+
join46(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4893
5464
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4894
5465
|
);
|
|
4895
5466
|
const json = JSON.parse(fileContent);
|
|
@@ -4910,7 +5481,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4910
5481
|
}) {
|
|
4911
5482
|
const paths = this.getSettablePaths({ global });
|
|
4912
5483
|
const fileContent = await readOrInitializeFileContent(
|
|
4913
|
-
|
|
5484
|
+
join46(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4914
5485
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4915
5486
|
);
|
|
4916
5487
|
const json = JSON.parse(fileContent);
|
|
@@ -4956,7 +5527,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4956
5527
|
};
|
|
4957
5528
|
|
|
4958
5529
|
// src/features/mcp/roo-mcp.ts
|
|
4959
|
-
import { join as
|
|
5530
|
+
import { join as join47 } from "path";
|
|
4960
5531
|
function isRooMcpServers(value) {
|
|
4961
5532
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
4962
5533
|
}
|
|
@@ -5008,7 +5579,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
5008
5579
|
validate = true
|
|
5009
5580
|
}) {
|
|
5010
5581
|
const fileContent = await readFileContent(
|
|
5011
|
-
|
|
5582
|
+
join47(
|
|
5012
5583
|
baseDir,
|
|
5013
5584
|
this.getSettablePaths().relativeDirPath,
|
|
5014
5585
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5078,7 +5649,7 @@ var mcpProcessorToolTargetTuple = [
|
|
|
5078
5649
|
"opencode",
|
|
5079
5650
|
"roo"
|
|
5080
5651
|
];
|
|
5081
|
-
var McpProcessorToolTargetSchema =
|
|
5652
|
+
var McpProcessorToolTargetSchema = z20.enum(mcpProcessorToolTargetTuple);
|
|
5082
5653
|
var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
5083
5654
|
[
|
|
5084
5655
|
"claudecode",
|
|
@@ -5323,24 +5894,24 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
5323
5894
|
|
|
5324
5895
|
// src/features/rules/rules-processor.ts
|
|
5325
5896
|
import { encode } from "@toon-format/toon";
|
|
5326
|
-
import { basename as basename22, join as
|
|
5327
|
-
import { z as
|
|
5897
|
+
import { basename as basename22, join as join100, relative as relative4 } from "path";
|
|
5898
|
+
import { z as z48 } from "zod/mini";
|
|
5328
5899
|
|
|
5329
5900
|
// src/constants/general.ts
|
|
5330
5901
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
5331
5902
|
|
|
5332
5903
|
// src/features/skills/agentsmd-skill.ts
|
|
5333
|
-
import { join as
|
|
5904
|
+
import { join as join51 } from "path";
|
|
5334
5905
|
|
|
5335
5906
|
// src/features/skills/simulated-skill.ts
|
|
5336
|
-
import { join as
|
|
5337
|
-
import { z as
|
|
5907
|
+
import { join as join50 } from "path";
|
|
5908
|
+
import { z as z21 } from "zod/mini";
|
|
5338
5909
|
|
|
5339
5910
|
// src/features/skills/tool-skill.ts
|
|
5340
|
-
import { join as
|
|
5911
|
+
import { join as join49 } from "path";
|
|
5341
5912
|
|
|
5342
5913
|
// src/types/ai-dir.ts
|
|
5343
|
-
import path2, { basename as basename16, join as
|
|
5914
|
+
import path2, { basename as basename16, join as join48, relative as relative3, resolve as resolve4 } from "path";
|
|
5344
5915
|
var AiDir = class {
|
|
5345
5916
|
/**
|
|
5346
5917
|
* @example "."
|
|
@@ -5434,8 +6005,8 @@ var AiDir = class {
|
|
|
5434
6005
|
* @returns Array of files with their relative paths and buffers
|
|
5435
6006
|
*/
|
|
5436
6007
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
5437
|
-
const dirPath =
|
|
5438
|
-
const glob =
|
|
6008
|
+
const dirPath = join48(baseDir, relativeDirPath, dirName);
|
|
6009
|
+
const glob = join48(dirPath, "**", "*");
|
|
5439
6010
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
5440
6011
|
const filteredPaths = filePaths.filter((filePath) => basename16(filePath) !== excludeFileName);
|
|
5441
6012
|
const files = await Promise.all(
|
|
@@ -5533,8 +6104,8 @@ var ToolSkill = class extends AiDir {
|
|
|
5533
6104
|
}) {
|
|
5534
6105
|
const settablePaths = getSettablePaths({ global });
|
|
5535
6106
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5536
|
-
const skillDirPath =
|
|
5537
|
-
const skillFilePath =
|
|
6107
|
+
const skillDirPath = join49(baseDir, actualRelativeDirPath, dirName);
|
|
6108
|
+
const skillFilePath = join49(skillDirPath, SKILL_FILE_NAME);
|
|
5538
6109
|
if (!await fileExists(skillFilePath)) {
|
|
5539
6110
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5540
6111
|
}
|
|
@@ -5559,9 +6130,9 @@ var ToolSkill = class extends AiDir {
|
|
|
5559
6130
|
};
|
|
5560
6131
|
|
|
5561
6132
|
// src/features/skills/simulated-skill.ts
|
|
5562
|
-
var SimulatedSkillFrontmatterSchema =
|
|
5563
|
-
name:
|
|
5564
|
-
description:
|
|
6133
|
+
var SimulatedSkillFrontmatterSchema = z21.looseObject({
|
|
6134
|
+
name: z21.string(),
|
|
6135
|
+
description: z21.string()
|
|
5565
6136
|
});
|
|
5566
6137
|
var SimulatedSkill = class extends ToolSkill {
|
|
5567
6138
|
frontmatter;
|
|
@@ -5592,7 +6163,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5592
6163
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
5593
6164
|
if (!result.success) {
|
|
5594
6165
|
throw new Error(
|
|
5595
|
-
`Invalid frontmatter in ${
|
|
6166
|
+
`Invalid frontmatter in ${join50(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
5596
6167
|
);
|
|
5597
6168
|
}
|
|
5598
6169
|
}
|
|
@@ -5650,8 +6221,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5650
6221
|
}) {
|
|
5651
6222
|
const settablePaths = this.getSettablePaths();
|
|
5652
6223
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5653
|
-
const skillDirPath =
|
|
5654
|
-
const skillFilePath =
|
|
6224
|
+
const skillDirPath = join50(baseDir, actualRelativeDirPath, dirName);
|
|
6225
|
+
const skillFilePath = join50(skillDirPath, SKILL_FILE_NAME);
|
|
5655
6226
|
if (!await fileExists(skillFilePath)) {
|
|
5656
6227
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5657
6228
|
}
|
|
@@ -5728,7 +6299,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5728
6299
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
5729
6300
|
}
|
|
5730
6301
|
return {
|
|
5731
|
-
relativeDirPath:
|
|
6302
|
+
relativeDirPath: join51(".agents", "skills")
|
|
5732
6303
|
};
|
|
5733
6304
|
}
|
|
5734
6305
|
static async fromDir(params) {
|
|
@@ -5755,14 +6326,14 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5755
6326
|
};
|
|
5756
6327
|
|
|
5757
6328
|
// src/features/skills/geminicli-skill.ts
|
|
5758
|
-
import { join as
|
|
6329
|
+
import { join as join52 } from "path";
|
|
5759
6330
|
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5760
6331
|
static getSettablePaths(options) {
|
|
5761
6332
|
if (options?.global) {
|
|
5762
6333
|
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5763
6334
|
}
|
|
5764
6335
|
return {
|
|
5765
|
-
relativeDirPath:
|
|
6336
|
+
relativeDirPath: join52(".gemini", "skills")
|
|
5766
6337
|
};
|
|
5767
6338
|
}
|
|
5768
6339
|
static async fromDir(params) {
|
|
@@ -5789,11 +6360,11 @@ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
|
5789
6360
|
};
|
|
5790
6361
|
|
|
5791
6362
|
// src/features/skills/skills-processor.ts
|
|
5792
|
-
import { basename as basename17, join as
|
|
5793
|
-
import { z as
|
|
6363
|
+
import { basename as basename17, join as join65 } from "path";
|
|
6364
|
+
import { z as z33 } from "zod/mini";
|
|
5794
6365
|
|
|
5795
6366
|
// src/types/dir-feature-processor.ts
|
|
5796
|
-
import { join as
|
|
6367
|
+
import { join as join53 } from "path";
|
|
5797
6368
|
var DirFeatureProcessor = class {
|
|
5798
6369
|
baseDir;
|
|
5799
6370
|
constructor({ baseDir = process.cwd() }) {
|
|
@@ -5815,14 +6386,14 @@ var DirFeatureProcessor = class {
|
|
|
5815
6386
|
await ensureDir(dirPath);
|
|
5816
6387
|
const mainFile = aiDir.getMainFile();
|
|
5817
6388
|
if (mainFile) {
|
|
5818
|
-
const mainFilePath =
|
|
6389
|
+
const mainFilePath = join53(dirPath, mainFile.name);
|
|
5819
6390
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5820
6391
|
const contentWithNewline = addTrailingNewline(content);
|
|
5821
6392
|
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5822
6393
|
}
|
|
5823
6394
|
const otherFiles = aiDir.getOtherFiles();
|
|
5824
6395
|
for (const file of otherFiles) {
|
|
5825
|
-
const filePath =
|
|
6396
|
+
const filePath = join53(dirPath, file.relativeFilePathToDirPath);
|
|
5826
6397
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5827
6398
|
await writeFileContent(filePath, contentWithNewline);
|
|
5828
6399
|
}
|
|
@@ -5837,37 +6408,37 @@ var DirFeatureProcessor = class {
|
|
|
5837
6408
|
};
|
|
5838
6409
|
|
|
5839
6410
|
// src/features/skills/antigravity-skill.ts
|
|
5840
|
-
import { join as
|
|
5841
|
-
import { z as
|
|
6411
|
+
import { join as join55 } from "path";
|
|
6412
|
+
import { z as z23 } from "zod/mini";
|
|
5842
6413
|
|
|
5843
6414
|
// src/features/skills/rulesync-skill.ts
|
|
5844
|
-
import { join as
|
|
5845
|
-
import { z as
|
|
5846
|
-
var RulesyncSkillFrontmatterSchemaInternal =
|
|
5847
|
-
name:
|
|
5848
|
-
description:
|
|
5849
|
-
targets:
|
|
5850
|
-
claudecode:
|
|
5851
|
-
|
|
5852
|
-
"allowed-tools":
|
|
6415
|
+
import { join as join54 } from "path";
|
|
6416
|
+
import { z as z22 } from "zod/mini";
|
|
6417
|
+
var RulesyncSkillFrontmatterSchemaInternal = z22.looseObject({
|
|
6418
|
+
name: z22.string(),
|
|
6419
|
+
description: z22.string(),
|
|
6420
|
+
targets: z22._default(RulesyncTargetsSchema, ["*"]),
|
|
6421
|
+
claudecode: z22.optional(
|
|
6422
|
+
z22.looseObject({
|
|
6423
|
+
"allowed-tools": z22.optional(z22.array(z22.string()))
|
|
5853
6424
|
})
|
|
5854
6425
|
),
|
|
5855
|
-
codexcli:
|
|
5856
|
-
|
|
5857
|
-
"short-description":
|
|
6426
|
+
codexcli: z22.optional(
|
|
6427
|
+
z22.looseObject({
|
|
6428
|
+
"short-description": z22.optional(z22.string())
|
|
5858
6429
|
})
|
|
5859
6430
|
),
|
|
5860
|
-
opencode:
|
|
5861
|
-
|
|
5862
|
-
"allowed-tools":
|
|
6431
|
+
opencode: z22.optional(
|
|
6432
|
+
z22.looseObject({
|
|
6433
|
+
"allowed-tools": z22.optional(z22.array(z22.string()))
|
|
5863
6434
|
})
|
|
5864
6435
|
),
|
|
5865
|
-
copilot:
|
|
5866
|
-
|
|
5867
|
-
license:
|
|
6436
|
+
copilot: z22.optional(
|
|
6437
|
+
z22.looseObject({
|
|
6438
|
+
license: z22.optional(z22.string())
|
|
5868
6439
|
})
|
|
5869
6440
|
),
|
|
5870
|
-
roo:
|
|
6441
|
+
roo: z22.optional(z22.looseObject({}))
|
|
5871
6442
|
});
|
|
5872
6443
|
var RulesyncSkillFrontmatterSchema = RulesyncSkillFrontmatterSchemaInternal;
|
|
5873
6444
|
var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
@@ -5933,8 +6504,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5933
6504
|
dirName,
|
|
5934
6505
|
global = false
|
|
5935
6506
|
}) {
|
|
5936
|
-
const skillDirPath =
|
|
5937
|
-
const skillFilePath =
|
|
6507
|
+
const skillDirPath = join54(baseDir, relativeDirPath, dirName);
|
|
6508
|
+
const skillFilePath = join54(skillDirPath, SKILL_FILE_NAME);
|
|
5938
6509
|
if (!await fileExists(skillFilePath)) {
|
|
5939
6510
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5940
6511
|
}
|
|
@@ -5964,14 +6535,14 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5964
6535
|
};
|
|
5965
6536
|
|
|
5966
6537
|
// src/features/skills/antigravity-skill.ts
|
|
5967
|
-
var AntigravitySkillFrontmatterSchema =
|
|
5968
|
-
name:
|
|
5969
|
-
description:
|
|
6538
|
+
var AntigravitySkillFrontmatterSchema = z23.looseObject({
|
|
6539
|
+
name: z23.string(),
|
|
6540
|
+
description: z23.string()
|
|
5970
6541
|
});
|
|
5971
6542
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
5972
6543
|
constructor({
|
|
5973
6544
|
baseDir = process.cwd(),
|
|
5974
|
-
relativeDirPath =
|
|
6545
|
+
relativeDirPath = join55(".agent", "skills"),
|
|
5975
6546
|
dirName,
|
|
5976
6547
|
frontmatter,
|
|
5977
6548
|
body,
|
|
@@ -6003,11 +6574,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
6003
6574
|
} = {}) {
|
|
6004
6575
|
if (global) {
|
|
6005
6576
|
return {
|
|
6006
|
-
relativeDirPath:
|
|
6577
|
+
relativeDirPath: join55(".gemini", "antigravity", "skills")
|
|
6007
6578
|
};
|
|
6008
6579
|
}
|
|
6009
6580
|
return {
|
|
6010
|
-
relativeDirPath:
|
|
6581
|
+
relativeDirPath: join55(".agent", "skills")
|
|
6011
6582
|
};
|
|
6012
6583
|
}
|
|
6013
6584
|
getFrontmatter() {
|
|
@@ -6089,9 +6660,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
6089
6660
|
});
|
|
6090
6661
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6091
6662
|
if (!result.success) {
|
|
6092
|
-
const skillDirPath =
|
|
6663
|
+
const skillDirPath = join55(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6093
6664
|
throw new Error(
|
|
6094
|
-
`Invalid frontmatter in ${
|
|
6665
|
+
`Invalid frontmatter in ${join55(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6095
6666
|
);
|
|
6096
6667
|
}
|
|
6097
6668
|
return new _AntigravitySkill({
|
|
@@ -6125,17 +6696,17 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
6125
6696
|
};
|
|
6126
6697
|
|
|
6127
6698
|
// src/features/skills/claudecode-skill.ts
|
|
6128
|
-
import { join as
|
|
6129
|
-
import { z as
|
|
6130
|
-
var ClaudecodeSkillFrontmatterSchema =
|
|
6131
|
-
name:
|
|
6132
|
-
description:
|
|
6133
|
-
"allowed-tools":
|
|
6699
|
+
import { join as join56 } from "path";
|
|
6700
|
+
import { z as z24 } from "zod/mini";
|
|
6701
|
+
var ClaudecodeSkillFrontmatterSchema = z24.looseObject({
|
|
6702
|
+
name: z24.string(),
|
|
6703
|
+
description: z24.string(),
|
|
6704
|
+
"allowed-tools": z24.optional(z24.array(z24.string()))
|
|
6134
6705
|
});
|
|
6135
6706
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
6136
6707
|
constructor({
|
|
6137
6708
|
baseDir = process.cwd(),
|
|
6138
|
-
relativeDirPath =
|
|
6709
|
+
relativeDirPath = join56(".claude", "skills"),
|
|
6139
6710
|
dirName,
|
|
6140
6711
|
frontmatter,
|
|
6141
6712
|
body,
|
|
@@ -6166,7 +6737,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
6166
6737
|
global: _global = false
|
|
6167
6738
|
} = {}) {
|
|
6168
6739
|
return {
|
|
6169
|
-
relativeDirPath:
|
|
6740
|
+
relativeDirPath: join56(".claude", "skills")
|
|
6170
6741
|
};
|
|
6171
6742
|
}
|
|
6172
6743
|
getFrontmatter() {
|
|
@@ -6254,9 +6825,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
6254
6825
|
});
|
|
6255
6826
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6256
6827
|
if (!result.success) {
|
|
6257
|
-
const skillDirPath =
|
|
6828
|
+
const skillDirPath = join56(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6258
6829
|
throw new Error(
|
|
6259
|
-
`Invalid frontmatter in ${
|
|
6830
|
+
`Invalid frontmatter in ${join56(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6260
6831
|
);
|
|
6261
6832
|
}
|
|
6262
6833
|
return new _ClaudecodeSkill({
|
|
@@ -6290,21 +6861,21 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
6290
6861
|
};
|
|
6291
6862
|
|
|
6292
6863
|
// src/features/skills/codexcli-skill.ts
|
|
6293
|
-
import { join as
|
|
6294
|
-
import { z as
|
|
6295
|
-
var CodexCliSkillFrontmatterSchema =
|
|
6296
|
-
name:
|
|
6297
|
-
description:
|
|
6298
|
-
metadata:
|
|
6299
|
-
|
|
6300
|
-
"short-description":
|
|
6864
|
+
import { join as join57 } from "path";
|
|
6865
|
+
import { z as z25 } from "zod/mini";
|
|
6866
|
+
var CodexCliSkillFrontmatterSchema = z25.looseObject({
|
|
6867
|
+
name: z25.string(),
|
|
6868
|
+
description: z25.string(),
|
|
6869
|
+
metadata: z25.optional(
|
|
6870
|
+
z25.looseObject({
|
|
6871
|
+
"short-description": z25.optional(z25.string())
|
|
6301
6872
|
})
|
|
6302
6873
|
)
|
|
6303
6874
|
});
|
|
6304
6875
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
6305
6876
|
constructor({
|
|
6306
6877
|
baseDir = process.cwd(),
|
|
6307
|
-
relativeDirPath =
|
|
6878
|
+
relativeDirPath = join57(".codex", "skills"),
|
|
6308
6879
|
dirName,
|
|
6309
6880
|
frontmatter,
|
|
6310
6881
|
body,
|
|
@@ -6335,7 +6906,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6335
6906
|
global: _global = false
|
|
6336
6907
|
} = {}) {
|
|
6337
6908
|
return {
|
|
6338
|
-
relativeDirPath:
|
|
6909
|
+
relativeDirPath: join57(".codex", "skills")
|
|
6339
6910
|
};
|
|
6340
6911
|
}
|
|
6341
6912
|
getFrontmatter() {
|
|
@@ -6427,9 +6998,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6427
6998
|
});
|
|
6428
6999
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6429
7000
|
if (!result.success) {
|
|
6430
|
-
const skillDirPath =
|
|
7001
|
+
const skillDirPath = join57(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6431
7002
|
throw new Error(
|
|
6432
|
-
`Invalid frontmatter in ${
|
|
7003
|
+
`Invalid frontmatter in ${join57(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6433
7004
|
);
|
|
6434
7005
|
}
|
|
6435
7006
|
return new _CodexCliSkill({
|
|
@@ -6463,17 +7034,17 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
6463
7034
|
};
|
|
6464
7035
|
|
|
6465
7036
|
// src/features/skills/copilot-skill.ts
|
|
6466
|
-
import { join as
|
|
6467
|
-
import { z as
|
|
6468
|
-
var CopilotSkillFrontmatterSchema =
|
|
6469
|
-
name:
|
|
6470
|
-
description:
|
|
6471
|
-
license:
|
|
7037
|
+
import { join as join58 } from "path";
|
|
7038
|
+
import { z as z26 } from "zod/mini";
|
|
7039
|
+
var CopilotSkillFrontmatterSchema = z26.looseObject({
|
|
7040
|
+
name: z26.string(),
|
|
7041
|
+
description: z26.string(),
|
|
7042
|
+
license: z26.optional(z26.string())
|
|
6472
7043
|
});
|
|
6473
7044
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
6474
7045
|
constructor({
|
|
6475
7046
|
baseDir = process.cwd(),
|
|
6476
|
-
relativeDirPath =
|
|
7047
|
+
relativeDirPath = join58(".github", "skills"),
|
|
6477
7048
|
dirName,
|
|
6478
7049
|
frontmatter,
|
|
6479
7050
|
body,
|
|
@@ -6505,7 +7076,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6505
7076
|
throw new Error("CopilotSkill does not support global mode.");
|
|
6506
7077
|
}
|
|
6507
7078
|
return {
|
|
6508
|
-
relativeDirPath:
|
|
7079
|
+
relativeDirPath: join58(".github", "skills")
|
|
6509
7080
|
};
|
|
6510
7081
|
}
|
|
6511
7082
|
getFrontmatter() {
|
|
@@ -6593,9 +7164,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6593
7164
|
});
|
|
6594
7165
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6595
7166
|
if (!result.success) {
|
|
6596
|
-
const skillDirPath =
|
|
7167
|
+
const skillDirPath = join58(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6597
7168
|
throw new Error(
|
|
6598
|
-
`Invalid frontmatter in ${
|
|
7169
|
+
`Invalid frontmatter in ${join58(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6599
7170
|
);
|
|
6600
7171
|
}
|
|
6601
7172
|
return new _CopilotSkill({
|
|
@@ -6630,16 +7201,16 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6630
7201
|
};
|
|
6631
7202
|
|
|
6632
7203
|
// src/features/skills/cursor-skill.ts
|
|
6633
|
-
import { join as
|
|
6634
|
-
import { z as
|
|
6635
|
-
var CursorSkillFrontmatterSchema =
|
|
6636
|
-
name:
|
|
6637
|
-
description:
|
|
7204
|
+
import { join as join59 } from "path";
|
|
7205
|
+
import { z as z27 } from "zod/mini";
|
|
7206
|
+
var CursorSkillFrontmatterSchema = z27.looseObject({
|
|
7207
|
+
name: z27.string(),
|
|
7208
|
+
description: z27.string()
|
|
6638
7209
|
});
|
|
6639
7210
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
6640
7211
|
constructor({
|
|
6641
7212
|
baseDir = process.cwd(),
|
|
6642
|
-
relativeDirPath =
|
|
7213
|
+
relativeDirPath = join59(".cursor", "skills"),
|
|
6643
7214
|
dirName,
|
|
6644
7215
|
frontmatter,
|
|
6645
7216
|
body,
|
|
@@ -6666,12 +7237,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6666
7237
|
}
|
|
6667
7238
|
}
|
|
6668
7239
|
}
|
|
6669
|
-
static getSettablePaths(
|
|
6670
|
-
if (options?.global) {
|
|
6671
|
-
throw new Error("CursorSkill does not support global mode.");
|
|
6672
|
-
}
|
|
7240
|
+
static getSettablePaths(_options) {
|
|
6673
7241
|
return {
|
|
6674
|
-
relativeDirPath:
|
|
7242
|
+
relativeDirPath: join59(".cursor", "skills")
|
|
6675
7243
|
};
|
|
6676
7244
|
}
|
|
6677
7245
|
getFrontmatter() {
|
|
@@ -6753,9 +7321,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6753
7321
|
});
|
|
6754
7322
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6755
7323
|
if (!result.success) {
|
|
6756
|
-
const skillDirPath =
|
|
7324
|
+
const skillDirPath = join59(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6757
7325
|
throw new Error(
|
|
6758
|
-
`Invalid frontmatter in ${
|
|
7326
|
+
`Invalid frontmatter in ${join59(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6759
7327
|
);
|
|
6760
7328
|
}
|
|
6761
7329
|
return new _CursorSkill({
|
|
@@ -6790,16 +7358,16 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6790
7358
|
};
|
|
6791
7359
|
|
|
6792
7360
|
// src/features/skills/kilo-skill.ts
|
|
6793
|
-
import { join as
|
|
6794
|
-
import { z as
|
|
6795
|
-
var KiloSkillFrontmatterSchema =
|
|
6796
|
-
name:
|
|
6797
|
-
description:
|
|
7361
|
+
import { join as join60 } from "path";
|
|
7362
|
+
import { z as z28 } from "zod/mini";
|
|
7363
|
+
var KiloSkillFrontmatterSchema = z28.looseObject({
|
|
7364
|
+
name: z28.string(),
|
|
7365
|
+
description: z28.string()
|
|
6798
7366
|
});
|
|
6799
7367
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
6800
7368
|
constructor({
|
|
6801
7369
|
baseDir = process.cwd(),
|
|
6802
|
-
relativeDirPath =
|
|
7370
|
+
relativeDirPath = join60(".kilocode", "skills"),
|
|
6803
7371
|
dirName,
|
|
6804
7372
|
frontmatter,
|
|
6805
7373
|
body,
|
|
@@ -6830,7 +7398,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6830
7398
|
global: _global = false
|
|
6831
7399
|
} = {}) {
|
|
6832
7400
|
return {
|
|
6833
|
-
relativeDirPath:
|
|
7401
|
+
relativeDirPath: join60(".kilocode", "skills")
|
|
6834
7402
|
};
|
|
6835
7403
|
}
|
|
6836
7404
|
getFrontmatter() {
|
|
@@ -6920,13 +7488,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6920
7488
|
});
|
|
6921
7489
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6922
7490
|
if (!result.success) {
|
|
6923
|
-
const skillDirPath =
|
|
7491
|
+
const skillDirPath = join60(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6924
7492
|
throw new Error(
|
|
6925
|
-
`Invalid frontmatter in ${
|
|
7493
|
+
`Invalid frontmatter in ${join60(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6926
7494
|
);
|
|
6927
7495
|
}
|
|
6928
7496
|
if (result.data.name !== loaded.dirName) {
|
|
6929
|
-
const skillFilePath =
|
|
7497
|
+
const skillFilePath = join60(
|
|
6930
7498
|
loaded.baseDir,
|
|
6931
7499
|
loaded.relativeDirPath,
|
|
6932
7500
|
loaded.dirName,
|
|
@@ -6967,16 +7535,16 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6967
7535
|
};
|
|
6968
7536
|
|
|
6969
7537
|
// src/features/skills/kiro-skill.ts
|
|
6970
|
-
import { join as
|
|
6971
|
-
import { z as
|
|
6972
|
-
var KiroSkillFrontmatterSchema =
|
|
6973
|
-
name:
|
|
6974
|
-
description:
|
|
7538
|
+
import { join as join61 } from "path";
|
|
7539
|
+
import { z as z29 } from "zod/mini";
|
|
7540
|
+
var KiroSkillFrontmatterSchema = z29.looseObject({
|
|
7541
|
+
name: z29.string(),
|
|
7542
|
+
description: z29.string()
|
|
6975
7543
|
});
|
|
6976
7544
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
6977
7545
|
constructor({
|
|
6978
7546
|
baseDir = process.cwd(),
|
|
6979
|
-
relativeDirPath =
|
|
7547
|
+
relativeDirPath = join61(".kiro", "skills"),
|
|
6980
7548
|
dirName,
|
|
6981
7549
|
frontmatter,
|
|
6982
7550
|
body,
|
|
@@ -7008,7 +7576,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
7008
7576
|
throw new Error("KiroSkill does not support global mode.");
|
|
7009
7577
|
}
|
|
7010
7578
|
return {
|
|
7011
|
-
relativeDirPath:
|
|
7579
|
+
relativeDirPath: join61(".kiro", "skills")
|
|
7012
7580
|
};
|
|
7013
7581
|
}
|
|
7014
7582
|
getFrontmatter() {
|
|
@@ -7098,13 +7666,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
7098
7666
|
});
|
|
7099
7667
|
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7100
7668
|
if (!result.success) {
|
|
7101
|
-
const skillDirPath =
|
|
7669
|
+
const skillDirPath = join61(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7102
7670
|
throw new Error(
|
|
7103
|
-
`Invalid frontmatter in ${
|
|
7671
|
+
`Invalid frontmatter in ${join61(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7104
7672
|
);
|
|
7105
7673
|
}
|
|
7106
7674
|
if (result.data.name !== loaded.dirName) {
|
|
7107
|
-
const skillFilePath =
|
|
7675
|
+
const skillFilePath = join61(
|
|
7108
7676
|
loaded.baseDir,
|
|
7109
7677
|
loaded.relativeDirPath,
|
|
7110
7678
|
loaded.dirName,
|
|
@@ -7146,17 +7714,17 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
7146
7714
|
};
|
|
7147
7715
|
|
|
7148
7716
|
// src/features/skills/opencode-skill.ts
|
|
7149
|
-
import { join as
|
|
7150
|
-
import { z as
|
|
7151
|
-
var OpenCodeSkillFrontmatterSchema =
|
|
7152
|
-
name:
|
|
7153
|
-
description:
|
|
7154
|
-
"allowed-tools":
|
|
7717
|
+
import { join as join62 } from "path";
|
|
7718
|
+
import { z as z30 } from "zod/mini";
|
|
7719
|
+
var OpenCodeSkillFrontmatterSchema = z30.looseObject({
|
|
7720
|
+
name: z30.string(),
|
|
7721
|
+
description: z30.string(),
|
|
7722
|
+
"allowed-tools": z30.optional(z30.array(z30.string()))
|
|
7155
7723
|
});
|
|
7156
7724
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
7157
7725
|
constructor({
|
|
7158
7726
|
baseDir = process.cwd(),
|
|
7159
|
-
relativeDirPath =
|
|
7727
|
+
relativeDirPath = join62(".opencode", "skill"),
|
|
7160
7728
|
dirName,
|
|
7161
7729
|
frontmatter,
|
|
7162
7730
|
body,
|
|
@@ -7185,7 +7753,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
7185
7753
|
}
|
|
7186
7754
|
static getSettablePaths({ global = false } = {}) {
|
|
7187
7755
|
return {
|
|
7188
|
-
relativeDirPath: global ?
|
|
7756
|
+
relativeDirPath: global ? join62(".config", "opencode", "skill") : join62(".opencode", "skill")
|
|
7189
7757
|
};
|
|
7190
7758
|
}
|
|
7191
7759
|
getFrontmatter() {
|
|
@@ -7273,9 +7841,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
7273
7841
|
});
|
|
7274
7842
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7275
7843
|
if (!result.success) {
|
|
7276
|
-
const skillDirPath =
|
|
7844
|
+
const skillDirPath = join62(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7277
7845
|
throw new Error(
|
|
7278
|
-
`Invalid frontmatter in ${
|
|
7846
|
+
`Invalid frontmatter in ${join62(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7279
7847
|
);
|
|
7280
7848
|
}
|
|
7281
7849
|
return new _OpenCodeSkill({
|
|
@@ -7308,17 +7876,177 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
7308
7876
|
}
|
|
7309
7877
|
};
|
|
7310
7878
|
|
|
7879
|
+
// src/features/skills/replit-skill.ts
|
|
7880
|
+
import { join as join63 } from "path";
|
|
7881
|
+
import { z as z31 } from "zod/mini";
|
|
7882
|
+
var ReplitSkillFrontmatterSchema = z31.looseObject({
|
|
7883
|
+
name: z31.string(),
|
|
7884
|
+
description: z31.string()
|
|
7885
|
+
});
|
|
7886
|
+
var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
7887
|
+
constructor({
|
|
7888
|
+
baseDir = process.cwd(),
|
|
7889
|
+
relativeDirPath = join63(".agent", "skills"),
|
|
7890
|
+
dirName,
|
|
7891
|
+
frontmatter,
|
|
7892
|
+
body,
|
|
7893
|
+
otherFiles = [],
|
|
7894
|
+
validate = true,
|
|
7895
|
+
global = false
|
|
7896
|
+
}) {
|
|
7897
|
+
super({
|
|
7898
|
+
baseDir,
|
|
7899
|
+
relativeDirPath,
|
|
7900
|
+
dirName,
|
|
7901
|
+
mainFile: {
|
|
7902
|
+
name: SKILL_FILE_NAME,
|
|
7903
|
+
body,
|
|
7904
|
+
frontmatter: { ...frontmatter }
|
|
7905
|
+
},
|
|
7906
|
+
otherFiles,
|
|
7907
|
+
global
|
|
7908
|
+
});
|
|
7909
|
+
if (validate) {
|
|
7910
|
+
const result = this.validate();
|
|
7911
|
+
if (!result.success) {
|
|
7912
|
+
throw result.error;
|
|
7913
|
+
}
|
|
7914
|
+
}
|
|
7915
|
+
}
|
|
7916
|
+
static getSettablePaths(options) {
|
|
7917
|
+
if (options?.global) {
|
|
7918
|
+
throw new Error("ReplitSkill does not support global mode.");
|
|
7919
|
+
}
|
|
7920
|
+
return {
|
|
7921
|
+
relativeDirPath: join63(".agent", "skills")
|
|
7922
|
+
};
|
|
7923
|
+
}
|
|
7924
|
+
getFrontmatter() {
|
|
7925
|
+
if (!this.mainFile?.frontmatter) {
|
|
7926
|
+
throw new Error("Frontmatter is not defined");
|
|
7927
|
+
}
|
|
7928
|
+
const result = ReplitSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
7929
|
+
return result;
|
|
7930
|
+
}
|
|
7931
|
+
getBody() {
|
|
7932
|
+
return this.mainFile?.body ?? "";
|
|
7933
|
+
}
|
|
7934
|
+
validate() {
|
|
7935
|
+
if (!this.mainFile) {
|
|
7936
|
+
return {
|
|
7937
|
+
success: false,
|
|
7938
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
7939
|
+
};
|
|
7940
|
+
}
|
|
7941
|
+
const result = ReplitSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
7942
|
+
if (!result.success) {
|
|
7943
|
+
return {
|
|
7944
|
+
success: false,
|
|
7945
|
+
error: new Error(
|
|
7946
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
7947
|
+
)
|
|
7948
|
+
};
|
|
7949
|
+
}
|
|
7950
|
+
return { success: true, error: null };
|
|
7951
|
+
}
|
|
7952
|
+
toRulesyncSkill() {
|
|
7953
|
+
const frontmatter = this.getFrontmatter();
|
|
7954
|
+
const rulesyncFrontmatter = {
|
|
7955
|
+
name: frontmatter.name,
|
|
7956
|
+
description: frontmatter.description,
|
|
7957
|
+
targets: ["*"]
|
|
7958
|
+
};
|
|
7959
|
+
return new RulesyncSkill({
|
|
7960
|
+
baseDir: this.baseDir,
|
|
7961
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
7962
|
+
dirName: this.getDirName(),
|
|
7963
|
+
frontmatter: rulesyncFrontmatter,
|
|
7964
|
+
body: this.getBody(),
|
|
7965
|
+
otherFiles: this.getOtherFiles(),
|
|
7966
|
+
validate: true,
|
|
7967
|
+
global: this.global
|
|
7968
|
+
});
|
|
7969
|
+
}
|
|
7970
|
+
static fromRulesyncSkill({
|
|
7971
|
+
rulesyncSkill,
|
|
7972
|
+
validate = true,
|
|
7973
|
+
global = false
|
|
7974
|
+
}) {
|
|
7975
|
+
const settablePaths = _ReplitSkill.getSettablePaths({ global });
|
|
7976
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
7977
|
+
const replitFrontmatter = {
|
|
7978
|
+
name: rulesyncFrontmatter.name,
|
|
7979
|
+
description: rulesyncFrontmatter.description
|
|
7980
|
+
};
|
|
7981
|
+
return new _ReplitSkill({
|
|
7982
|
+
baseDir: rulesyncSkill.getBaseDir(),
|
|
7983
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
7984
|
+
dirName: rulesyncSkill.getDirName(),
|
|
7985
|
+
frontmatter: replitFrontmatter,
|
|
7986
|
+
body: rulesyncSkill.getBody(),
|
|
7987
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
7988
|
+
validate,
|
|
7989
|
+
global
|
|
7990
|
+
});
|
|
7991
|
+
}
|
|
7992
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
7993
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
7994
|
+
return targets.includes("*") || targets.includes("replit");
|
|
7995
|
+
}
|
|
7996
|
+
static async fromDir(params) {
|
|
7997
|
+
const loaded = await this.loadSkillDirContent({
|
|
7998
|
+
...params,
|
|
7999
|
+
getSettablePaths: _ReplitSkill.getSettablePaths
|
|
8000
|
+
});
|
|
8001
|
+
const result = ReplitSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8002
|
+
if (!result.success) {
|
|
8003
|
+
const skillDirPath = join63(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8004
|
+
throw new Error(
|
|
8005
|
+
`Invalid frontmatter in ${join63(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8006
|
+
);
|
|
8007
|
+
}
|
|
8008
|
+
return new _ReplitSkill({
|
|
8009
|
+
baseDir: loaded.baseDir,
|
|
8010
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
8011
|
+
dirName: loaded.dirName,
|
|
8012
|
+
frontmatter: result.data,
|
|
8013
|
+
body: loaded.body,
|
|
8014
|
+
otherFiles: loaded.otherFiles,
|
|
8015
|
+
validate: true,
|
|
8016
|
+
global: loaded.global
|
|
8017
|
+
});
|
|
8018
|
+
}
|
|
8019
|
+
static forDeletion({
|
|
8020
|
+
baseDir = process.cwd(),
|
|
8021
|
+
relativeDirPath,
|
|
8022
|
+
dirName,
|
|
8023
|
+
global = false
|
|
8024
|
+
}) {
|
|
8025
|
+
const settablePaths = _ReplitSkill.getSettablePaths({ global });
|
|
8026
|
+
return new _ReplitSkill({
|
|
8027
|
+
baseDir,
|
|
8028
|
+
relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
|
|
8029
|
+
dirName,
|
|
8030
|
+
frontmatter: { name: "", description: "" },
|
|
8031
|
+
body: "",
|
|
8032
|
+
otherFiles: [],
|
|
8033
|
+
validate: false,
|
|
8034
|
+
global
|
|
8035
|
+
});
|
|
8036
|
+
}
|
|
8037
|
+
};
|
|
8038
|
+
|
|
7311
8039
|
// src/features/skills/roo-skill.ts
|
|
7312
|
-
import { join as
|
|
7313
|
-
import { z as
|
|
7314
|
-
var RooSkillFrontmatterSchema =
|
|
7315
|
-
name:
|
|
7316
|
-
description:
|
|
8040
|
+
import { join as join64 } from "path";
|
|
8041
|
+
import { z as z32 } from "zod/mini";
|
|
8042
|
+
var RooSkillFrontmatterSchema = z32.looseObject({
|
|
8043
|
+
name: z32.string(),
|
|
8044
|
+
description: z32.string()
|
|
7317
8045
|
});
|
|
7318
8046
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
7319
8047
|
constructor({
|
|
7320
8048
|
baseDir = process.cwd(),
|
|
7321
|
-
relativeDirPath =
|
|
8049
|
+
relativeDirPath = join64(".roo", "skills"),
|
|
7322
8050
|
dirName,
|
|
7323
8051
|
frontmatter,
|
|
7324
8052
|
body,
|
|
@@ -7349,7 +8077,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
7349
8077
|
global: _global = false
|
|
7350
8078
|
} = {}) {
|
|
7351
8079
|
return {
|
|
7352
|
-
relativeDirPath:
|
|
8080
|
+
relativeDirPath: join64(".roo", "skills")
|
|
7353
8081
|
};
|
|
7354
8082
|
}
|
|
7355
8083
|
getFrontmatter() {
|
|
@@ -7439,13 +8167,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
7439
8167
|
});
|
|
7440
8168
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7441
8169
|
if (!result.success) {
|
|
7442
|
-
const skillDirPath =
|
|
8170
|
+
const skillDirPath = join64(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7443
8171
|
throw new Error(
|
|
7444
|
-
`Invalid frontmatter in ${
|
|
8172
|
+
`Invalid frontmatter in ${join64(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7445
8173
|
);
|
|
7446
8174
|
}
|
|
7447
8175
|
if (result.data.name !== loaded.dirName) {
|
|
7448
|
-
const skillFilePath =
|
|
8176
|
+
const skillFilePath = join64(
|
|
7449
8177
|
loaded.baseDir,
|
|
7450
8178
|
loaded.relativeDirPath,
|
|
7451
8179
|
loaded.dirName,
|
|
@@ -7498,9 +8226,10 @@ var skillsProcessorToolTargetTuple = [
|
|
|
7498
8226
|
"kilo",
|
|
7499
8227
|
"kiro",
|
|
7500
8228
|
"opencode",
|
|
8229
|
+
"replit",
|
|
7501
8230
|
"roo"
|
|
7502
8231
|
];
|
|
7503
|
-
var SkillsProcessorToolTargetSchema =
|
|
8232
|
+
var SkillsProcessorToolTargetSchema = z33.enum(skillsProcessorToolTargetTuple);
|
|
7504
8233
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
7505
8234
|
[
|
|
7506
8235
|
"agentsmd",
|
|
@@ -7548,7 +8277,7 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
7548
8277
|
"cursor",
|
|
7549
8278
|
{
|
|
7550
8279
|
class: CursorSkill,
|
|
7551
|
-
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal:
|
|
8280
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
7552
8281
|
}
|
|
7553
8282
|
],
|
|
7554
8283
|
[
|
|
@@ -7579,6 +8308,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
7579
8308
|
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
7580
8309
|
}
|
|
7581
8310
|
],
|
|
8311
|
+
[
|
|
8312
|
+
"replit",
|
|
8313
|
+
{
|
|
8314
|
+
class: ReplitSkill,
|
|
8315
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: false }
|
|
8316
|
+
}
|
|
8317
|
+
],
|
|
7582
8318
|
[
|
|
7583
8319
|
"roo",
|
|
7584
8320
|
{
|
|
@@ -7664,8 +8400,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7664
8400
|
*/
|
|
7665
8401
|
async loadRulesyncDirs() {
|
|
7666
8402
|
const paths = RulesyncSkill.getSettablePaths();
|
|
7667
|
-
const rulesyncSkillsDirPath =
|
|
7668
|
-
const dirPaths = await findFilesByGlobs(
|
|
8403
|
+
const rulesyncSkillsDirPath = join65(this.baseDir, paths.relativeDirPath);
|
|
8404
|
+
const dirPaths = await findFilesByGlobs(join65(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
7669
8405
|
const dirNames = dirPaths.map((path3) => basename17(path3));
|
|
7670
8406
|
const rulesyncSkills = await Promise.all(
|
|
7671
8407
|
dirNames.map(
|
|
@@ -7682,8 +8418,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7682
8418
|
async loadToolDirs() {
|
|
7683
8419
|
const factory = this.getFactory(this.toolTarget);
|
|
7684
8420
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7685
|
-
const skillsDirPath =
|
|
7686
|
-
const dirPaths = await findFilesByGlobs(
|
|
8421
|
+
const skillsDirPath = join65(this.baseDir, paths.relativeDirPath);
|
|
8422
|
+
const dirPaths = await findFilesByGlobs(join65(skillsDirPath, "*"), { type: "dir" });
|
|
7687
8423
|
const dirNames = dirPaths.map((path3) => basename17(path3));
|
|
7688
8424
|
const toolSkills = await Promise.all(
|
|
7689
8425
|
dirNames.map(
|
|
@@ -7700,8 +8436,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7700
8436
|
async loadToolDirsToDelete() {
|
|
7701
8437
|
const factory = this.getFactory(this.toolTarget);
|
|
7702
8438
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7703
|
-
const skillsDirPath =
|
|
7704
|
-
const dirPaths = await findFilesByGlobs(
|
|
8439
|
+
const skillsDirPath = join65(this.baseDir, paths.relativeDirPath);
|
|
8440
|
+
const dirPaths = await findFilesByGlobs(join65(skillsDirPath, "*"), { type: "dir" });
|
|
7705
8441
|
const dirNames = dirPaths.map((path3) => basename17(path3));
|
|
7706
8442
|
const toolSkills = dirNames.map(
|
|
7707
8443
|
(dirName) => factory.class.forDeletion({
|
|
@@ -7750,11 +8486,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
7750
8486
|
};
|
|
7751
8487
|
|
|
7752
8488
|
// src/features/subagents/agentsmd-subagent.ts
|
|
7753
|
-
import { join as
|
|
8489
|
+
import { join as join67 } from "path";
|
|
7754
8490
|
|
|
7755
8491
|
// src/features/subagents/simulated-subagent.ts
|
|
7756
|
-
import { basename as basename18, join as
|
|
7757
|
-
import { z as
|
|
8492
|
+
import { basename as basename18, join as join66 } from "path";
|
|
8493
|
+
import { z as z34 } from "zod/mini";
|
|
7758
8494
|
|
|
7759
8495
|
// src/features/subagents/tool-subagent.ts
|
|
7760
8496
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -7797,9 +8533,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
7797
8533
|
};
|
|
7798
8534
|
|
|
7799
8535
|
// src/features/subagents/simulated-subagent.ts
|
|
7800
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
7801
|
-
name:
|
|
7802
|
-
description:
|
|
8536
|
+
var SimulatedSubagentFrontmatterSchema = z34.object({
|
|
8537
|
+
name: z34.string(),
|
|
8538
|
+
description: z34.string()
|
|
7803
8539
|
});
|
|
7804
8540
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
7805
8541
|
frontmatter;
|
|
@@ -7809,7 +8545,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7809
8545
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7810
8546
|
if (!result.success) {
|
|
7811
8547
|
throw new Error(
|
|
7812
|
-
`Invalid frontmatter in ${
|
|
8548
|
+
`Invalid frontmatter in ${join66(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7813
8549
|
);
|
|
7814
8550
|
}
|
|
7815
8551
|
}
|
|
@@ -7860,7 +8596,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7860
8596
|
return {
|
|
7861
8597
|
success: false,
|
|
7862
8598
|
error: new Error(
|
|
7863
|
-
`Invalid frontmatter in ${
|
|
8599
|
+
`Invalid frontmatter in ${join66(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7864
8600
|
)
|
|
7865
8601
|
};
|
|
7866
8602
|
}
|
|
@@ -7870,7 +8606,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7870
8606
|
relativeFilePath,
|
|
7871
8607
|
validate = true
|
|
7872
8608
|
}) {
|
|
7873
|
-
const filePath =
|
|
8609
|
+
const filePath = join66(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
7874
8610
|
const fileContent = await readFileContent(filePath);
|
|
7875
8611
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7876
8612
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7906,7 +8642,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7906
8642
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
7907
8643
|
static getSettablePaths() {
|
|
7908
8644
|
return {
|
|
7909
|
-
relativeDirPath:
|
|
8645
|
+
relativeDirPath: join67(".agents", "subagents")
|
|
7910
8646
|
};
|
|
7911
8647
|
}
|
|
7912
8648
|
static async fromFile(params) {
|
|
@@ -7929,11 +8665,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
7929
8665
|
};
|
|
7930
8666
|
|
|
7931
8667
|
// src/features/subagents/codexcli-subagent.ts
|
|
7932
|
-
import { join as
|
|
8668
|
+
import { join as join68 } from "path";
|
|
7933
8669
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
7934
8670
|
static getSettablePaths() {
|
|
7935
8671
|
return {
|
|
7936
|
-
relativeDirPath:
|
|
8672
|
+
relativeDirPath: join68(".codex", "subagents")
|
|
7937
8673
|
};
|
|
7938
8674
|
}
|
|
7939
8675
|
static async fromFile(params) {
|
|
@@ -7956,11 +8692,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
7956
8692
|
};
|
|
7957
8693
|
|
|
7958
8694
|
// src/features/subagents/geminicli-subagent.ts
|
|
7959
|
-
import { join as
|
|
8695
|
+
import { join as join69 } from "path";
|
|
7960
8696
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
7961
8697
|
static getSettablePaths() {
|
|
7962
8698
|
return {
|
|
7963
|
-
relativeDirPath:
|
|
8699
|
+
relativeDirPath: join69(".gemini", "subagents")
|
|
7964
8700
|
};
|
|
7965
8701
|
}
|
|
7966
8702
|
static async fromFile(params) {
|
|
@@ -7983,11 +8719,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
7983
8719
|
};
|
|
7984
8720
|
|
|
7985
8721
|
// src/features/subagents/roo-subagent.ts
|
|
7986
|
-
import { join as
|
|
8722
|
+
import { join as join70 } from "path";
|
|
7987
8723
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
7988
8724
|
static getSettablePaths() {
|
|
7989
8725
|
return {
|
|
7990
|
-
relativeDirPath:
|
|
8726
|
+
relativeDirPath: join70(".roo", "subagents")
|
|
7991
8727
|
};
|
|
7992
8728
|
}
|
|
7993
8729
|
static async fromFile(params) {
|
|
@@ -8010,20 +8746,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
8010
8746
|
};
|
|
8011
8747
|
|
|
8012
8748
|
// src/features/subagents/subagents-processor.ts
|
|
8013
|
-
import { basename as basename21, join as
|
|
8014
|
-
import { z as
|
|
8749
|
+
import { basename as basename21, join as join77 } from "path";
|
|
8750
|
+
import { z as z41 } from "zod/mini";
|
|
8015
8751
|
|
|
8016
8752
|
// src/features/subagents/claudecode-subagent.ts
|
|
8017
|
-
import { join as
|
|
8018
|
-
import { z as
|
|
8753
|
+
import { join as join72 } from "path";
|
|
8754
|
+
import { z as z36 } from "zod/mini";
|
|
8019
8755
|
|
|
8020
8756
|
// src/features/subagents/rulesync-subagent.ts
|
|
8021
|
-
import { basename as basename19, join as
|
|
8022
|
-
import { z as
|
|
8023
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
8757
|
+
import { basename as basename19, join as join71 } from "path";
|
|
8758
|
+
import { z as z35 } from "zod/mini";
|
|
8759
|
+
var RulesyncSubagentFrontmatterSchema = z35.looseObject({
|
|
8024
8760
|
targets: RulesyncTargetsSchema,
|
|
8025
|
-
name:
|
|
8026
|
-
description:
|
|
8761
|
+
name: z35.string(),
|
|
8762
|
+
description: z35.string()
|
|
8027
8763
|
});
|
|
8028
8764
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
8029
8765
|
frontmatter;
|
|
@@ -8033,7 +8769,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
8033
8769
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8034
8770
|
if (!result.success) {
|
|
8035
8771
|
throw new Error(
|
|
8036
|
-
`Invalid frontmatter in ${
|
|
8772
|
+
`Invalid frontmatter in ${join71(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8037
8773
|
);
|
|
8038
8774
|
}
|
|
8039
8775
|
}
|
|
@@ -8066,7 +8802,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
8066
8802
|
return {
|
|
8067
8803
|
success: false,
|
|
8068
8804
|
error: new Error(
|
|
8069
|
-
`Invalid frontmatter in ${
|
|
8805
|
+
`Invalid frontmatter in ${join71(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8070
8806
|
)
|
|
8071
8807
|
};
|
|
8072
8808
|
}
|
|
@@ -8075,7 +8811,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
8075
8811
|
relativeFilePath
|
|
8076
8812
|
}) {
|
|
8077
8813
|
const fileContent = await readFileContent(
|
|
8078
|
-
|
|
8814
|
+
join71(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
8079
8815
|
);
|
|
8080
8816
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8081
8817
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8094,13 +8830,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
8094
8830
|
};
|
|
8095
8831
|
|
|
8096
8832
|
// src/features/subagents/claudecode-subagent.ts
|
|
8097
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
8098
|
-
name:
|
|
8099
|
-
description:
|
|
8100
|
-
model:
|
|
8101
|
-
tools:
|
|
8102
|
-
permissionMode:
|
|
8103
|
-
skills:
|
|
8833
|
+
var ClaudecodeSubagentFrontmatterSchema = z36.looseObject({
|
|
8834
|
+
name: z36.string(),
|
|
8835
|
+
description: z36.string(),
|
|
8836
|
+
model: z36.optional(z36.string()),
|
|
8837
|
+
tools: z36.optional(z36.union([z36.string(), z36.array(z36.string())])),
|
|
8838
|
+
permissionMode: z36.optional(z36.string()),
|
|
8839
|
+
skills: z36.optional(z36.union([z36.string(), z36.array(z36.string())]))
|
|
8104
8840
|
});
|
|
8105
8841
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
8106
8842
|
frontmatter;
|
|
@@ -8110,7 +8846,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8110
8846
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8111
8847
|
if (!result.success) {
|
|
8112
8848
|
throw new Error(
|
|
8113
|
-
`Invalid frontmatter in ${
|
|
8849
|
+
`Invalid frontmatter in ${join72(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8114
8850
|
);
|
|
8115
8851
|
}
|
|
8116
8852
|
}
|
|
@@ -8122,7 +8858,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8122
8858
|
}
|
|
8123
8859
|
static getSettablePaths(_options = {}) {
|
|
8124
8860
|
return {
|
|
8125
|
-
relativeDirPath:
|
|
8861
|
+
relativeDirPath: join72(".claude", "agents")
|
|
8126
8862
|
};
|
|
8127
8863
|
}
|
|
8128
8864
|
getFrontmatter() {
|
|
@@ -8196,7 +8932,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8196
8932
|
return {
|
|
8197
8933
|
success: false,
|
|
8198
8934
|
error: new Error(
|
|
8199
|
-
`Invalid frontmatter in ${
|
|
8935
|
+
`Invalid frontmatter in ${join72(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8200
8936
|
)
|
|
8201
8937
|
};
|
|
8202
8938
|
}
|
|
@@ -8214,7 +8950,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8214
8950
|
global = false
|
|
8215
8951
|
}) {
|
|
8216
8952
|
const paths = this.getSettablePaths({ global });
|
|
8217
|
-
const filePath =
|
|
8953
|
+
const filePath = join72(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8218
8954
|
const fileContent = await readFileContent(filePath);
|
|
8219
8955
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8220
8956
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8249,13 +8985,13 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
8249
8985
|
};
|
|
8250
8986
|
|
|
8251
8987
|
// src/features/subagents/copilot-subagent.ts
|
|
8252
|
-
import { join as
|
|
8253
|
-
import { z as
|
|
8988
|
+
import { join as join73 } from "path";
|
|
8989
|
+
import { z as z37 } from "zod/mini";
|
|
8254
8990
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
8255
|
-
var CopilotSubagentFrontmatterSchema =
|
|
8256
|
-
name:
|
|
8257
|
-
description:
|
|
8258
|
-
tools:
|
|
8991
|
+
var CopilotSubagentFrontmatterSchema = z37.looseObject({
|
|
8992
|
+
name: z37.string(),
|
|
8993
|
+
description: z37.string(),
|
|
8994
|
+
tools: z37.optional(z37.union([z37.string(), z37.array(z37.string())]))
|
|
8259
8995
|
});
|
|
8260
8996
|
var normalizeTools = (tools) => {
|
|
8261
8997
|
if (!tools) {
|
|
@@ -8275,7 +9011,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8275
9011
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8276
9012
|
if (!result.success) {
|
|
8277
9013
|
throw new Error(
|
|
8278
|
-
`Invalid frontmatter in ${
|
|
9014
|
+
`Invalid frontmatter in ${join73(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8279
9015
|
);
|
|
8280
9016
|
}
|
|
8281
9017
|
}
|
|
@@ -8287,7 +9023,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8287
9023
|
}
|
|
8288
9024
|
static getSettablePaths(_options = {}) {
|
|
8289
9025
|
return {
|
|
8290
|
-
relativeDirPath:
|
|
9026
|
+
relativeDirPath: join73(".github", "agents")
|
|
8291
9027
|
};
|
|
8292
9028
|
}
|
|
8293
9029
|
getFrontmatter() {
|
|
@@ -8361,7 +9097,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8361
9097
|
return {
|
|
8362
9098
|
success: false,
|
|
8363
9099
|
error: new Error(
|
|
8364
|
-
`Invalid frontmatter in ${
|
|
9100
|
+
`Invalid frontmatter in ${join73(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8365
9101
|
)
|
|
8366
9102
|
};
|
|
8367
9103
|
}
|
|
@@ -8379,7 +9115,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8379
9115
|
global = false
|
|
8380
9116
|
}) {
|
|
8381
9117
|
const paths = this.getSettablePaths({ global });
|
|
8382
|
-
const filePath =
|
|
9118
|
+
const filePath = join73(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8383
9119
|
const fileContent = await readFileContent(filePath);
|
|
8384
9120
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8385
9121
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8415,11 +9151,11 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8415
9151
|
};
|
|
8416
9152
|
|
|
8417
9153
|
// src/features/subagents/cursor-subagent.ts
|
|
8418
|
-
import { join as
|
|
8419
|
-
import { z as
|
|
8420
|
-
var CursorSubagentFrontmatterSchema =
|
|
8421
|
-
name:
|
|
8422
|
-
description:
|
|
9154
|
+
import { join as join74 } from "path";
|
|
9155
|
+
import { z as z38 } from "zod/mini";
|
|
9156
|
+
var CursorSubagentFrontmatterSchema = z38.looseObject({
|
|
9157
|
+
name: z38.string(),
|
|
9158
|
+
description: z38.string()
|
|
8423
9159
|
});
|
|
8424
9160
|
var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
8425
9161
|
frontmatter;
|
|
@@ -8429,7 +9165,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
8429
9165
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8430
9166
|
if (!result.success) {
|
|
8431
9167
|
throw new Error(
|
|
8432
|
-
`Invalid frontmatter in ${
|
|
9168
|
+
`Invalid frontmatter in ${join74(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8433
9169
|
);
|
|
8434
9170
|
}
|
|
8435
9171
|
}
|
|
@@ -8441,7 +9177,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
8441
9177
|
}
|
|
8442
9178
|
static getSettablePaths(_options = {}) {
|
|
8443
9179
|
return {
|
|
8444
|
-
relativeDirPath:
|
|
9180
|
+
relativeDirPath: join74(".cursor", "agents")
|
|
8445
9181
|
};
|
|
8446
9182
|
}
|
|
8447
9183
|
getFrontmatter() {
|
|
@@ -8508,7 +9244,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
8508
9244
|
return {
|
|
8509
9245
|
success: false,
|
|
8510
9246
|
error: new Error(
|
|
8511
|
-
`Invalid frontmatter in ${
|
|
9247
|
+
`Invalid frontmatter in ${join74(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8512
9248
|
)
|
|
8513
9249
|
};
|
|
8514
9250
|
}
|
|
@@ -8526,7 +9262,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
8526
9262
|
global = false
|
|
8527
9263
|
}) {
|
|
8528
9264
|
const paths = this.getSettablePaths({ global });
|
|
8529
|
-
const filePath =
|
|
9265
|
+
const filePath = join74(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8530
9266
|
const fileContent = await readFileContent(filePath);
|
|
8531
9267
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8532
9268
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8562,23 +9298,23 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
8562
9298
|
};
|
|
8563
9299
|
|
|
8564
9300
|
// src/features/subagents/kiro-subagent.ts
|
|
8565
|
-
import { join as
|
|
8566
|
-
import { z as
|
|
8567
|
-
var KiroCliSubagentJsonSchema =
|
|
8568
|
-
name:
|
|
8569
|
-
description:
|
|
8570
|
-
prompt:
|
|
8571
|
-
tools:
|
|
8572
|
-
toolAliases:
|
|
8573
|
-
toolSettings:
|
|
8574
|
-
toolSchema:
|
|
8575
|
-
hooks:
|
|
8576
|
-
model:
|
|
8577
|
-
mcpServers:
|
|
8578
|
-
useLegacyMcpJson:
|
|
8579
|
-
resources:
|
|
8580
|
-
allowedTools:
|
|
8581
|
-
includeMcpJson:
|
|
9301
|
+
import { join as join75 } from "path";
|
|
9302
|
+
import { z as z39 } from "zod/mini";
|
|
9303
|
+
var KiroCliSubagentJsonSchema = z39.looseObject({
|
|
9304
|
+
name: z39.string(),
|
|
9305
|
+
description: z39.optional(z39.nullable(z39.string())),
|
|
9306
|
+
prompt: z39.optional(z39.nullable(z39.string())),
|
|
9307
|
+
tools: z39.optional(z39.nullable(z39.array(z39.string()))),
|
|
9308
|
+
toolAliases: z39.optional(z39.nullable(z39.record(z39.string(), z39.string()))),
|
|
9309
|
+
toolSettings: z39.optional(z39.nullable(z39.unknown())),
|
|
9310
|
+
toolSchema: z39.optional(z39.nullable(z39.unknown())),
|
|
9311
|
+
hooks: z39.optional(z39.nullable(z39.record(z39.string(), z39.array(z39.unknown())))),
|
|
9312
|
+
model: z39.optional(z39.nullable(z39.string())),
|
|
9313
|
+
mcpServers: z39.optional(z39.nullable(z39.record(z39.string(), z39.unknown()))),
|
|
9314
|
+
useLegacyMcpJson: z39.optional(z39.nullable(z39.boolean())),
|
|
9315
|
+
resources: z39.optional(z39.nullable(z39.array(z39.string()))),
|
|
9316
|
+
allowedTools: z39.optional(z39.nullable(z39.array(z39.string()))),
|
|
9317
|
+
includeMcpJson: z39.optional(z39.nullable(z39.boolean()))
|
|
8582
9318
|
});
|
|
8583
9319
|
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
8584
9320
|
body;
|
|
@@ -8590,7 +9326,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
8590
9326
|
}
|
|
8591
9327
|
static getSettablePaths(_options = {}) {
|
|
8592
9328
|
return {
|
|
8593
|
-
relativeDirPath:
|
|
9329
|
+
relativeDirPath: join75(".kiro", "agents")
|
|
8594
9330
|
};
|
|
8595
9331
|
}
|
|
8596
9332
|
getBody() {
|
|
@@ -8670,7 +9406,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
8670
9406
|
global = false
|
|
8671
9407
|
}) {
|
|
8672
9408
|
const paths = this.getSettablePaths({ global });
|
|
8673
|
-
const filePath =
|
|
9409
|
+
const filePath = join75(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8674
9410
|
const fileContent = await readFileContent(filePath);
|
|
8675
9411
|
return new _KiroSubagent({
|
|
8676
9412
|
baseDir,
|
|
@@ -8699,12 +9435,12 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
8699
9435
|
};
|
|
8700
9436
|
|
|
8701
9437
|
// src/features/subagents/opencode-subagent.ts
|
|
8702
|
-
import { basename as basename20, join as
|
|
8703
|
-
import { z as
|
|
8704
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
8705
|
-
description:
|
|
8706
|
-
mode:
|
|
8707
|
-
name:
|
|
9438
|
+
import { basename as basename20, join as join76 } from "path";
|
|
9439
|
+
import { z as z40 } from "zod/mini";
|
|
9440
|
+
var OpenCodeSubagentFrontmatterSchema = z40.looseObject({
|
|
9441
|
+
description: z40.string(),
|
|
9442
|
+
mode: z40.literal("subagent"),
|
|
9443
|
+
name: z40.optional(z40.string())
|
|
8708
9444
|
});
|
|
8709
9445
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
8710
9446
|
frontmatter;
|
|
@@ -8714,7 +9450,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8714
9450
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8715
9451
|
if (!result.success) {
|
|
8716
9452
|
throw new Error(
|
|
8717
|
-
`Invalid frontmatter in ${
|
|
9453
|
+
`Invalid frontmatter in ${join76(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8718
9454
|
);
|
|
8719
9455
|
}
|
|
8720
9456
|
}
|
|
@@ -8728,7 +9464,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8728
9464
|
global = false
|
|
8729
9465
|
} = {}) {
|
|
8730
9466
|
return {
|
|
8731
|
-
relativeDirPath: global ?
|
|
9467
|
+
relativeDirPath: global ? join76(".config", "opencode", "agent") : join76(".opencode", "agent")
|
|
8732
9468
|
};
|
|
8733
9469
|
}
|
|
8734
9470
|
getFrontmatter() {
|
|
@@ -8794,7 +9530,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8794
9530
|
return {
|
|
8795
9531
|
success: false,
|
|
8796
9532
|
error: new Error(
|
|
8797
|
-
`Invalid frontmatter in ${
|
|
9533
|
+
`Invalid frontmatter in ${join76(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8798
9534
|
)
|
|
8799
9535
|
};
|
|
8800
9536
|
}
|
|
@@ -8811,7 +9547,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8811
9547
|
global = false
|
|
8812
9548
|
}) {
|
|
8813
9549
|
const paths = this.getSettablePaths({ global });
|
|
8814
|
-
const filePath =
|
|
9550
|
+
const filePath = join76(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8815
9551
|
const fileContent = await readFileContent(filePath);
|
|
8816
9552
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8817
9553
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8859,7 +9595,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
8859
9595
|
"opencode",
|
|
8860
9596
|
"roo"
|
|
8861
9597
|
];
|
|
8862
|
-
var SubagentsProcessorToolTargetSchema =
|
|
9598
|
+
var SubagentsProcessorToolTargetSchema = z41.enum(subagentsProcessorToolTargetTuple);
|
|
8863
9599
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
8864
9600
|
[
|
|
8865
9601
|
"agentsmd",
|
|
@@ -8900,7 +9636,7 @@ var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
|
8900
9636
|
"cursor",
|
|
8901
9637
|
{
|
|
8902
9638
|
class: CursorSubagent,
|
|
8903
|
-
meta: { supportsSimulated: false, supportsGlobal:
|
|
9639
|
+
meta: { supportsSimulated: false, supportsGlobal: true, filePattern: "*.md" }
|
|
8904
9640
|
}
|
|
8905
9641
|
],
|
|
8906
9642
|
[
|
|
@@ -9013,7 +9749,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
9013
9749
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
9014
9750
|
*/
|
|
9015
9751
|
async loadRulesyncFiles() {
|
|
9016
|
-
const subagentsDir =
|
|
9752
|
+
const subagentsDir = join77(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
9017
9753
|
const dirExists = await directoryExists(subagentsDir);
|
|
9018
9754
|
if (!dirExists) {
|
|
9019
9755
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -9028,7 +9764,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
9028
9764
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
9029
9765
|
const rulesyncSubagents = [];
|
|
9030
9766
|
for (const mdFile of mdFiles) {
|
|
9031
|
-
const filepath =
|
|
9767
|
+
const filepath = join77(subagentsDir, mdFile);
|
|
9032
9768
|
try {
|
|
9033
9769
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
9034
9770
|
relativeFilePath: mdFile,
|
|
@@ -9058,7 +9794,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
9058
9794
|
const factory = this.getFactory(this.toolTarget);
|
|
9059
9795
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
9060
9796
|
const subagentFilePaths = await findFilesByGlobs(
|
|
9061
|
-
|
|
9797
|
+
join77(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
9062
9798
|
);
|
|
9063
9799
|
if (forDeletion) {
|
|
9064
9800
|
const toolSubagents2 = subagentFilePaths.map(
|
|
@@ -9108,49 +9844,49 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
9108
9844
|
};
|
|
9109
9845
|
|
|
9110
9846
|
// src/features/rules/agentsmd-rule.ts
|
|
9111
|
-
import { join as
|
|
9847
|
+
import { join as join80 } from "path";
|
|
9112
9848
|
|
|
9113
9849
|
// src/features/rules/tool-rule.ts
|
|
9114
|
-
import { join as
|
|
9850
|
+
import { join as join79 } from "path";
|
|
9115
9851
|
|
|
9116
9852
|
// src/features/rules/rulesync-rule.ts
|
|
9117
|
-
import { join as
|
|
9118
|
-
import { z as
|
|
9119
|
-
var RulesyncRuleFrontmatterSchema =
|
|
9120
|
-
root:
|
|
9121
|
-
localRoot:
|
|
9122
|
-
targets:
|
|
9123
|
-
description:
|
|
9124
|
-
globs:
|
|
9125
|
-
agentsmd:
|
|
9126
|
-
|
|
9853
|
+
import { join as join78 } from "path";
|
|
9854
|
+
import { z as z42 } from "zod/mini";
|
|
9855
|
+
var RulesyncRuleFrontmatterSchema = z42.object({
|
|
9856
|
+
root: z42.optional(z42.boolean()),
|
|
9857
|
+
localRoot: z42.optional(z42.boolean()),
|
|
9858
|
+
targets: z42.optional(RulesyncTargetsSchema),
|
|
9859
|
+
description: z42.optional(z42.string()),
|
|
9860
|
+
globs: z42.optional(z42.array(z42.string())),
|
|
9861
|
+
agentsmd: z42.optional(
|
|
9862
|
+
z42.object({
|
|
9127
9863
|
// @example "path/to/subproject"
|
|
9128
|
-
subprojectPath:
|
|
9864
|
+
subprojectPath: z42.optional(z42.string())
|
|
9129
9865
|
})
|
|
9130
9866
|
),
|
|
9131
|
-
claudecode:
|
|
9132
|
-
|
|
9867
|
+
claudecode: z42.optional(
|
|
9868
|
+
z42.object({
|
|
9133
9869
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
9134
9870
|
// @example "src/**/*.ts, tests/**/*.test.ts"
|
|
9135
|
-
paths:
|
|
9871
|
+
paths: z42.optional(z42.string())
|
|
9136
9872
|
})
|
|
9137
9873
|
),
|
|
9138
|
-
cursor:
|
|
9139
|
-
|
|
9140
|
-
alwaysApply:
|
|
9141
|
-
description:
|
|
9142
|
-
globs:
|
|
9874
|
+
cursor: z42.optional(
|
|
9875
|
+
z42.object({
|
|
9876
|
+
alwaysApply: z42.optional(z42.boolean()),
|
|
9877
|
+
description: z42.optional(z42.string()),
|
|
9878
|
+
globs: z42.optional(z42.array(z42.string()))
|
|
9143
9879
|
})
|
|
9144
9880
|
),
|
|
9145
|
-
copilot:
|
|
9146
|
-
|
|
9147
|
-
excludeAgent:
|
|
9881
|
+
copilot: z42.optional(
|
|
9882
|
+
z42.object({
|
|
9883
|
+
excludeAgent: z42.optional(z42.union([z42.literal("code-review"), z42.literal("coding-agent")]))
|
|
9148
9884
|
})
|
|
9149
9885
|
),
|
|
9150
|
-
antigravity:
|
|
9151
|
-
|
|
9152
|
-
trigger:
|
|
9153
|
-
globs:
|
|
9886
|
+
antigravity: z42.optional(
|
|
9887
|
+
z42.looseObject({
|
|
9888
|
+
trigger: z42.optional(z42.string()),
|
|
9889
|
+
globs: z42.optional(z42.array(z42.string()))
|
|
9154
9890
|
})
|
|
9155
9891
|
)
|
|
9156
9892
|
});
|
|
@@ -9162,7 +9898,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
9162
9898
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9163
9899
|
if (!result.success) {
|
|
9164
9900
|
throw new Error(
|
|
9165
|
-
`Invalid frontmatter in ${
|
|
9901
|
+
`Invalid frontmatter in ${join78(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9166
9902
|
);
|
|
9167
9903
|
}
|
|
9168
9904
|
}
|
|
@@ -9197,7 +9933,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
9197
9933
|
return {
|
|
9198
9934
|
success: false,
|
|
9199
9935
|
error: new Error(
|
|
9200
|
-
`Invalid frontmatter in ${
|
|
9936
|
+
`Invalid frontmatter in ${join78(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9201
9937
|
)
|
|
9202
9938
|
};
|
|
9203
9939
|
}
|
|
@@ -9206,7 +9942,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
9206
9942
|
relativeFilePath,
|
|
9207
9943
|
validate = true
|
|
9208
9944
|
}) {
|
|
9209
|
-
const filePath =
|
|
9945
|
+
const filePath = join78(
|
|
9210
9946
|
process.cwd(),
|
|
9211
9947
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
9212
9948
|
relativeFilePath
|
|
@@ -9308,7 +10044,7 @@ var ToolRule = class extends ToolFile {
|
|
|
9308
10044
|
rulesyncRule,
|
|
9309
10045
|
validate = true,
|
|
9310
10046
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
9311
|
-
nonRootPath = { relativeDirPath:
|
|
10047
|
+
nonRootPath = { relativeDirPath: join79(".agents", "memories") }
|
|
9312
10048
|
}) {
|
|
9313
10049
|
const params = this.buildToolRuleParamsDefault({
|
|
9314
10050
|
baseDir,
|
|
@@ -9319,7 +10055,7 @@ var ToolRule = class extends ToolFile {
|
|
|
9319
10055
|
});
|
|
9320
10056
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
9321
10057
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
9322
|
-
params.relativeDirPath =
|
|
10058
|
+
params.relativeDirPath = join79(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
9323
10059
|
params.relativeFilePath = "AGENTS.md";
|
|
9324
10060
|
}
|
|
9325
10061
|
return params;
|
|
@@ -9384,7 +10120,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
9384
10120
|
relativeFilePath: "AGENTS.md"
|
|
9385
10121
|
},
|
|
9386
10122
|
nonRoot: {
|
|
9387
|
-
relativeDirPath:
|
|
10123
|
+
relativeDirPath: join80(".agents", "memories")
|
|
9388
10124
|
}
|
|
9389
10125
|
};
|
|
9390
10126
|
}
|
|
@@ -9394,8 +10130,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
9394
10130
|
validate = true
|
|
9395
10131
|
}) {
|
|
9396
10132
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
9397
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
9398
|
-
const fileContent = await readFileContent(
|
|
10133
|
+
const relativePath = isRoot ? "AGENTS.md" : join80(".agents", "memories", relativeFilePath);
|
|
10134
|
+
const fileContent = await readFileContent(join80(baseDir, relativePath));
|
|
9399
10135
|
return new _AgentsMdRule({
|
|
9400
10136
|
baseDir,
|
|
9401
10137
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9450,21 +10186,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
9450
10186
|
};
|
|
9451
10187
|
|
|
9452
10188
|
// src/features/rules/antigravity-rule.ts
|
|
9453
|
-
import { join as
|
|
9454
|
-
import { z as
|
|
9455
|
-
var AntigravityRuleFrontmatterSchema =
|
|
9456
|
-
trigger:
|
|
9457
|
-
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
|
|
10189
|
+
import { join as join81 } from "path";
|
|
10190
|
+
import { z as z43 } from "zod/mini";
|
|
10191
|
+
var AntigravityRuleFrontmatterSchema = z43.looseObject({
|
|
10192
|
+
trigger: z43.optional(
|
|
10193
|
+
z43.union([
|
|
10194
|
+
z43.literal("always_on"),
|
|
10195
|
+
z43.literal("glob"),
|
|
10196
|
+
z43.literal("manual"),
|
|
10197
|
+
z43.literal("model_decision"),
|
|
10198
|
+
z43.string()
|
|
9463
10199
|
// accepts any string for forward compatibility
|
|
9464
10200
|
])
|
|
9465
10201
|
),
|
|
9466
|
-
globs:
|
|
9467
|
-
description:
|
|
10202
|
+
globs: z43.optional(z43.string()),
|
|
10203
|
+
description: z43.optional(z43.string())
|
|
9468
10204
|
});
|
|
9469
10205
|
function parseGlobsString(globs) {
|
|
9470
10206
|
if (!globs) {
|
|
@@ -9609,7 +10345,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9609
10345
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9610
10346
|
if (!result.success) {
|
|
9611
10347
|
throw new Error(
|
|
9612
|
-
`Invalid frontmatter in ${
|
|
10348
|
+
`Invalid frontmatter in ${join81(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9613
10349
|
);
|
|
9614
10350
|
}
|
|
9615
10351
|
}
|
|
@@ -9624,7 +10360,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9624
10360
|
static getSettablePaths() {
|
|
9625
10361
|
return {
|
|
9626
10362
|
nonRoot: {
|
|
9627
|
-
relativeDirPath:
|
|
10363
|
+
relativeDirPath: join81(".agent", "rules")
|
|
9628
10364
|
}
|
|
9629
10365
|
};
|
|
9630
10366
|
}
|
|
@@ -9633,7 +10369,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9633
10369
|
relativeFilePath,
|
|
9634
10370
|
validate = true
|
|
9635
10371
|
}) {
|
|
9636
|
-
const filePath =
|
|
10372
|
+
const filePath = join81(
|
|
9637
10373
|
baseDir,
|
|
9638
10374
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
9639
10375
|
relativeFilePath
|
|
@@ -9774,7 +10510,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9774
10510
|
};
|
|
9775
10511
|
|
|
9776
10512
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
9777
|
-
import { join as
|
|
10513
|
+
import { join as join82 } from "path";
|
|
9778
10514
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
9779
10515
|
toRulesyncRule() {
|
|
9780
10516
|
const rulesyncFrontmatter = {
|
|
@@ -9800,7 +10536,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9800
10536
|
relativeFilePath: ".augment-guidelines"
|
|
9801
10537
|
},
|
|
9802
10538
|
nonRoot: {
|
|
9803
|
-
relativeDirPath:
|
|
10539
|
+
relativeDirPath: join82(".augment", "rules")
|
|
9804
10540
|
}
|
|
9805
10541
|
};
|
|
9806
10542
|
}
|
|
@@ -9835,8 +10571,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9835
10571
|
}) {
|
|
9836
10572
|
const settablePaths = this.getSettablePaths();
|
|
9837
10573
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
9838
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
9839
|
-
const fileContent = await readFileContent(
|
|
10574
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join82(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10575
|
+
const fileContent = await readFileContent(join82(baseDir, relativePath));
|
|
9840
10576
|
return new _AugmentcodeLegacyRule({
|
|
9841
10577
|
baseDir,
|
|
9842
10578
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -9865,7 +10601,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9865
10601
|
};
|
|
9866
10602
|
|
|
9867
10603
|
// src/features/rules/augmentcode-rule.ts
|
|
9868
|
-
import { join as
|
|
10604
|
+
import { join as join83 } from "path";
|
|
9869
10605
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
9870
10606
|
toRulesyncRule() {
|
|
9871
10607
|
return this.toRulesyncRuleDefault();
|
|
@@ -9873,7 +10609,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9873
10609
|
static getSettablePaths() {
|
|
9874
10610
|
return {
|
|
9875
10611
|
nonRoot: {
|
|
9876
|
-
relativeDirPath:
|
|
10612
|
+
relativeDirPath: join83(".augment", "rules")
|
|
9877
10613
|
}
|
|
9878
10614
|
};
|
|
9879
10615
|
}
|
|
@@ -9897,7 +10633,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9897
10633
|
validate = true
|
|
9898
10634
|
}) {
|
|
9899
10635
|
const fileContent = await readFileContent(
|
|
9900
|
-
|
|
10636
|
+
join83(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9901
10637
|
);
|
|
9902
10638
|
const { body: content } = parseFrontmatter(fileContent);
|
|
9903
10639
|
return new _AugmentcodeRule({
|
|
@@ -9933,7 +10669,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9933
10669
|
};
|
|
9934
10670
|
|
|
9935
10671
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
9936
|
-
import { join as
|
|
10672
|
+
import { join as join84 } from "path";
|
|
9937
10673
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
9938
10674
|
static getSettablePaths({
|
|
9939
10675
|
global
|
|
@@ -9952,7 +10688,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9952
10688
|
relativeFilePath: "CLAUDE.md"
|
|
9953
10689
|
},
|
|
9954
10690
|
nonRoot: {
|
|
9955
|
-
relativeDirPath:
|
|
10691
|
+
relativeDirPath: join84(".claude", "memories")
|
|
9956
10692
|
}
|
|
9957
10693
|
};
|
|
9958
10694
|
}
|
|
@@ -9967,7 +10703,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9967
10703
|
if (isRoot) {
|
|
9968
10704
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9969
10705
|
const fileContent2 = await readFileContent(
|
|
9970
|
-
|
|
10706
|
+
join84(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9971
10707
|
);
|
|
9972
10708
|
return new _ClaudecodeLegacyRule({
|
|
9973
10709
|
baseDir,
|
|
@@ -9981,8 +10717,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9981
10717
|
if (!paths.nonRoot) {
|
|
9982
10718
|
throw new Error("nonRoot path is not set");
|
|
9983
10719
|
}
|
|
9984
|
-
const relativePath =
|
|
9985
|
-
const fileContent = await readFileContent(
|
|
10720
|
+
const relativePath = join84(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10721
|
+
const fileContent = await readFileContent(join84(baseDir, relativePath));
|
|
9986
10722
|
return new _ClaudecodeLegacyRule({
|
|
9987
10723
|
baseDir,
|
|
9988
10724
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10041,10 +10777,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
10041
10777
|
};
|
|
10042
10778
|
|
|
10043
10779
|
// src/features/rules/claudecode-rule.ts
|
|
10044
|
-
import { join as
|
|
10045
|
-
import { z as
|
|
10046
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
10047
|
-
paths:
|
|
10780
|
+
import { join as join85 } from "path";
|
|
10781
|
+
import { z as z44 } from "zod/mini";
|
|
10782
|
+
var ClaudecodeRuleFrontmatterSchema = z44.object({
|
|
10783
|
+
paths: z44.optional(z44.string())
|
|
10048
10784
|
});
|
|
10049
10785
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
10050
10786
|
frontmatter;
|
|
@@ -10066,7 +10802,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
10066
10802
|
relativeFilePath: "CLAUDE.md"
|
|
10067
10803
|
},
|
|
10068
10804
|
nonRoot: {
|
|
10069
|
-
relativeDirPath:
|
|
10805
|
+
relativeDirPath: join85(".claude", "rules")
|
|
10070
10806
|
}
|
|
10071
10807
|
};
|
|
10072
10808
|
}
|
|
@@ -10075,7 +10811,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
10075
10811
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10076
10812
|
if (!result.success) {
|
|
10077
10813
|
throw new Error(
|
|
10078
|
-
`Invalid frontmatter in ${
|
|
10814
|
+
`Invalid frontmatter in ${join85(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10079
10815
|
);
|
|
10080
10816
|
}
|
|
10081
10817
|
}
|
|
@@ -10103,7 +10839,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
10103
10839
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
10104
10840
|
if (isRoot) {
|
|
10105
10841
|
const fileContent2 = await readFileContent(
|
|
10106
|
-
|
|
10842
|
+
join85(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
10107
10843
|
);
|
|
10108
10844
|
return new _ClaudecodeRule({
|
|
10109
10845
|
baseDir,
|
|
@@ -10118,13 +10854,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
10118
10854
|
if (!paths.nonRoot) {
|
|
10119
10855
|
throw new Error("nonRoot path is not set");
|
|
10120
10856
|
}
|
|
10121
|
-
const relativePath =
|
|
10122
|
-
const fileContent = await readFileContent(
|
|
10857
|
+
const relativePath = join85(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10858
|
+
const fileContent = await readFileContent(join85(baseDir, relativePath));
|
|
10123
10859
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
10124
10860
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10125
10861
|
if (!result.success) {
|
|
10126
10862
|
throw new Error(
|
|
10127
|
-
`Invalid frontmatter in ${
|
|
10863
|
+
`Invalid frontmatter in ${join85(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
10128
10864
|
);
|
|
10129
10865
|
}
|
|
10130
10866
|
return new _ClaudecodeRule({
|
|
@@ -10231,7 +10967,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
10231
10967
|
return {
|
|
10232
10968
|
success: false,
|
|
10233
10969
|
error: new Error(
|
|
10234
|
-
`Invalid frontmatter in ${
|
|
10970
|
+
`Invalid frontmatter in ${join85(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10235
10971
|
)
|
|
10236
10972
|
};
|
|
10237
10973
|
}
|
|
@@ -10251,10 +10987,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
10251
10987
|
};
|
|
10252
10988
|
|
|
10253
10989
|
// src/features/rules/cline-rule.ts
|
|
10254
|
-
import { join as
|
|
10255
|
-
import { z as
|
|
10256
|
-
var ClineRuleFrontmatterSchema =
|
|
10257
|
-
description:
|
|
10990
|
+
import { join as join86 } from "path";
|
|
10991
|
+
import { z as z45 } from "zod/mini";
|
|
10992
|
+
var ClineRuleFrontmatterSchema = z45.object({
|
|
10993
|
+
description: z45.string()
|
|
10258
10994
|
});
|
|
10259
10995
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
10260
10996
|
static getSettablePaths() {
|
|
@@ -10296,7 +11032,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
10296
11032
|
validate = true
|
|
10297
11033
|
}) {
|
|
10298
11034
|
const fileContent = await readFileContent(
|
|
10299
|
-
|
|
11035
|
+
join86(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10300
11036
|
);
|
|
10301
11037
|
return new _ClineRule({
|
|
10302
11038
|
baseDir,
|
|
@@ -10322,7 +11058,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
10322
11058
|
};
|
|
10323
11059
|
|
|
10324
11060
|
// src/features/rules/codexcli-rule.ts
|
|
10325
|
-
import { join as
|
|
11061
|
+
import { join as join87 } from "path";
|
|
10326
11062
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
10327
11063
|
static getSettablePaths({
|
|
10328
11064
|
global
|
|
@@ -10341,7 +11077,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10341
11077
|
relativeFilePath: "AGENTS.md"
|
|
10342
11078
|
},
|
|
10343
11079
|
nonRoot: {
|
|
10344
|
-
relativeDirPath:
|
|
11080
|
+
relativeDirPath: join87(".codex", "memories")
|
|
10345
11081
|
}
|
|
10346
11082
|
};
|
|
10347
11083
|
}
|
|
@@ -10356,7 +11092,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10356
11092
|
if (isRoot) {
|
|
10357
11093
|
const relativePath2 = paths.root.relativeFilePath;
|
|
10358
11094
|
const fileContent2 = await readFileContent(
|
|
10359
|
-
|
|
11095
|
+
join87(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
10360
11096
|
);
|
|
10361
11097
|
return new _CodexcliRule({
|
|
10362
11098
|
baseDir,
|
|
@@ -10370,8 +11106,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10370
11106
|
if (!paths.nonRoot) {
|
|
10371
11107
|
throw new Error("nonRoot path is not set");
|
|
10372
11108
|
}
|
|
10373
|
-
const relativePath =
|
|
10374
|
-
const fileContent = await readFileContent(
|
|
11109
|
+
const relativePath = join87(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
11110
|
+
const fileContent = await readFileContent(join87(baseDir, relativePath));
|
|
10375
11111
|
return new _CodexcliRule({
|
|
10376
11112
|
baseDir,
|
|
10377
11113
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10430,12 +11166,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
10430
11166
|
};
|
|
10431
11167
|
|
|
10432
11168
|
// src/features/rules/copilot-rule.ts
|
|
10433
|
-
import { join as
|
|
10434
|
-
import { z as
|
|
10435
|
-
var CopilotRuleFrontmatterSchema =
|
|
10436
|
-
description:
|
|
10437
|
-
applyTo:
|
|
10438
|
-
excludeAgent:
|
|
11169
|
+
import { join as join88 } from "path";
|
|
11170
|
+
import { z as z46 } from "zod/mini";
|
|
11171
|
+
var CopilotRuleFrontmatterSchema = z46.object({
|
|
11172
|
+
description: z46.optional(z46.string()),
|
|
11173
|
+
applyTo: z46.optional(z46.string()),
|
|
11174
|
+
excludeAgent: z46.optional(z46.union([z46.literal("code-review"), z46.literal("coding-agent")]))
|
|
10439
11175
|
});
|
|
10440
11176
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
10441
11177
|
frontmatter;
|
|
@@ -10447,7 +11183,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10447
11183
|
relativeFilePath: "copilot-instructions.md"
|
|
10448
11184
|
},
|
|
10449
11185
|
nonRoot: {
|
|
10450
|
-
relativeDirPath:
|
|
11186
|
+
relativeDirPath: join88(".github", "instructions")
|
|
10451
11187
|
}
|
|
10452
11188
|
};
|
|
10453
11189
|
}
|
|
@@ -10456,7 +11192,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10456
11192
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10457
11193
|
if (!result.success) {
|
|
10458
11194
|
throw new Error(
|
|
10459
|
-
`Invalid frontmatter in ${
|
|
11195
|
+
`Invalid frontmatter in ${join88(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10460
11196
|
);
|
|
10461
11197
|
}
|
|
10462
11198
|
}
|
|
@@ -10538,11 +11274,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10538
11274
|
validate = true
|
|
10539
11275
|
}) {
|
|
10540
11276
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
10541
|
-
const relativePath = isRoot ?
|
|
11277
|
+
const relativePath = isRoot ? join88(
|
|
10542
11278
|
this.getSettablePaths().root.relativeDirPath,
|
|
10543
11279
|
this.getSettablePaths().root.relativeFilePath
|
|
10544
|
-
) :
|
|
10545
|
-
const fileContent = await readFileContent(
|
|
11280
|
+
) : join88(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
11281
|
+
const fileContent = await readFileContent(join88(baseDir, relativePath));
|
|
10546
11282
|
if (isRoot) {
|
|
10547
11283
|
return new _CopilotRule({
|
|
10548
11284
|
baseDir,
|
|
@@ -10558,7 +11294,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10558
11294
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10559
11295
|
if (!result.success) {
|
|
10560
11296
|
throw new Error(
|
|
10561
|
-
`Invalid frontmatter in ${
|
|
11297
|
+
`Invalid frontmatter in ${join88(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10562
11298
|
);
|
|
10563
11299
|
}
|
|
10564
11300
|
return new _CopilotRule({
|
|
@@ -10598,7 +11334,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10598
11334
|
return {
|
|
10599
11335
|
success: false,
|
|
10600
11336
|
error: new Error(
|
|
10601
|
-
`Invalid frontmatter in ${
|
|
11337
|
+
`Invalid frontmatter in ${join88(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10602
11338
|
)
|
|
10603
11339
|
};
|
|
10604
11340
|
}
|
|
@@ -10618,12 +11354,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10618
11354
|
};
|
|
10619
11355
|
|
|
10620
11356
|
// src/features/rules/cursor-rule.ts
|
|
10621
|
-
import { join as
|
|
10622
|
-
import { z as
|
|
10623
|
-
var CursorRuleFrontmatterSchema =
|
|
10624
|
-
description:
|
|
10625
|
-
globs:
|
|
10626
|
-
alwaysApply:
|
|
11357
|
+
import { join as join89 } from "path";
|
|
11358
|
+
import { z as z47 } from "zod/mini";
|
|
11359
|
+
var CursorRuleFrontmatterSchema = z47.object({
|
|
11360
|
+
description: z47.optional(z47.string()),
|
|
11361
|
+
globs: z47.optional(z47.string()),
|
|
11362
|
+
alwaysApply: z47.optional(z47.boolean())
|
|
10627
11363
|
});
|
|
10628
11364
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
10629
11365
|
frontmatter;
|
|
@@ -10631,7 +11367,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10631
11367
|
static getSettablePaths() {
|
|
10632
11368
|
return {
|
|
10633
11369
|
nonRoot: {
|
|
10634
|
-
relativeDirPath:
|
|
11370
|
+
relativeDirPath: join89(".cursor", "rules")
|
|
10635
11371
|
}
|
|
10636
11372
|
};
|
|
10637
11373
|
}
|
|
@@ -10640,7 +11376,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10640
11376
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10641
11377
|
if (!result.success) {
|
|
10642
11378
|
throw new Error(
|
|
10643
|
-
`Invalid frontmatter in ${
|
|
11379
|
+
`Invalid frontmatter in ${join89(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10644
11380
|
);
|
|
10645
11381
|
}
|
|
10646
11382
|
}
|
|
@@ -10757,13 +11493,13 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10757
11493
|
validate = true
|
|
10758
11494
|
}) {
|
|
10759
11495
|
const fileContent = await readFileContent(
|
|
10760
|
-
|
|
11496
|
+
join89(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10761
11497
|
);
|
|
10762
11498
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
10763
11499
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10764
11500
|
if (!result.success) {
|
|
10765
11501
|
throw new Error(
|
|
10766
|
-
`Invalid frontmatter in ${
|
|
11502
|
+
`Invalid frontmatter in ${join89(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10767
11503
|
);
|
|
10768
11504
|
}
|
|
10769
11505
|
return new _CursorRule({
|
|
@@ -10800,7 +11536,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10800
11536
|
return {
|
|
10801
11537
|
success: false,
|
|
10802
11538
|
error: new Error(
|
|
10803
|
-
`Invalid frontmatter in ${
|
|
11539
|
+
`Invalid frontmatter in ${join89(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10804
11540
|
)
|
|
10805
11541
|
};
|
|
10806
11542
|
}
|
|
@@ -10820,7 +11556,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10820
11556
|
};
|
|
10821
11557
|
|
|
10822
11558
|
// src/features/rules/geminicli-rule.ts
|
|
10823
|
-
import { join as
|
|
11559
|
+
import { join as join90 } from "path";
|
|
10824
11560
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
10825
11561
|
static getSettablePaths({
|
|
10826
11562
|
global
|
|
@@ -10839,7 +11575,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10839
11575
|
relativeFilePath: "GEMINI.md"
|
|
10840
11576
|
},
|
|
10841
11577
|
nonRoot: {
|
|
10842
|
-
relativeDirPath:
|
|
11578
|
+
relativeDirPath: join90(".gemini", "memories")
|
|
10843
11579
|
}
|
|
10844
11580
|
};
|
|
10845
11581
|
}
|
|
@@ -10854,7 +11590,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10854
11590
|
if (isRoot) {
|
|
10855
11591
|
const relativePath2 = paths.root.relativeFilePath;
|
|
10856
11592
|
const fileContent2 = await readFileContent(
|
|
10857
|
-
|
|
11593
|
+
join90(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
10858
11594
|
);
|
|
10859
11595
|
return new _GeminiCliRule({
|
|
10860
11596
|
baseDir,
|
|
@@ -10868,8 +11604,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10868
11604
|
if (!paths.nonRoot) {
|
|
10869
11605
|
throw new Error("nonRoot path is not set");
|
|
10870
11606
|
}
|
|
10871
|
-
const relativePath =
|
|
10872
|
-
const fileContent = await readFileContent(
|
|
11607
|
+
const relativePath = join90(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
11608
|
+
const fileContent = await readFileContent(join90(baseDir, relativePath));
|
|
10873
11609
|
return new _GeminiCliRule({
|
|
10874
11610
|
baseDir,
|
|
10875
11611
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10928,7 +11664,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10928
11664
|
};
|
|
10929
11665
|
|
|
10930
11666
|
// src/features/rules/junie-rule.ts
|
|
10931
|
-
import { join as
|
|
11667
|
+
import { join as join91 } from "path";
|
|
10932
11668
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
10933
11669
|
static getSettablePaths() {
|
|
10934
11670
|
return {
|
|
@@ -10937,7 +11673,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10937
11673
|
relativeFilePath: "guidelines.md"
|
|
10938
11674
|
},
|
|
10939
11675
|
nonRoot: {
|
|
10940
|
-
relativeDirPath:
|
|
11676
|
+
relativeDirPath: join91(".junie", "memories")
|
|
10941
11677
|
}
|
|
10942
11678
|
};
|
|
10943
11679
|
}
|
|
@@ -10947,8 +11683,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10947
11683
|
validate = true
|
|
10948
11684
|
}) {
|
|
10949
11685
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
10950
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
10951
|
-
const fileContent = await readFileContent(
|
|
11686
|
+
const relativePath = isRoot ? "guidelines.md" : join91(".junie", "memories", relativeFilePath);
|
|
11687
|
+
const fileContent = await readFileContent(join91(baseDir, relativePath));
|
|
10952
11688
|
return new _JunieRule({
|
|
10953
11689
|
baseDir,
|
|
10954
11690
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -11003,12 +11739,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
11003
11739
|
};
|
|
11004
11740
|
|
|
11005
11741
|
// src/features/rules/kilo-rule.ts
|
|
11006
|
-
import { join as
|
|
11742
|
+
import { join as join92 } from "path";
|
|
11007
11743
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
11008
11744
|
static getSettablePaths(_options = {}) {
|
|
11009
11745
|
return {
|
|
11010
11746
|
nonRoot: {
|
|
11011
|
-
relativeDirPath:
|
|
11747
|
+
relativeDirPath: join92(".kilocode", "rules")
|
|
11012
11748
|
}
|
|
11013
11749
|
};
|
|
11014
11750
|
}
|
|
@@ -11018,7 +11754,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
11018
11754
|
validate = true
|
|
11019
11755
|
}) {
|
|
11020
11756
|
const fileContent = await readFileContent(
|
|
11021
|
-
|
|
11757
|
+
join92(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
11022
11758
|
);
|
|
11023
11759
|
return new _KiloRule({
|
|
11024
11760
|
baseDir,
|
|
@@ -11070,12 +11806,12 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
11070
11806
|
};
|
|
11071
11807
|
|
|
11072
11808
|
// src/features/rules/kiro-rule.ts
|
|
11073
|
-
import { join as
|
|
11809
|
+
import { join as join93 } from "path";
|
|
11074
11810
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
11075
11811
|
static getSettablePaths() {
|
|
11076
11812
|
return {
|
|
11077
11813
|
nonRoot: {
|
|
11078
|
-
relativeDirPath:
|
|
11814
|
+
relativeDirPath: join93(".kiro", "steering")
|
|
11079
11815
|
}
|
|
11080
11816
|
};
|
|
11081
11817
|
}
|
|
@@ -11085,7 +11821,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
11085
11821
|
validate = true
|
|
11086
11822
|
}) {
|
|
11087
11823
|
const fileContent = await readFileContent(
|
|
11088
|
-
|
|
11824
|
+
join93(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
11089
11825
|
);
|
|
11090
11826
|
return new _KiroRule({
|
|
11091
11827
|
baseDir,
|
|
@@ -11139,7 +11875,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
11139
11875
|
};
|
|
11140
11876
|
|
|
11141
11877
|
// src/features/rules/opencode-rule.ts
|
|
11142
|
-
import { join as
|
|
11878
|
+
import { join as join94 } from "path";
|
|
11143
11879
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
11144
11880
|
static getSettablePaths() {
|
|
11145
11881
|
return {
|
|
@@ -11148,7 +11884,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
11148
11884
|
relativeFilePath: "AGENTS.md"
|
|
11149
11885
|
},
|
|
11150
11886
|
nonRoot: {
|
|
11151
|
-
relativeDirPath:
|
|
11887
|
+
relativeDirPath: join94(".opencode", "memories")
|
|
11152
11888
|
}
|
|
11153
11889
|
};
|
|
11154
11890
|
}
|
|
@@ -11158,8 +11894,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
11158
11894
|
validate = true
|
|
11159
11895
|
}) {
|
|
11160
11896
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
11161
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
11162
|
-
const fileContent = await readFileContent(
|
|
11897
|
+
const relativePath = isRoot ? "AGENTS.md" : join94(".opencode", "memories", relativeFilePath);
|
|
11898
|
+
const fileContent = await readFileContent(join94(baseDir, relativePath));
|
|
11163
11899
|
return new _OpenCodeRule({
|
|
11164
11900
|
baseDir,
|
|
11165
11901
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -11214,7 +11950,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
11214
11950
|
};
|
|
11215
11951
|
|
|
11216
11952
|
// src/features/rules/qwencode-rule.ts
|
|
11217
|
-
import { join as
|
|
11953
|
+
import { join as join95 } from "path";
|
|
11218
11954
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
11219
11955
|
static getSettablePaths() {
|
|
11220
11956
|
return {
|
|
@@ -11223,7 +11959,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
11223
11959
|
relativeFilePath: "QWEN.md"
|
|
11224
11960
|
},
|
|
11225
11961
|
nonRoot: {
|
|
11226
|
-
relativeDirPath:
|
|
11962
|
+
relativeDirPath: join95(".qwen", "memories")
|
|
11227
11963
|
}
|
|
11228
11964
|
};
|
|
11229
11965
|
}
|
|
@@ -11233,8 +11969,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
11233
11969
|
validate = true
|
|
11234
11970
|
}) {
|
|
11235
11971
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
11236
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
11237
|
-
const fileContent = await readFileContent(
|
|
11972
|
+
const relativePath = isRoot ? "QWEN.md" : join95(".qwen", "memories", relativeFilePath);
|
|
11973
|
+
const fileContent = await readFileContent(join95(baseDir, relativePath));
|
|
11238
11974
|
return new _QwencodeRule({
|
|
11239
11975
|
baseDir,
|
|
11240
11976
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -11286,7 +12022,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
11286
12022
|
};
|
|
11287
12023
|
|
|
11288
12024
|
// src/features/rules/replit-rule.ts
|
|
11289
|
-
import { join as
|
|
12025
|
+
import { join as join96 } from "path";
|
|
11290
12026
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
11291
12027
|
static getSettablePaths() {
|
|
11292
12028
|
return {
|
|
@@ -11308,7 +12044,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
11308
12044
|
}
|
|
11309
12045
|
const relativePath = paths.root.relativeFilePath;
|
|
11310
12046
|
const fileContent = await readFileContent(
|
|
11311
|
-
|
|
12047
|
+
join96(baseDir, paths.root.relativeDirPath, relativePath)
|
|
11312
12048
|
);
|
|
11313
12049
|
return new _ReplitRule({
|
|
11314
12050
|
baseDir,
|
|
@@ -11374,12 +12110,12 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
11374
12110
|
};
|
|
11375
12111
|
|
|
11376
12112
|
// src/features/rules/roo-rule.ts
|
|
11377
|
-
import { join as
|
|
12113
|
+
import { join as join97 } from "path";
|
|
11378
12114
|
var RooRule = class _RooRule extends ToolRule {
|
|
11379
12115
|
static getSettablePaths() {
|
|
11380
12116
|
return {
|
|
11381
12117
|
nonRoot: {
|
|
11382
|
-
relativeDirPath:
|
|
12118
|
+
relativeDirPath: join97(".roo", "rules")
|
|
11383
12119
|
}
|
|
11384
12120
|
};
|
|
11385
12121
|
}
|
|
@@ -11389,7 +12125,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
11389
12125
|
validate = true
|
|
11390
12126
|
}) {
|
|
11391
12127
|
const fileContent = await readFileContent(
|
|
11392
|
-
|
|
12128
|
+
join97(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
11393
12129
|
);
|
|
11394
12130
|
return new _RooRule({
|
|
11395
12131
|
baseDir,
|
|
@@ -11458,7 +12194,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
11458
12194
|
};
|
|
11459
12195
|
|
|
11460
12196
|
// src/features/rules/warp-rule.ts
|
|
11461
|
-
import { join as
|
|
12197
|
+
import { join as join98 } from "path";
|
|
11462
12198
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
11463
12199
|
constructor({ fileContent, root, ...rest }) {
|
|
11464
12200
|
super({
|
|
@@ -11474,7 +12210,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11474
12210
|
relativeFilePath: "WARP.md"
|
|
11475
12211
|
},
|
|
11476
12212
|
nonRoot: {
|
|
11477
|
-
relativeDirPath:
|
|
12213
|
+
relativeDirPath: join98(".warp", "memories")
|
|
11478
12214
|
}
|
|
11479
12215
|
};
|
|
11480
12216
|
}
|
|
@@ -11484,8 +12220,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11484
12220
|
validate = true
|
|
11485
12221
|
}) {
|
|
11486
12222
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
11487
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
11488
|
-
const fileContent = await readFileContent(
|
|
12223
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join98(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
12224
|
+
const fileContent = await readFileContent(join98(baseDir, relativePath));
|
|
11489
12225
|
return new _WarpRule({
|
|
11490
12226
|
baseDir,
|
|
11491
12227
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -11540,12 +12276,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11540
12276
|
};
|
|
11541
12277
|
|
|
11542
12278
|
// src/features/rules/windsurf-rule.ts
|
|
11543
|
-
import { join as
|
|
12279
|
+
import { join as join99 } from "path";
|
|
11544
12280
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
11545
12281
|
static getSettablePaths() {
|
|
11546
12282
|
return {
|
|
11547
12283
|
nonRoot: {
|
|
11548
|
-
relativeDirPath:
|
|
12284
|
+
relativeDirPath: join99(".windsurf", "rules")
|
|
11549
12285
|
}
|
|
11550
12286
|
};
|
|
11551
12287
|
}
|
|
@@ -11555,7 +12291,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
11555
12291
|
validate = true
|
|
11556
12292
|
}) {
|
|
11557
12293
|
const fileContent = await readFileContent(
|
|
11558
|
-
|
|
12294
|
+
join99(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
11559
12295
|
);
|
|
11560
12296
|
return new _WindsurfRule({
|
|
11561
12297
|
baseDir,
|
|
@@ -11629,7 +12365,7 @@ var rulesProcessorToolTargets = [
|
|
|
11629
12365
|
"warp",
|
|
11630
12366
|
"windsurf"
|
|
11631
12367
|
];
|
|
11632
|
-
var RulesProcessorToolTargetSchema =
|
|
12368
|
+
var RulesProcessorToolTargetSchema = z48.enum(rulesProcessorToolTargets);
|
|
11633
12369
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
11634
12370
|
[
|
|
11635
12371
|
"agentsmd",
|
|
@@ -11924,7 +12660,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11924
12660
|
}).relativeDirPath;
|
|
11925
12661
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
11926
12662
|
const frontmatter = skill.getFrontmatter();
|
|
11927
|
-
const relativePath =
|
|
12663
|
+
const relativePath = join100(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
11928
12664
|
return {
|
|
11929
12665
|
name: frontmatter.name,
|
|
11930
12666
|
description: frontmatter.description,
|
|
@@ -12035,8 +12771,8 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
12035
12771
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
12036
12772
|
*/
|
|
12037
12773
|
async loadRulesyncFiles() {
|
|
12038
|
-
const rulesyncBaseDir =
|
|
12039
|
-
const files = await findFilesByGlobs(
|
|
12774
|
+
const rulesyncBaseDir = join100(this.baseDir, RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12775
|
+
const files = await findFilesByGlobs(join100(rulesyncBaseDir, "**", "*.md"));
|
|
12040
12776
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
12041
12777
|
const rulesyncRules = await Promise.all(
|
|
12042
12778
|
files.map((file) => {
|
|
@@ -12094,7 +12830,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
12094
12830
|
return [];
|
|
12095
12831
|
}
|
|
12096
12832
|
const rootFilePaths = await findFilesByGlobs(
|
|
12097
|
-
|
|
12833
|
+
join100(
|
|
12098
12834
|
this.baseDir,
|
|
12099
12835
|
settablePaths.root.relativeDirPath ?? ".",
|
|
12100
12836
|
settablePaths.root.relativeFilePath
|
|
@@ -12132,7 +12868,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
12132
12868
|
return [];
|
|
12133
12869
|
}
|
|
12134
12870
|
const localRootFilePaths = await findFilesByGlobs(
|
|
12135
|
-
|
|
12871
|
+
join100(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md")
|
|
12136
12872
|
);
|
|
12137
12873
|
return localRootFilePaths.map(
|
|
12138
12874
|
(filePath) => factory.class.forDeletion({
|
|
@@ -12148,9 +12884,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
12148
12884
|
if (!settablePaths.nonRoot) {
|
|
12149
12885
|
return [];
|
|
12150
12886
|
}
|
|
12151
|
-
const nonRootBaseDir =
|
|
12887
|
+
const nonRootBaseDir = join100(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
12152
12888
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
12153
|
-
|
|
12889
|
+
join100(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
12154
12890
|
);
|
|
12155
12891
|
if (forDeletion) {
|
|
12156
12892
|
return nonRootFilePaths.map((filePath) => {
|
|
@@ -12266,14 +13002,14 @@ s/<command> [arguments]
|
|
|
12266
13002
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
12267
13003
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
12268
13004
|
|
|
12269
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
13005
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join100(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
12270
13006
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
12271
13007
|
|
|
12272
13008
|
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.
|
|
12273
13009
|
|
|
12274
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
13010
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join100(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
12275
13011
|
|
|
12276
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
13012
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join100(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
12277
13013
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
12278
13014
|
const result = [
|
|
12279
13015
|
overview,
|
|
@@ -12302,7 +13038,7 @@ ${toonContent}`;
|
|
|
12302
13038
|
|
|
12303
13039
|
// src/lib/generate.ts
|
|
12304
13040
|
async function checkRulesyncDirExists(params) {
|
|
12305
|
-
return fileExists(
|
|
13041
|
+
return fileExists(join101(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
12306
13042
|
}
|
|
12307
13043
|
async function generate(params) {
|
|
12308
13044
|
const { config } = params;
|
|
@@ -12311,6 +13047,7 @@ async function generate(params) {
|
|
|
12311
13047
|
const commandsCount = await generateCommandsCore({ config });
|
|
12312
13048
|
const subagentsCount = await generateSubagentsCore({ config });
|
|
12313
13049
|
const skillsResult = await generateSkillsCore({ config });
|
|
13050
|
+
const hooksCount = await generateHooksCore({ config });
|
|
12314
13051
|
const rulesCount = await generateRulesCore({ config, skills: skillsResult.skills });
|
|
12315
13052
|
return {
|
|
12316
13053
|
rulesCount,
|
|
@@ -12319,6 +13056,7 @@ async function generate(params) {
|
|
|
12319
13056
|
commandsCount,
|
|
12320
13057
|
subagentsCount,
|
|
12321
13058
|
skillsCount: skillsResult.count,
|
|
13059
|
+
hooksCount,
|
|
12322
13060
|
skills: skillsResult.skills
|
|
12323
13061
|
};
|
|
12324
13062
|
}
|
|
@@ -12523,6 +13261,38 @@ async function generateSkillsCore(params) {
|
|
|
12523
13261
|
}
|
|
12524
13262
|
return { count: totalCount, skills: allSkills };
|
|
12525
13263
|
}
|
|
13264
|
+
async function generateHooksCore(params) {
|
|
13265
|
+
const { config } = params;
|
|
13266
|
+
if (!config.getFeatures().includes("hooks")) {
|
|
13267
|
+
return 0;
|
|
13268
|
+
}
|
|
13269
|
+
let totalCount = 0;
|
|
13270
|
+
const toolTargets = intersection(
|
|
13271
|
+
config.getTargets(),
|
|
13272
|
+
HooksProcessor.getToolTargets({ global: config.getGlobal() })
|
|
13273
|
+
);
|
|
13274
|
+
for (const baseDir of config.getBaseDirs()) {
|
|
13275
|
+
for (const toolTarget of toolTargets) {
|
|
13276
|
+
const processor = new HooksProcessor({
|
|
13277
|
+
baseDir,
|
|
13278
|
+
toolTarget,
|
|
13279
|
+
global: config.getGlobal()
|
|
13280
|
+
});
|
|
13281
|
+
if (config.getDelete()) {
|
|
13282
|
+
const oldToolFiles = await processor.loadToolFiles({ forDeletion: true });
|
|
13283
|
+
await processor.removeAiFiles(oldToolFiles);
|
|
13284
|
+
}
|
|
13285
|
+
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
13286
|
+
if (rulesyncFiles.length === 0) {
|
|
13287
|
+
continue;
|
|
13288
|
+
}
|
|
13289
|
+
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
13290
|
+
const writtenCount = await processor.writeAiFiles(toolFiles);
|
|
13291
|
+
totalCount += writtenCount;
|
|
13292
|
+
}
|
|
13293
|
+
}
|
|
13294
|
+
return totalCount;
|
|
13295
|
+
}
|
|
12526
13296
|
|
|
12527
13297
|
// src/cli/commands/generate.ts
|
|
12528
13298
|
async function generateCommand(options) {
|
|
@@ -12556,6 +13326,9 @@ async function generateCommand(options) {
|
|
|
12556
13326
|
if (features.includes("skills")) {
|
|
12557
13327
|
logger.info("Generating skill files...");
|
|
12558
13328
|
}
|
|
13329
|
+
if (features.includes("hooks")) {
|
|
13330
|
+
logger.info("Generating hooks...");
|
|
13331
|
+
}
|
|
12559
13332
|
if (features.includes("rules")) {
|
|
12560
13333
|
logger.info("Generating rule files...");
|
|
12561
13334
|
}
|
|
@@ -12575,10 +13348,13 @@ async function generateCommand(options) {
|
|
|
12575
13348
|
if (result.skillsCount > 0) {
|
|
12576
13349
|
logger.success(`Generated ${result.skillsCount} skill(s)`);
|
|
12577
13350
|
}
|
|
13351
|
+
if (result.hooksCount > 0) {
|
|
13352
|
+
logger.success(`Generated ${result.hooksCount} hooks file(s)`);
|
|
13353
|
+
}
|
|
12578
13354
|
if (result.rulesCount > 0) {
|
|
12579
13355
|
logger.success(`Generated ${result.rulesCount} rule(s)`);
|
|
12580
13356
|
}
|
|
12581
|
-
const totalGenerated = result.rulesCount + result.ignoreCount + result.mcpCount + result.commandsCount + result.subagentsCount + result.skillsCount;
|
|
13357
|
+
const totalGenerated = result.rulesCount + result.ignoreCount + result.mcpCount + result.commandsCount + result.subagentsCount + result.skillsCount + result.hooksCount;
|
|
12582
13358
|
if (totalGenerated === 0) {
|
|
12583
13359
|
const enabledFeatures = features.join(", ");
|
|
12584
13360
|
logger.warn(`\u26A0\uFE0F No files generated for enabled features: ${enabledFeatures}`);
|
|
@@ -12591,11 +13367,12 @@ async function generateCommand(options) {
|
|
|
12591
13367
|
if (result.commandsCount > 0) parts.push(`${result.commandsCount} commands`);
|
|
12592
13368
|
if (result.subagentsCount > 0) parts.push(`${result.subagentsCount} subagents`);
|
|
12593
13369
|
if (result.skillsCount > 0) parts.push(`${result.skillsCount} skills`);
|
|
13370
|
+
if (result.hooksCount > 0) parts.push(`${result.hooksCount} hooks`);
|
|
12594
13371
|
logger.success(`\u{1F389} All done! Generated ${totalGenerated} file(s) total (${parts.join(" + ")})`);
|
|
12595
13372
|
}
|
|
12596
13373
|
|
|
12597
13374
|
// src/cli/commands/gitignore.ts
|
|
12598
|
-
import { join as
|
|
13375
|
+
import { join as join102 } from "path";
|
|
12599
13376
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
12600
13377
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
12601
13378
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -12740,7 +13517,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
12740
13517
|
return result;
|
|
12741
13518
|
};
|
|
12742
13519
|
var gitignoreCommand = async () => {
|
|
12743
|
-
const gitignorePath =
|
|
13520
|
+
const gitignorePath = join102(process.cwd(), ".gitignore");
|
|
12744
13521
|
let gitignoreContent = "";
|
|
12745
13522
|
if (await fileExists(gitignorePath)) {
|
|
12746
13523
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -12763,30 +13540,28 @@ ${rulesyncBlock}
|
|
|
12763
13540
|
}
|
|
12764
13541
|
};
|
|
12765
13542
|
|
|
12766
|
-
// src/
|
|
12767
|
-
async function
|
|
12768
|
-
|
|
12769
|
-
|
|
12770
|
-
|
|
12771
|
-
}
|
|
12772
|
-
|
|
12773
|
-
|
|
12774
|
-
|
|
12775
|
-
}
|
|
12776
|
-
|
|
12777
|
-
|
|
12778
|
-
|
|
12779
|
-
|
|
12780
|
-
|
|
12781
|
-
|
|
12782
|
-
|
|
12783
|
-
|
|
12784
|
-
|
|
12785
|
-
await importCommands(config, tool);
|
|
12786
|
-
await importSubagents(config, tool);
|
|
12787
|
-
await importSkills(config, tool);
|
|
13543
|
+
// src/lib/import.ts
|
|
13544
|
+
async function importFromTool(params) {
|
|
13545
|
+
const { config, tool } = params;
|
|
13546
|
+
const rulesCount = await importRulesCore({ config, tool });
|
|
13547
|
+
const ignoreCount = await importIgnoreCore({ config, tool });
|
|
13548
|
+
const mcpCount = await importMcpCore({ config, tool });
|
|
13549
|
+
const commandsCount = await importCommandsCore({ config, tool });
|
|
13550
|
+
const subagentsCount = await importSubagentsCore({ config, tool });
|
|
13551
|
+
const skillsCount = await importSkillsCore({ config, tool });
|
|
13552
|
+
const hooksCount = await importHooksCore({ config, tool });
|
|
13553
|
+
return {
|
|
13554
|
+
rulesCount,
|
|
13555
|
+
ignoreCount,
|
|
13556
|
+
mcpCount,
|
|
13557
|
+
commandsCount,
|
|
13558
|
+
subagentsCount,
|
|
13559
|
+
skillsCount,
|
|
13560
|
+
hooksCount
|
|
13561
|
+
};
|
|
12788
13562
|
}
|
|
12789
|
-
async function
|
|
13563
|
+
async function importRulesCore(params) {
|
|
13564
|
+
const { config, tool } = params;
|
|
12790
13565
|
if (!config.getFeatures().includes("rules")) {
|
|
12791
13566
|
return 0;
|
|
12792
13567
|
}
|
|
@@ -12811,7 +13586,8 @@ async function importRules(config, tool) {
|
|
|
12811
13586
|
}
|
|
12812
13587
|
return writtenCount;
|
|
12813
13588
|
}
|
|
12814
|
-
async function
|
|
13589
|
+
async function importIgnoreCore(params) {
|
|
13590
|
+
const { config, tool } = params;
|
|
12815
13591
|
if (!config.getFeatures().includes("ignore")) {
|
|
12816
13592
|
return 0;
|
|
12817
13593
|
}
|
|
@@ -12840,7 +13616,8 @@ async function importIgnore(config, tool) {
|
|
|
12840
13616
|
}
|
|
12841
13617
|
return writtenCount;
|
|
12842
13618
|
}
|
|
12843
|
-
async function
|
|
13619
|
+
async function importMcpCore(params) {
|
|
13620
|
+
const { config, tool } = params;
|
|
12844
13621
|
if (!config.getFeatures().includes("mcp")) {
|
|
12845
13622
|
return 0;
|
|
12846
13623
|
}
|
|
@@ -12865,7 +13642,8 @@ async function importMcp(config, tool) {
|
|
|
12865
13642
|
}
|
|
12866
13643
|
return writtenCount;
|
|
12867
13644
|
}
|
|
12868
|
-
async function
|
|
13645
|
+
async function importCommandsCore(params) {
|
|
13646
|
+
const { config, tool } = params;
|
|
12869
13647
|
if (!config.getFeatures().includes("commands")) {
|
|
12870
13648
|
return 0;
|
|
12871
13649
|
}
|
|
@@ -12890,7 +13668,8 @@ async function importCommands(config, tool) {
|
|
|
12890
13668
|
}
|
|
12891
13669
|
return writtenCount;
|
|
12892
13670
|
}
|
|
12893
|
-
async function
|
|
13671
|
+
async function importSubagentsCore(params) {
|
|
13672
|
+
const { config, tool } = params;
|
|
12894
13673
|
if (!config.getFeatures().includes("subagents")) {
|
|
12895
13674
|
return 0;
|
|
12896
13675
|
}
|
|
@@ -12915,7 +13694,8 @@ async function importSubagents(config, tool) {
|
|
|
12915
13694
|
}
|
|
12916
13695
|
return writtenCount;
|
|
12917
13696
|
}
|
|
12918
|
-
async function
|
|
13697
|
+
async function importSkillsCore(params) {
|
|
13698
|
+
const { config, tool } = params;
|
|
12919
13699
|
if (!config.getFeatures().includes("skills")) {
|
|
12920
13700
|
return 0;
|
|
12921
13701
|
}
|
|
@@ -12940,9 +13720,70 @@ async function importSkills(config, tool) {
|
|
|
12940
13720
|
}
|
|
12941
13721
|
return writtenCount;
|
|
12942
13722
|
}
|
|
13723
|
+
async function importHooksCore(params) {
|
|
13724
|
+
const { config, tool } = params;
|
|
13725
|
+
if (!config.getFeatures().includes("hooks")) {
|
|
13726
|
+
return 0;
|
|
13727
|
+
}
|
|
13728
|
+
const global = config.getGlobal();
|
|
13729
|
+
const supportedTargets = HooksProcessor.getToolTargets({ global });
|
|
13730
|
+
if (!supportedTargets.includes(tool)) {
|
|
13731
|
+
return 0;
|
|
13732
|
+
}
|
|
13733
|
+
const hooksProcessor = new HooksProcessor({
|
|
13734
|
+
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
13735
|
+
toolTarget: tool,
|
|
13736
|
+
global
|
|
13737
|
+
});
|
|
13738
|
+
const toolFiles = await hooksProcessor.loadToolFiles();
|
|
13739
|
+
if (toolFiles.length === 0) {
|
|
13740
|
+
return 0;
|
|
13741
|
+
}
|
|
13742
|
+
const rulesyncFiles = await hooksProcessor.convertToolFilesToRulesyncFiles(toolFiles);
|
|
13743
|
+
const writtenCount = await hooksProcessor.writeAiFiles(rulesyncFiles);
|
|
13744
|
+
if (config.getVerbose() && writtenCount > 0) {
|
|
13745
|
+
logger.success(`Created ${writtenCount} hooks file(s)`);
|
|
13746
|
+
}
|
|
13747
|
+
return writtenCount;
|
|
13748
|
+
}
|
|
13749
|
+
|
|
13750
|
+
// src/cli/commands/import.ts
|
|
13751
|
+
async function importCommand(options) {
|
|
13752
|
+
if (!options.targets) {
|
|
13753
|
+
logger.error("No tools found in --targets");
|
|
13754
|
+
process.exit(1);
|
|
13755
|
+
}
|
|
13756
|
+
if (options.targets.length > 1) {
|
|
13757
|
+
logger.error("Only one tool can be imported at a time");
|
|
13758
|
+
process.exit(1);
|
|
13759
|
+
}
|
|
13760
|
+
const config = await ConfigResolver.resolve(options);
|
|
13761
|
+
logger.configure({
|
|
13762
|
+
verbose: config.getVerbose(),
|
|
13763
|
+
silent: config.getSilent()
|
|
13764
|
+
});
|
|
13765
|
+
const tool = config.getTargets()[0];
|
|
13766
|
+
logger.info(`Importing files from ${tool}...`);
|
|
13767
|
+
const result = await importFromTool({ config, tool });
|
|
13768
|
+
const totalImported = result.rulesCount + result.ignoreCount + result.mcpCount + result.commandsCount + result.subagentsCount + result.skillsCount + result.hooksCount;
|
|
13769
|
+
if (totalImported === 0) {
|
|
13770
|
+
const enabledFeatures = config.getFeatures().join(", ");
|
|
13771
|
+
logger.warn(`No files imported for enabled features: ${enabledFeatures}`);
|
|
13772
|
+
return;
|
|
13773
|
+
}
|
|
13774
|
+
const parts = [];
|
|
13775
|
+
if (result.rulesCount > 0) parts.push(`${result.rulesCount} rules`);
|
|
13776
|
+
if (result.ignoreCount > 0) parts.push(`${result.ignoreCount} ignore files`);
|
|
13777
|
+
if (result.mcpCount > 0) parts.push(`${result.mcpCount} MCP files`);
|
|
13778
|
+
if (result.commandsCount > 0) parts.push(`${result.commandsCount} commands`);
|
|
13779
|
+
if (result.subagentsCount > 0) parts.push(`${result.subagentsCount} subagents`);
|
|
13780
|
+
if (result.skillsCount > 0) parts.push(`${result.skillsCount} skills`);
|
|
13781
|
+
if (result.hooksCount > 0) parts.push(`${result.hooksCount} hooks`);
|
|
13782
|
+
logger.success(`Imported ${totalImported} file(s) total (${parts.join(" + ")})`);
|
|
13783
|
+
}
|
|
12943
13784
|
|
|
12944
13785
|
// src/cli/commands/init.ts
|
|
12945
|
-
import { join as
|
|
13786
|
+
import { join as join103 } from "path";
|
|
12946
13787
|
async function initCommand() {
|
|
12947
13788
|
logger.info("Initializing rulesync...");
|
|
12948
13789
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -13121,14 +13962,14 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
13121
13962
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
13122
13963
|
await ensureDir(skillPaths.relativeDirPath);
|
|
13123
13964
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
13124
|
-
const ruleFilepath =
|
|
13965
|
+
const ruleFilepath = join103(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
13125
13966
|
if (!await fileExists(ruleFilepath)) {
|
|
13126
13967
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
13127
13968
|
logger.success(`Created ${ruleFilepath}`);
|
|
13128
13969
|
} else {
|
|
13129
13970
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
13130
13971
|
}
|
|
13131
|
-
const mcpFilepath =
|
|
13972
|
+
const mcpFilepath = join103(
|
|
13132
13973
|
mcpPaths.recommended.relativeDirPath,
|
|
13133
13974
|
mcpPaths.recommended.relativeFilePath
|
|
13134
13975
|
);
|
|
@@ -13138,30 +13979,30 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
13138
13979
|
} else {
|
|
13139
13980
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
13140
13981
|
}
|
|
13141
|
-
const commandFilepath =
|
|
13982
|
+
const commandFilepath = join103(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
13142
13983
|
if (!await fileExists(commandFilepath)) {
|
|
13143
13984
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
13144
13985
|
logger.success(`Created ${commandFilepath}`);
|
|
13145
13986
|
} else {
|
|
13146
13987
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
13147
13988
|
}
|
|
13148
|
-
const subagentFilepath =
|
|
13989
|
+
const subagentFilepath = join103(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
13149
13990
|
if (!await fileExists(subagentFilepath)) {
|
|
13150
13991
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
13151
13992
|
logger.success(`Created ${subagentFilepath}`);
|
|
13152
13993
|
} else {
|
|
13153
13994
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
13154
13995
|
}
|
|
13155
|
-
const skillDirPath =
|
|
13996
|
+
const skillDirPath = join103(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
13156
13997
|
await ensureDir(skillDirPath);
|
|
13157
|
-
const skillFilepath =
|
|
13998
|
+
const skillFilepath = join103(skillDirPath, SKILL_FILE_NAME);
|
|
13158
13999
|
if (!await fileExists(skillFilepath)) {
|
|
13159
14000
|
await writeFileContent(skillFilepath, sampleSkillFile.content);
|
|
13160
14001
|
logger.success(`Created ${skillFilepath}`);
|
|
13161
14002
|
} else {
|
|
13162
14003
|
logger.info(`Skipped ${skillFilepath} (already exists)`);
|
|
13163
14004
|
}
|
|
13164
|
-
const ignoreFilepath =
|
|
14005
|
+
const ignoreFilepath = join103(
|
|
13165
14006
|
ignorePaths.recommended.relativeDirPath,
|
|
13166
14007
|
ignorePaths.recommended.relativeFilePath
|
|
13167
14008
|
);
|
|
@@ -13177,15 +14018,15 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
13177
14018
|
import { FastMCP } from "fastmcp";
|
|
13178
14019
|
|
|
13179
14020
|
// src/mcp/tools.ts
|
|
13180
|
-
import { z as
|
|
14021
|
+
import { z as z55 } from "zod/mini";
|
|
13181
14022
|
|
|
13182
14023
|
// src/mcp/commands.ts
|
|
13183
|
-
import { basename as basename23, join as
|
|
13184
|
-
import { z as
|
|
14024
|
+
import { basename as basename23, join as join104 } from "path";
|
|
14025
|
+
import { z as z49 } from "zod/mini";
|
|
13185
14026
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
13186
14027
|
var maxCommandsCount = 1e3;
|
|
13187
14028
|
async function listCommands() {
|
|
13188
|
-
const commandsDir =
|
|
14029
|
+
const commandsDir = join104(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
13189
14030
|
try {
|
|
13190
14031
|
const files = await listDirectoryFiles(commandsDir);
|
|
13191
14032
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -13197,7 +14038,7 @@ async function listCommands() {
|
|
|
13197
14038
|
});
|
|
13198
14039
|
const frontmatter = command.getFrontmatter();
|
|
13199
14040
|
return {
|
|
13200
|
-
relativePathFromCwd:
|
|
14041
|
+
relativePathFromCwd: join104(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
13201
14042
|
frontmatter
|
|
13202
14043
|
};
|
|
13203
14044
|
} catch (error) {
|
|
@@ -13223,7 +14064,7 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
13223
14064
|
relativeFilePath: filename
|
|
13224
14065
|
});
|
|
13225
14066
|
return {
|
|
13226
|
-
relativePathFromCwd:
|
|
14067
|
+
relativePathFromCwd: join104(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
13227
14068
|
frontmatter: command.getFrontmatter(),
|
|
13228
14069
|
body: command.getBody()
|
|
13229
14070
|
};
|
|
@@ -13252,7 +14093,7 @@ async function putCommand({
|
|
|
13252
14093
|
try {
|
|
13253
14094
|
const existingCommands = await listCommands();
|
|
13254
14095
|
const isUpdate = existingCommands.some(
|
|
13255
|
-
(command2) => command2.relativePathFromCwd ===
|
|
14096
|
+
(command2) => command2.relativePathFromCwd === join104(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
13256
14097
|
);
|
|
13257
14098
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
13258
14099
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -13267,11 +14108,11 @@ async function putCommand({
|
|
|
13267
14108
|
fileContent,
|
|
13268
14109
|
validate: true
|
|
13269
14110
|
});
|
|
13270
|
-
const commandsDir =
|
|
14111
|
+
const commandsDir = join104(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
13271
14112
|
await ensureDir(commandsDir);
|
|
13272
14113
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
13273
14114
|
return {
|
|
13274
|
-
relativePathFromCwd:
|
|
14115
|
+
relativePathFromCwd: join104(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
13275
14116
|
frontmatter: command.getFrontmatter(),
|
|
13276
14117
|
body: command.getBody()
|
|
13277
14118
|
};
|
|
@@ -13287,11 +14128,11 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
13287
14128
|
intendedRootDir: process.cwd()
|
|
13288
14129
|
});
|
|
13289
14130
|
const filename = basename23(relativePathFromCwd);
|
|
13290
|
-
const fullPath =
|
|
14131
|
+
const fullPath = join104(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
13291
14132
|
try {
|
|
13292
14133
|
await removeFile(fullPath);
|
|
13293
14134
|
return {
|
|
13294
|
-
relativePathFromCwd:
|
|
14135
|
+
relativePathFromCwd: join104(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
13295
14136
|
};
|
|
13296
14137
|
} catch (error) {
|
|
13297
14138
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -13300,23 +14141,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
13300
14141
|
}
|
|
13301
14142
|
}
|
|
13302
14143
|
var commandToolSchemas = {
|
|
13303
|
-
listCommands:
|
|
13304
|
-
getCommand:
|
|
13305
|
-
relativePathFromCwd:
|
|
14144
|
+
listCommands: z49.object({}),
|
|
14145
|
+
getCommand: z49.object({
|
|
14146
|
+
relativePathFromCwd: z49.string()
|
|
13306
14147
|
}),
|
|
13307
|
-
putCommand:
|
|
13308
|
-
relativePathFromCwd:
|
|
14148
|
+
putCommand: z49.object({
|
|
14149
|
+
relativePathFromCwd: z49.string(),
|
|
13309
14150
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
13310
|
-
body:
|
|
14151
|
+
body: z49.string()
|
|
13311
14152
|
}),
|
|
13312
|
-
deleteCommand:
|
|
13313
|
-
relativePathFromCwd:
|
|
14153
|
+
deleteCommand: z49.object({
|
|
14154
|
+
relativePathFromCwd: z49.string()
|
|
13314
14155
|
})
|
|
13315
14156
|
};
|
|
13316
14157
|
var commandTools = {
|
|
13317
14158
|
listCommands: {
|
|
13318
14159
|
name: "listCommands",
|
|
13319
|
-
description: `List all commands from ${
|
|
14160
|
+
description: `List all commands from ${join104(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13320
14161
|
parameters: commandToolSchemas.listCommands,
|
|
13321
14162
|
execute: async () => {
|
|
13322
14163
|
const commands = await listCommands();
|
|
@@ -13358,11 +14199,11 @@ var commandTools = {
|
|
|
13358
14199
|
};
|
|
13359
14200
|
|
|
13360
14201
|
// src/mcp/ignore.ts
|
|
13361
|
-
import { join as
|
|
13362
|
-
import { z as
|
|
14202
|
+
import { join as join105 } from "path";
|
|
14203
|
+
import { z as z50 } from "zod/mini";
|
|
13363
14204
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
13364
14205
|
async function getIgnoreFile() {
|
|
13365
|
-
const ignoreFilePath =
|
|
14206
|
+
const ignoreFilePath = join105(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
13366
14207
|
try {
|
|
13367
14208
|
const content = await readFileContent(ignoreFilePath);
|
|
13368
14209
|
return {
|
|
@@ -13376,7 +14217,7 @@ async function getIgnoreFile() {
|
|
|
13376
14217
|
}
|
|
13377
14218
|
}
|
|
13378
14219
|
async function putIgnoreFile({ content }) {
|
|
13379
|
-
const ignoreFilePath =
|
|
14220
|
+
const ignoreFilePath = join105(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
13380
14221
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
13381
14222
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
13382
14223
|
throw new Error(
|
|
@@ -13397,8 +14238,8 @@ async function putIgnoreFile({ content }) {
|
|
|
13397
14238
|
}
|
|
13398
14239
|
}
|
|
13399
14240
|
async function deleteIgnoreFile() {
|
|
13400
|
-
const aiignorePath =
|
|
13401
|
-
const legacyIgnorePath =
|
|
14241
|
+
const aiignorePath = join105(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
14242
|
+
const legacyIgnorePath = join105(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
13402
14243
|
try {
|
|
13403
14244
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
13404
14245
|
return {
|
|
@@ -13416,11 +14257,11 @@ async function deleteIgnoreFile() {
|
|
|
13416
14257
|
}
|
|
13417
14258
|
}
|
|
13418
14259
|
var ignoreToolSchemas = {
|
|
13419
|
-
getIgnoreFile:
|
|
13420
|
-
putIgnoreFile:
|
|
13421
|
-
content:
|
|
14260
|
+
getIgnoreFile: z50.object({}),
|
|
14261
|
+
putIgnoreFile: z50.object({
|
|
14262
|
+
content: z50.string()
|
|
13422
14263
|
}),
|
|
13423
|
-
deleteIgnoreFile:
|
|
14264
|
+
deleteIgnoreFile: z50.object({})
|
|
13424
14265
|
};
|
|
13425
14266
|
var ignoreTools = {
|
|
13426
14267
|
getIgnoreFile: {
|
|
@@ -13453,8 +14294,8 @@ var ignoreTools = {
|
|
|
13453
14294
|
};
|
|
13454
14295
|
|
|
13455
14296
|
// src/mcp/mcp.ts
|
|
13456
|
-
import { join as
|
|
13457
|
-
import { z as
|
|
14297
|
+
import { join as join106 } from "path";
|
|
14298
|
+
import { z as z51 } from "zod/mini";
|
|
13458
14299
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
13459
14300
|
async function getMcpFile() {
|
|
13460
14301
|
const config = await ConfigResolver.resolve({});
|
|
@@ -13463,7 +14304,7 @@ async function getMcpFile() {
|
|
|
13463
14304
|
validate: true,
|
|
13464
14305
|
modularMcp: config.getModularMcp()
|
|
13465
14306
|
});
|
|
13466
|
-
const relativePathFromCwd =
|
|
14307
|
+
const relativePathFromCwd = join106(
|
|
13467
14308
|
rulesyncMcp.getRelativeDirPath(),
|
|
13468
14309
|
rulesyncMcp.getRelativeFilePath()
|
|
13469
14310
|
);
|
|
@@ -13496,7 +14337,7 @@ async function putMcpFile({ content }) {
|
|
|
13496
14337
|
const paths = RulesyncMcp.getSettablePaths();
|
|
13497
14338
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
13498
14339
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
13499
|
-
const fullPath =
|
|
14340
|
+
const fullPath = join106(baseDir, relativeDirPath, relativeFilePath);
|
|
13500
14341
|
const rulesyncMcp = new RulesyncMcp({
|
|
13501
14342
|
baseDir,
|
|
13502
14343
|
relativeDirPath,
|
|
@@ -13505,9 +14346,9 @@ async function putMcpFile({ content }) {
|
|
|
13505
14346
|
validate: true,
|
|
13506
14347
|
modularMcp: config.getModularMcp()
|
|
13507
14348
|
});
|
|
13508
|
-
await ensureDir(
|
|
14349
|
+
await ensureDir(join106(baseDir, relativeDirPath));
|
|
13509
14350
|
await writeFileContent(fullPath, content);
|
|
13510
|
-
const relativePathFromCwd =
|
|
14351
|
+
const relativePathFromCwd = join106(relativeDirPath, relativeFilePath);
|
|
13511
14352
|
return {
|
|
13512
14353
|
relativePathFromCwd,
|
|
13513
14354
|
content: rulesyncMcp.getFileContent()
|
|
@@ -13522,15 +14363,15 @@ async function deleteMcpFile() {
|
|
|
13522
14363
|
try {
|
|
13523
14364
|
const baseDir = process.cwd();
|
|
13524
14365
|
const paths = RulesyncMcp.getSettablePaths();
|
|
13525
|
-
const recommendedPath =
|
|
14366
|
+
const recommendedPath = join106(
|
|
13526
14367
|
baseDir,
|
|
13527
14368
|
paths.recommended.relativeDirPath,
|
|
13528
14369
|
paths.recommended.relativeFilePath
|
|
13529
14370
|
);
|
|
13530
|
-
const legacyPath =
|
|
14371
|
+
const legacyPath = join106(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
13531
14372
|
await removeFile(recommendedPath);
|
|
13532
14373
|
await removeFile(legacyPath);
|
|
13533
|
-
const relativePathFromCwd =
|
|
14374
|
+
const relativePathFromCwd = join106(
|
|
13534
14375
|
paths.recommended.relativeDirPath,
|
|
13535
14376
|
paths.recommended.relativeFilePath
|
|
13536
14377
|
);
|
|
@@ -13544,11 +14385,11 @@ async function deleteMcpFile() {
|
|
|
13544
14385
|
}
|
|
13545
14386
|
}
|
|
13546
14387
|
var mcpToolSchemas = {
|
|
13547
|
-
getMcpFile:
|
|
13548
|
-
putMcpFile:
|
|
13549
|
-
content:
|
|
14388
|
+
getMcpFile: z51.object({}),
|
|
14389
|
+
putMcpFile: z51.object({
|
|
14390
|
+
content: z51.string()
|
|
13550
14391
|
}),
|
|
13551
|
-
deleteMcpFile:
|
|
14392
|
+
deleteMcpFile: z51.object({})
|
|
13552
14393
|
};
|
|
13553
14394
|
var mcpTools = {
|
|
13554
14395
|
getMcpFile: {
|
|
@@ -13581,12 +14422,12 @@ var mcpTools = {
|
|
|
13581
14422
|
};
|
|
13582
14423
|
|
|
13583
14424
|
// src/mcp/rules.ts
|
|
13584
|
-
import { basename as basename24, join as
|
|
13585
|
-
import { z as
|
|
14425
|
+
import { basename as basename24, join as join107 } from "path";
|
|
14426
|
+
import { z as z52 } from "zod/mini";
|
|
13586
14427
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
13587
14428
|
var maxRulesCount = 1e3;
|
|
13588
14429
|
async function listRules() {
|
|
13589
|
-
const rulesDir =
|
|
14430
|
+
const rulesDir = join107(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
13590
14431
|
try {
|
|
13591
14432
|
const files = await listDirectoryFiles(rulesDir);
|
|
13592
14433
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -13599,7 +14440,7 @@ async function listRules() {
|
|
|
13599
14440
|
});
|
|
13600
14441
|
const frontmatter = rule.getFrontmatter();
|
|
13601
14442
|
return {
|
|
13602
|
-
relativePathFromCwd:
|
|
14443
|
+
relativePathFromCwd: join107(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
13603
14444
|
frontmatter
|
|
13604
14445
|
};
|
|
13605
14446
|
} catch (error) {
|
|
@@ -13626,7 +14467,7 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
13626
14467
|
validate: true
|
|
13627
14468
|
});
|
|
13628
14469
|
return {
|
|
13629
|
-
relativePathFromCwd:
|
|
14470
|
+
relativePathFromCwd: join107(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
13630
14471
|
frontmatter: rule.getFrontmatter(),
|
|
13631
14472
|
body: rule.getBody()
|
|
13632
14473
|
};
|
|
@@ -13655,7 +14496,7 @@ async function putRule({
|
|
|
13655
14496
|
try {
|
|
13656
14497
|
const existingRules = await listRules();
|
|
13657
14498
|
const isUpdate = existingRules.some(
|
|
13658
|
-
(rule2) => rule2.relativePathFromCwd ===
|
|
14499
|
+
(rule2) => rule2.relativePathFromCwd === join107(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
13659
14500
|
);
|
|
13660
14501
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
13661
14502
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -13668,11 +14509,11 @@ async function putRule({
|
|
|
13668
14509
|
body,
|
|
13669
14510
|
validate: true
|
|
13670
14511
|
});
|
|
13671
|
-
const rulesDir =
|
|
14512
|
+
const rulesDir = join107(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
13672
14513
|
await ensureDir(rulesDir);
|
|
13673
14514
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
13674
14515
|
return {
|
|
13675
|
-
relativePathFromCwd:
|
|
14516
|
+
relativePathFromCwd: join107(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
13676
14517
|
frontmatter: rule.getFrontmatter(),
|
|
13677
14518
|
body: rule.getBody()
|
|
13678
14519
|
};
|
|
@@ -13688,11 +14529,11 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
13688
14529
|
intendedRootDir: process.cwd()
|
|
13689
14530
|
});
|
|
13690
14531
|
const filename = basename24(relativePathFromCwd);
|
|
13691
|
-
const fullPath =
|
|
14532
|
+
const fullPath = join107(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
13692
14533
|
try {
|
|
13693
14534
|
await removeFile(fullPath);
|
|
13694
14535
|
return {
|
|
13695
|
-
relativePathFromCwd:
|
|
14536
|
+
relativePathFromCwd: join107(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
13696
14537
|
};
|
|
13697
14538
|
} catch (error) {
|
|
13698
14539
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -13701,23 +14542,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
13701
14542
|
}
|
|
13702
14543
|
}
|
|
13703
14544
|
var ruleToolSchemas = {
|
|
13704
|
-
listRules:
|
|
13705
|
-
getRule:
|
|
13706
|
-
relativePathFromCwd:
|
|
14545
|
+
listRules: z52.object({}),
|
|
14546
|
+
getRule: z52.object({
|
|
14547
|
+
relativePathFromCwd: z52.string()
|
|
13707
14548
|
}),
|
|
13708
|
-
putRule:
|
|
13709
|
-
relativePathFromCwd:
|
|
14549
|
+
putRule: z52.object({
|
|
14550
|
+
relativePathFromCwd: z52.string(),
|
|
13710
14551
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
13711
|
-
body:
|
|
14552
|
+
body: z52.string()
|
|
13712
14553
|
}),
|
|
13713
|
-
deleteRule:
|
|
13714
|
-
relativePathFromCwd:
|
|
14554
|
+
deleteRule: z52.object({
|
|
14555
|
+
relativePathFromCwd: z52.string()
|
|
13715
14556
|
})
|
|
13716
14557
|
};
|
|
13717
14558
|
var ruleTools = {
|
|
13718
14559
|
listRules: {
|
|
13719
14560
|
name: "listRules",
|
|
13720
|
-
description: `List all rules from ${
|
|
14561
|
+
description: `List all rules from ${join107(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13721
14562
|
parameters: ruleToolSchemas.listRules,
|
|
13722
14563
|
execute: async () => {
|
|
13723
14564
|
const rules = await listRules();
|
|
@@ -13759,8 +14600,8 @@ var ruleTools = {
|
|
|
13759
14600
|
};
|
|
13760
14601
|
|
|
13761
14602
|
// src/mcp/skills.ts
|
|
13762
|
-
import { basename as basename25, dirname as dirname3, join as
|
|
13763
|
-
import { z as
|
|
14603
|
+
import { basename as basename25, dirname as dirname3, join as join108 } from "path";
|
|
14604
|
+
import { z as z53 } from "zod/mini";
|
|
13764
14605
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
13765
14606
|
var maxSkillsCount = 1e3;
|
|
13766
14607
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -13783,9 +14624,9 @@ function extractDirName(relativeDirPathFromCwd) {
|
|
|
13783
14624
|
return dirName;
|
|
13784
14625
|
}
|
|
13785
14626
|
async function listSkills() {
|
|
13786
|
-
const skillsDir =
|
|
14627
|
+
const skillsDir = join108(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
13787
14628
|
try {
|
|
13788
|
-
const skillDirPaths = await findFilesByGlobs(
|
|
14629
|
+
const skillDirPaths = await findFilesByGlobs(join108(skillsDir, "*"), { type: "dir" });
|
|
13789
14630
|
const skills = await Promise.all(
|
|
13790
14631
|
skillDirPaths.map(async (dirPath) => {
|
|
13791
14632
|
const dirName = basename25(dirPath);
|
|
@@ -13796,7 +14637,7 @@ async function listSkills() {
|
|
|
13796
14637
|
});
|
|
13797
14638
|
const frontmatter = skill.getFrontmatter();
|
|
13798
14639
|
return {
|
|
13799
|
-
relativeDirPathFromCwd:
|
|
14640
|
+
relativeDirPathFromCwd: join108(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13800
14641
|
frontmatter
|
|
13801
14642
|
};
|
|
13802
14643
|
} catch (error) {
|
|
@@ -13822,7 +14663,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
13822
14663
|
dirName
|
|
13823
14664
|
});
|
|
13824
14665
|
return {
|
|
13825
|
-
relativeDirPathFromCwd:
|
|
14666
|
+
relativeDirPathFromCwd: join108(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13826
14667
|
frontmatter: skill.getFrontmatter(),
|
|
13827
14668
|
body: skill.getBody(),
|
|
13828
14669
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -13856,7 +14697,7 @@ async function putSkill({
|
|
|
13856
14697
|
try {
|
|
13857
14698
|
const existingSkills = await listSkills();
|
|
13858
14699
|
const isUpdate = existingSkills.some(
|
|
13859
|
-
(skill2) => skill2.relativeDirPathFromCwd ===
|
|
14700
|
+
(skill2) => skill2.relativeDirPathFromCwd === join108(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
13860
14701
|
);
|
|
13861
14702
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
13862
14703
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -13871,9 +14712,9 @@ async function putSkill({
|
|
|
13871
14712
|
otherFiles: aiDirFiles,
|
|
13872
14713
|
validate: true
|
|
13873
14714
|
});
|
|
13874
|
-
const skillDirPath =
|
|
14715
|
+
const skillDirPath = join108(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
13875
14716
|
await ensureDir(skillDirPath);
|
|
13876
|
-
const skillFilePath =
|
|
14717
|
+
const skillFilePath = join108(skillDirPath, SKILL_FILE_NAME);
|
|
13877
14718
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
13878
14719
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
13879
14720
|
for (const file of otherFiles) {
|
|
@@ -13881,15 +14722,15 @@ async function putSkill({
|
|
|
13881
14722
|
relativePath: file.name,
|
|
13882
14723
|
intendedRootDir: skillDirPath
|
|
13883
14724
|
});
|
|
13884
|
-
const filePath =
|
|
13885
|
-
const fileDir =
|
|
14725
|
+
const filePath = join108(skillDirPath, file.name);
|
|
14726
|
+
const fileDir = join108(skillDirPath, dirname3(file.name));
|
|
13886
14727
|
if (fileDir !== skillDirPath) {
|
|
13887
14728
|
await ensureDir(fileDir);
|
|
13888
14729
|
}
|
|
13889
14730
|
await writeFileContent(filePath, file.body);
|
|
13890
14731
|
}
|
|
13891
14732
|
return {
|
|
13892
|
-
relativeDirPathFromCwd:
|
|
14733
|
+
relativeDirPathFromCwd: join108(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13893
14734
|
frontmatter: skill.getFrontmatter(),
|
|
13894
14735
|
body: skill.getBody(),
|
|
13895
14736
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -13911,13 +14752,13 @@ async function deleteSkill({
|
|
|
13911
14752
|
intendedRootDir: process.cwd()
|
|
13912
14753
|
});
|
|
13913
14754
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
13914
|
-
const skillDirPath =
|
|
14755
|
+
const skillDirPath = join108(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
13915
14756
|
try {
|
|
13916
14757
|
if (await directoryExists(skillDirPath)) {
|
|
13917
14758
|
await removeDirectory(skillDirPath);
|
|
13918
14759
|
}
|
|
13919
14760
|
return {
|
|
13920
|
-
relativeDirPathFromCwd:
|
|
14761
|
+
relativeDirPathFromCwd: join108(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
13921
14762
|
};
|
|
13922
14763
|
} catch (error) {
|
|
13923
14764
|
throw new Error(
|
|
@@ -13928,29 +14769,29 @@ async function deleteSkill({
|
|
|
13928
14769
|
);
|
|
13929
14770
|
}
|
|
13930
14771
|
}
|
|
13931
|
-
var McpSkillFileSchema =
|
|
13932
|
-
name:
|
|
13933
|
-
body:
|
|
14772
|
+
var McpSkillFileSchema = z53.object({
|
|
14773
|
+
name: z53.string(),
|
|
14774
|
+
body: z53.string()
|
|
13934
14775
|
});
|
|
13935
14776
|
var skillToolSchemas = {
|
|
13936
|
-
listSkills:
|
|
13937
|
-
getSkill:
|
|
13938
|
-
relativeDirPathFromCwd:
|
|
14777
|
+
listSkills: z53.object({}),
|
|
14778
|
+
getSkill: z53.object({
|
|
14779
|
+
relativeDirPathFromCwd: z53.string()
|
|
13939
14780
|
}),
|
|
13940
|
-
putSkill:
|
|
13941
|
-
relativeDirPathFromCwd:
|
|
14781
|
+
putSkill: z53.object({
|
|
14782
|
+
relativeDirPathFromCwd: z53.string(),
|
|
13942
14783
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
13943
|
-
body:
|
|
13944
|
-
otherFiles:
|
|
14784
|
+
body: z53.string(),
|
|
14785
|
+
otherFiles: z53.optional(z53.array(McpSkillFileSchema))
|
|
13945
14786
|
}),
|
|
13946
|
-
deleteSkill:
|
|
13947
|
-
relativeDirPathFromCwd:
|
|
14787
|
+
deleteSkill: z53.object({
|
|
14788
|
+
relativeDirPathFromCwd: z53.string()
|
|
13948
14789
|
})
|
|
13949
14790
|
};
|
|
13950
14791
|
var skillTools = {
|
|
13951
14792
|
listSkills: {
|
|
13952
14793
|
name: "listSkills",
|
|
13953
|
-
description: `List all skills from ${
|
|
14794
|
+
description: `List all skills from ${join108(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
13954
14795
|
parameters: skillToolSchemas.listSkills,
|
|
13955
14796
|
execute: async () => {
|
|
13956
14797
|
const skills = await listSkills();
|
|
@@ -13993,12 +14834,12 @@ var skillTools = {
|
|
|
13993
14834
|
};
|
|
13994
14835
|
|
|
13995
14836
|
// src/mcp/subagents.ts
|
|
13996
|
-
import { basename as basename26, join as
|
|
13997
|
-
import { z as
|
|
14837
|
+
import { basename as basename26, join as join109 } from "path";
|
|
14838
|
+
import { z as z54 } from "zod/mini";
|
|
13998
14839
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
13999
14840
|
var maxSubagentsCount = 1e3;
|
|
14000
14841
|
async function listSubagents() {
|
|
14001
|
-
const subagentsDir =
|
|
14842
|
+
const subagentsDir = join109(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
14002
14843
|
try {
|
|
14003
14844
|
const files = await listDirectoryFiles(subagentsDir);
|
|
14004
14845
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -14011,7 +14852,7 @@ async function listSubagents() {
|
|
|
14011
14852
|
});
|
|
14012
14853
|
const frontmatter = subagent.getFrontmatter();
|
|
14013
14854
|
return {
|
|
14014
|
-
relativePathFromCwd:
|
|
14855
|
+
relativePathFromCwd: join109(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
14015
14856
|
frontmatter
|
|
14016
14857
|
};
|
|
14017
14858
|
} catch (error) {
|
|
@@ -14040,7 +14881,7 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
14040
14881
|
validate: true
|
|
14041
14882
|
});
|
|
14042
14883
|
return {
|
|
14043
|
-
relativePathFromCwd:
|
|
14884
|
+
relativePathFromCwd: join109(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
14044
14885
|
frontmatter: subagent.getFrontmatter(),
|
|
14045
14886
|
body: subagent.getBody()
|
|
14046
14887
|
};
|
|
@@ -14069,7 +14910,7 @@ async function putSubagent({
|
|
|
14069
14910
|
try {
|
|
14070
14911
|
const existingSubagents = await listSubagents();
|
|
14071
14912
|
const isUpdate = existingSubagents.some(
|
|
14072
|
-
(subagent2) => subagent2.relativePathFromCwd ===
|
|
14913
|
+
(subagent2) => subagent2.relativePathFromCwd === join109(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
14073
14914
|
);
|
|
14074
14915
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
14075
14916
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -14082,11 +14923,11 @@ async function putSubagent({
|
|
|
14082
14923
|
body,
|
|
14083
14924
|
validate: true
|
|
14084
14925
|
});
|
|
14085
|
-
const subagentsDir =
|
|
14926
|
+
const subagentsDir = join109(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
14086
14927
|
await ensureDir(subagentsDir);
|
|
14087
14928
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
14088
14929
|
return {
|
|
14089
|
-
relativePathFromCwd:
|
|
14930
|
+
relativePathFromCwd: join109(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
14090
14931
|
frontmatter: subagent.getFrontmatter(),
|
|
14091
14932
|
body: subagent.getBody()
|
|
14092
14933
|
};
|
|
@@ -14102,11 +14943,11 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
14102
14943
|
intendedRootDir: process.cwd()
|
|
14103
14944
|
});
|
|
14104
14945
|
const filename = basename26(relativePathFromCwd);
|
|
14105
|
-
const fullPath =
|
|
14946
|
+
const fullPath = join109(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
14106
14947
|
try {
|
|
14107
14948
|
await removeFile(fullPath);
|
|
14108
14949
|
return {
|
|
14109
|
-
relativePathFromCwd:
|
|
14950
|
+
relativePathFromCwd: join109(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
14110
14951
|
};
|
|
14111
14952
|
} catch (error) {
|
|
14112
14953
|
throw new Error(
|
|
@@ -14118,23 +14959,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
14118
14959
|
}
|
|
14119
14960
|
}
|
|
14120
14961
|
var subagentToolSchemas = {
|
|
14121
|
-
listSubagents:
|
|
14122
|
-
getSubagent:
|
|
14123
|
-
relativePathFromCwd:
|
|
14962
|
+
listSubagents: z54.object({}),
|
|
14963
|
+
getSubagent: z54.object({
|
|
14964
|
+
relativePathFromCwd: z54.string()
|
|
14124
14965
|
}),
|
|
14125
|
-
putSubagent:
|
|
14126
|
-
relativePathFromCwd:
|
|
14966
|
+
putSubagent: z54.object({
|
|
14967
|
+
relativePathFromCwd: z54.string(),
|
|
14127
14968
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
14128
|
-
body:
|
|
14969
|
+
body: z54.string()
|
|
14129
14970
|
}),
|
|
14130
|
-
deleteSubagent:
|
|
14131
|
-
relativePathFromCwd:
|
|
14971
|
+
deleteSubagent: z54.object({
|
|
14972
|
+
relativePathFromCwd: z54.string()
|
|
14132
14973
|
})
|
|
14133
14974
|
};
|
|
14134
14975
|
var subagentTools = {
|
|
14135
14976
|
listSubagents: {
|
|
14136
14977
|
name: "listSubagents",
|
|
14137
|
-
description: `List all subagents from ${
|
|
14978
|
+
description: `List all subagents from ${join109(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
14138
14979
|
parameters: subagentToolSchemas.listSubagents,
|
|
14139
14980
|
execute: async () => {
|
|
14140
14981
|
const subagents = await listSubagents();
|
|
@@ -14176,20 +15017,20 @@ var subagentTools = {
|
|
|
14176
15017
|
};
|
|
14177
15018
|
|
|
14178
15019
|
// src/mcp/tools.ts
|
|
14179
|
-
var rulesyncFeatureSchema =
|
|
14180
|
-
var rulesyncOperationSchema =
|
|
14181
|
-
var skillFileSchema =
|
|
14182
|
-
name:
|
|
14183
|
-
body:
|
|
15020
|
+
var rulesyncFeatureSchema = z55.enum(["rule", "command", "subagent", "skill", "ignore", "mcp"]);
|
|
15021
|
+
var rulesyncOperationSchema = z55.enum(["list", "get", "put", "delete"]);
|
|
15022
|
+
var skillFileSchema = z55.object({
|
|
15023
|
+
name: z55.string(),
|
|
15024
|
+
body: z55.string()
|
|
14184
15025
|
});
|
|
14185
|
-
var rulesyncToolSchema =
|
|
15026
|
+
var rulesyncToolSchema = z55.object({
|
|
14186
15027
|
feature: rulesyncFeatureSchema,
|
|
14187
15028
|
operation: rulesyncOperationSchema,
|
|
14188
|
-
targetPathFromCwd:
|
|
14189
|
-
frontmatter:
|
|
14190
|
-
body:
|
|
14191
|
-
otherFiles:
|
|
14192
|
-
content:
|
|
15029
|
+
targetPathFromCwd: z55.optional(z55.string()),
|
|
15030
|
+
frontmatter: z55.optional(z55.unknown()),
|
|
15031
|
+
body: z55.optional(z55.string()),
|
|
15032
|
+
otherFiles: z55.optional(z55.array(skillFileSchema)),
|
|
15033
|
+
content: z55.optional(z55.string())
|
|
14193
15034
|
});
|
|
14194
15035
|
var supportedOperationsByFeature = {
|
|
14195
15036
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -14385,7 +15226,7 @@ async function mcpCommand({ version }) {
|
|
|
14385
15226
|
}
|
|
14386
15227
|
|
|
14387
15228
|
// src/cli/index.ts
|
|
14388
|
-
var getVersion = () => "6.
|
|
15229
|
+
var getVersion = () => "6.3.0";
|
|
14389
15230
|
var main = async () => {
|
|
14390
15231
|
const program = new Command();
|
|
14391
15232
|
const version = getVersion();
|