(args: any, extras)
| 6 | import { getStringArg } from "../parseArgs"; |
| 7 | |
| 8 | export const viewSubdirectoryImpl: ToolImpl = async (args: any, extras) => { |
| 9 | const directory_path = getStringArg(args, "directory_path"); |
| 10 | |
| 11 | const resolvedPath = await resolveInputPath(extras.ide, directory_path); |
| 12 | |
| 13 | if (!resolvedPath) { |
| 14 | throw new ContinueError( |
| 15 | ContinueErrorReason.DirectoryNotFound, |
| 16 | `Directory path "${directory_path}" does not exist or is not accessible.`, |
| 17 | ); |
| 18 | } |
| 19 | |
| 20 | // Check if the resolved path actually exists |
| 21 | const exists = await extras.ide.fileExists(resolvedPath.uri); |
| 22 | if (!exists) { |
| 23 | throw new ContinueError( |
| 24 | ContinueErrorReason.DirectoryNotFound, |
| 25 | `Directory path "${directory_path}" does not exist or is not accessible.`, |
| 26 | ); |
| 27 | } |
| 28 | |
| 29 | const repoMap = await generateRepoMap(extras.llm, extras.ide, { |
| 30 | dirUris: [resolvedPath.uri], |
| 31 | outputRelativeUriPaths: true, |
| 32 | includeSignatures: false, |
| 33 | }); |
| 34 | |
| 35 | return [ |
| 36 | { |
| 37 | name: "Repo map", |
| 38 | description: `Map of ${resolvedPath.displayPath}`, |
| 39 | content: repoMap, |
| 40 | }, |
| 41 | ]; |
| 42 | }; |
no test coverage detected