summaryrefslogtreecommitdiff
path: root/internal/api
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-03-07 00:06:44 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-03-07 00:06:44 +0000
commit0291a7880d29b39d7cd56a6a8be66a9b5ec3f457 (patch)
tree2ed6fda247c12f590cc05e4e5150c165c42a5640 /internal/api
parent5f1bfde96d6a36381987c0f700d66e1099d5f8f9 (diff)
ui: Project dropdown in new task dialog, first field, defaults to /workspace/claudomator
- 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 <noreply@anthropic.com>
Diffstat (limited to 'internal/api')
-rw-r--r--internal/api/server.go16
1 files changed, 16 insertions, 0 deletions
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"})
}