Elffuss BraidHub

kikocis/continue public

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