Improve project folder creation

This commit is contained in:
Federico Jaramillo Martinez
2026-05-08 14:38:12 +02:00
parent 6ea7e51e75
commit 2c7559c61c
8 changed files with 203 additions and 12 deletions
+10 -1
View File
@@ -7,6 +7,7 @@ import { ProjectStore } from "./storage/projectStore.js";
import { ProjectService } from "./projects/projectService.js";
import { WorkspaceService } from "./workspaces/workspaceService.js";
import { listFileSuggestions, listPathSuggestions } from "./workspaces/fileSuggestions.js";
import { listDirectorySuggestions } from "./projects/directorySuggestions.js";
import { registerSessionProxyRoutes } from "./sessiond/sessionProxyRoutes.js";
import { registerWorkspaceExplorerRoutes } from "./workspaceExplorerRoutes.js";
import { registerGitRoutes } from "./gitRoutes.js";
@@ -19,7 +20,7 @@ const workspaces = new WorkspaceService();
app.get("/api/projects", async () => projects.list());
app.post<{ Body: { name?: string; path: string } }>("/api/projects", async (request, reply) => {
app.post<{ Body: { name?: string; path: string; create?: boolean } }>("/api/projects", async (request, reply) => {
try {
return await projects.add(request.body);
} catch (error) {
@@ -27,6 +28,14 @@ app.post<{ Body: { name?: string; path: string } }>("/api/projects", async (requ
}
});
app.get<{ Querystring: { q?: string } }>("/api/project-directories", async (request, reply) => {
try {
return await listDirectorySuggestions(request.query.q ?? "");
} catch (error) {
return reply.code(400).send({ error: error instanceof Error ? error.message : String(error) });
}
});
app.get<{ Params: { projectId: string } }>("/api/projects/:projectId/workspaces", async (request, reply) => {
try {
const project = await projects.requireProject(request.params.projectId);