summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-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"})
}