Elffuss BraidHub

kikocis/continue public

18c867793b67 · 1.5 KiBRawPermalink
1import { Tool } from "../..";
2import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn";
3import { createSystemMessageExampleCall } from "../systemMessageTools/buildToolsSystemMessage";
4
5export const createNewFileTool: Tool = {
6 type: "function",
7 displayTitle: "Create New File",
8 wouldLikeTo: "create a new file at {{{ filepath }}}",
9 isCurrently: "creating a new file at {{{ filepath }}}",
10 hasAlready: "created a new file at {{{ filepath }}}",
11 group: BUILT_IN_GROUP_NAME,
12 readonly: false,
13 isInstant: true,
14 function: {
15 name: BuiltInToolNames.CreateNewFile,
16 description:
17 "Create a new file. Only use this when a file doesn't exist and should be created",
18 parameters: {
19 type: "object",
20 required: ["filepath", "contents"],
21 properties: {
22 filepath: {
23 type: "string",
24 description:
25 "The path where the new file should be created, relative to the root of the workspace",
26 },
27 contents: {
28 type: "string",
29 description: "The contents to write to the new file",
30 },
31 },
32 },
33 },
34 defaultToolPolicy: "allowedWithPermission",
35 systemMessageDescription: createSystemMessageExampleCall(
36 BuiltInToolNames.CreateNewFile,
37 `To create a NEW file, use the ${BuiltInToolNames.CreateNewFile} tool with the relative filepath and new contents. For example, to create a file located at 'path/to/file.txt', you would respond with:`,
38 [
39 ["filepath", "path/to/the_file.txt"],
40 ["contents", "Contents of the file"],
41 ],
42 ),
43};