continue-custom/core/tools/implementations/viewSubdirectory.ts
Patrick Erichsen ad2fd48124 Merge main branch and resolve conflicts
- Combined resolveInputPath approach with new ContinueError system
- Updated error handling to use ContinueError with appropriate error reasons
- Maintained improved error messages from pe/read-file-errs branch
2025-10-16 16:00:29 -07:00

33 lines
981 B
TypeScript

import generateRepoMap from "../../util/generateRepoMap";
import { resolveInputPath } from "../../util/pathResolver";
import { ToolImpl } from ".";
import { ContinueError, ContinueErrorReason } from "../../util/errors";
import { getStringArg } from "../parseArgs";
export const viewSubdirectoryImpl: ToolImpl = async (args: any, extras) => {
const directory_path = getStringArg(args, "directory_path");
const resolvedPath = await resolveInputPath(extras.ide, directory_path);
if (!resolvedPath) {
throw new ContinueError(
ContinueErrorReason.DirectoryNotFound,
`Directory path "${directory_path}" does not exist or is not accessible.`,
);
}
const repoMap = await generateRepoMap(extras.llm, extras.ide, {
dirUris: [resolvedPath.uri],
outputRelativeUriPaths: true,
includeSignatures: false,
});
return [
{
name: "Repo map",
description: `Map of ${resolvedPath.displayPath}`,
content: repoMap,
},
];
};