From 0291a7880d29b39d7cd56a6a8be66a9b5ec3f457 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Sat, 7 Mar 2026 00:06:44 +0000 Subject: ui: Project dropdown in new task dialog, first field, defaults to /workspace/claudomator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Moved working directory to first field, renamed to "Project" - Replaced text input with a select populated from GET /api/workspaces (lists subdirs of /workspace dynamically) - "Create new project…" option reveals a custom path input - elaborate result handler sets select or falls back to new-project input - Added GET /api/workspaces endpoint in server.go Co-Authored-By: Claude Sonnet 4.6 --- internal/api/server.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'internal/api') diff --git a/internal/api/server.go b/internal/api/server.go index dd4627c..af4710b 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -87,6 +87,7 @@ func (s *Server) routes() { s.mux.HandleFunc("POST /api/scripts/start-next-task", s.handleStartNextTask) s.mux.HandleFunc("POST /api/scripts/deploy", s.handleDeploy) s.mux.HandleFunc("GET /api/ws", s.handleWebSocket) + s.mux.HandleFunc("GET /api/workspaces", s.handleListWorkspaces) s.mux.HandleFunc("GET /api/health", s.handleHealth) s.mux.Handle("GET /", http.FileServerFS(webui.Files)) } @@ -252,6 +253,21 @@ func (s *Server) handleResumeTimedOutTask(w http.ResponseWriter, r *http.Request }) } +func (s *Server) handleListWorkspaces(w http.ResponseWriter, r *http.Request) { + entries, err := os.ReadDir("/workspace") + if err != nil { + writeJSON(w, http.StatusInternalServerError, map[string]string{"error": err.Error()}) + return + } + var dirs []string + for _, e := range entries { + if e.IsDir() { + dirs = append(dirs, "/workspace/"+e.Name()) + } + } + writeJSON(w, http.StatusOK, dirs) +} + func (s *Server) handleHealth(w http.ResponseWriter, r *http.Request) { writeJSON(w, http.StatusOK, map[string]string{"status": "ok"}) } -- cgit v1.2.3