Implement workspace-aware folder browser

This commit is contained in:
Shantur Rathore
2025-11-17 22:05:38 +00:00
parent f53564bb06
commit 40e8c90bab
8 changed files with 526 additions and 14 deletions

View File

@@ -9,6 +9,7 @@ interface RouteDeps {
const FilesystemQuerySchema = z.object({
path: z.string().optional(),
depth: z.coerce.number().int().min(1).max(10).default(2),
includeFiles: z.coerce.boolean().default(true),
})
export function registerFilesystemRoutes(app: FastifyInstance, deps: RouteDeps) {
@@ -17,7 +18,10 @@ export function registerFilesystemRoutes(app: FastifyInstance, deps: RouteDeps)
const targetPath = query.path ?? "."
try {
return deps.fileSystemBrowser.list(targetPath, query.depth)
return deps.fileSystemBrowser.list(targetPath, {
depth: query.depth,
includeFiles: query.includeFiles,
})
} catch (error) {
reply.code(400)
return { error: (error as Error).message }