Elffuss BraidHub

kikocis/continue public

99fe51849b68 · 2.6 KiBRawPermalink
1import { Tool } from "../..";
2import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn";
3
4export const createRuleBlock: Tool = {
5 type: "function",
6 displayTitle: "Create Rule Block",
7 wouldLikeTo: 'create a rule block for "{{{ name }}}"',
8 isCurrently: 'creating a rule block for "{{{ name }}}"',
9 hasAlready: 'created a rule block for "{{{ name }}}"',
10 readonly: false,
11 isInstant: true,
12 group: BUILT_IN_GROUP_NAME,
13 function: {
14 name: BuiltInToolNames.CreateRuleBlock,
15 description:
16 'Creates a "rule" that can be referenced in future conversations. This should be used whenever you want to establish code standards / preferences that should be applied consistently, or when you want to avoid making a mistake again. To modify existing rules, use the edit tool instead.\n\nRule Types:\n- Always: Include only "rule" (always included in model context)\n- Auto Attached: Include "rule", "globs", and/or "regex" (included when files match patterns)\n- Agent Requested: Include "rule" and "description" (AI decides when to apply based on description)\n- Manual: Include only "rule" (only included when explicitly mentioned using @ruleName)',
17 parameters: {
18 type: "object",
19 required: ["name", "rule"],
20 properties: {
21 name: {
22 type: "string",
23 description:
24 "Short, descriptive name summarizing the rule's purpose (e.g. 'React Standards', 'Type Hints')",
25 },
26 rule: {
27 type: "string",
28 description:
29 "Clear, imperative instruction for future code generation (e.g. 'Use named exports', 'Add Python type hints'). Each rule should focus on one specific standard.",
30 },
31 description: {
32 type: "string",
33 description:
34 "Description of when this rule should be applied. Required for Agent Requested rules (AI decides when to apply). Optional for other types.",
35 },
36 globs: {
37 type: "string",
38 description:
39 "Optional file patterns to which this rule applies (e.g. ['**/*.{ts,tsx}'] or ['src/**/*.ts', 'tests/**/*.ts'])",
40 },
41 regex: {
42 type: "string",
43 description:
44 "Optional regex patterns to match against file content. Rule applies only to files whose content matches the pattern (e.g. 'useEffect' for React hooks or '\\bclass\\b' for class definitions)",
45 },
46 alwaysApply: {
47 type: "boolean",
48 description:
49 "Whether this rule should always be applied. Set to false for Agent Requested and Manual rules. Omit or set to true for Always and Auto Attached rules.",
50 },
51 },
52 },
53 },
54};