Elffuss BraidHub

kikocis/continue public

05944493c70c · 549 BRawPermalink
1import { ToolImpl } from ".";
2
3export const requestRuleImpl: ToolImpl = async (args, extras) => {
4 // Find the rule by name in the config
5 const rule = extras.config.rules.find((r) => r.name === args.name);
6
7 if (!rule || !rule.ruleFile) {
8 throw new Error(
9 `Rule with name "${args.name}" not found or has no file path`,
10 );
11 }
12
13 return [
14 {
15 name: rule.name ?? "",
16 description: rule.description ?? "",
17 content: rule.rule,
18 uri: {
19 type: "file",
20 value: rule.ruleFile,
21 },
22 },
23 ];
24};