# Conflicts: # core/index.d.ts # core/tools/definitions/codebaseTool.ts # core/tools/definitions/createNewFile.ts # core/tools/definitions/createRuleBlock.ts # core/tools/definitions/editFile.ts # core/tools/definitions/fetchUrlContent.ts # core/tools/definitions/globSearch.ts # core/tools/definitions/grepSearch.ts # core/tools/definitions/ls.ts # core/tools/definitions/readCurrentlyOpenFile.ts # core/tools/definitions/readFile.ts # core/tools/definitions/requestRule.ts # core/tools/definitions/runTerminalCommand.ts # core/tools/definitions/searchAndReplaceInFile.ts # core/tools/definitions/searchWeb.ts # core/tools/definitions/viewDiff.ts # core/tools/definitions/viewRepoMap.ts # core/tools/definitions/viewSubdirectory.ts
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
import { Tool } from "../..";
|
|
|
|
import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn";
|
|
import { createSystemMessageExampleCall } from "../systemMessageTools/buildToolsSystemMessage";
|
|
|
|
export const lsTool: Tool = {
|
|
type: "function",
|
|
displayTitle: "ls",
|
|
wouldLikeTo: "list files and folders in {{{ dirPath }}}",
|
|
isCurrently: "listing files and folders in {{{ dirPath }}}",
|
|
hasAlready: "listed files and folders in {{{ dirPath }}}",
|
|
readonly: true,
|
|
isInstant: true,
|
|
group: BUILT_IN_GROUP_NAME,
|
|
function: {
|
|
name: BuiltInToolNames.LSTool,
|
|
description: "List files and folders in a given directory",
|
|
parameters: {
|
|
type: "object",
|
|
properties: {
|
|
dirPath: {
|
|
type: "string",
|
|
description:
|
|
"The directory path relative to the root of the project. Use forward slash paths like '/'. rather than e.g. '.'",
|
|
},
|
|
recursive: {
|
|
type: "boolean",
|
|
description:
|
|
"If true, lists files and folders recursively. To prevent unexpected large results, use this sparingly",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
defaultToolPolicy: "allowedWithoutPermission",
|
|
systemMessageDescription: createSystemMessageExampleCall(
|
|
BuiltInToolNames.LSTool,
|
|
`To list files and folders in a given directory, call the ${BuiltInToolNames.LSTool} tool with "dirPath" and "recursive". For example:`,
|
|
[
|
|
["dirPath", "path/to/dir"],
|
|
["recursive", "false"],
|
|
],
|
|
),
|
|
};
|