summaryrefslogtreecommitdiff
path: root/internal/cli/start.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-03-08 21:03:50 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-03-08 21:03:50 +0000
commit632ea5a44731af94b6238f330a3b5440906c8ae7 (patch)
treed8c780412598d66b89ef390b5729e379fdfd9d5b /internal/cli/start.go
parent406247b14985ab57902e8e42898dc8cb8960290d (diff)
parent93a4c852bf726b00e8014d385165f847763fa214 (diff)
merge: pull latest from master and resolve conflicts
- Resolve conflicts in API server, CLI, and executor. - Maintain Gemini classification and assignment logic. - Update UI to use generic agent config and project_dir. - Fix ProjectDir/WorkingDir inconsistencies in Gemini runner. - All tests passing after merge.
Diffstat (limited to 'internal/cli/start.go')
-rw-r--r--internal/cli/start.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/internal/cli/start.go b/internal/cli/start.go
index 6ec09b2..9e66e00 100644
--- a/internal/cli/start.go
+++ b/internal/cli/start.go
@@ -3,7 +3,8 @@ package cli
import (
"encoding/json"
"fmt"
- "net/http"
+ "io"
+ "net/url"
"github.com/spf13/cobra"
)
@@ -25,15 +26,18 @@ func newStartCmd() *cobra.Command {
}
func startTask(serverURL, id string) error {
- url := fmt.Sprintf("%s/api/tasks/%s/run", serverURL, id)
- resp, err := http.Post(url, "application/json", nil) //nolint:noctx
+ url := fmt.Sprintf("%s/api/tasks/%s/run", serverURL, url.PathEscape(id))
+ resp, err := httpClient.Post(url, "application/json", nil) //nolint:noctx
if err != nil {
return fmt.Errorf("POST %s: %w", url, err)
}
defer resp.Body.Close()
+ raw, _ := io.ReadAll(resp.Body)
var body map[string]string
- _ = json.NewDecoder(resp.Body).Decode(&body)
+ if err := json.Unmarshal(raw, &body); err != nil {
+ return fmt.Errorf("server returned invalid JSON (status %d): %s", resp.StatusCode, string(raw))
+ }
if resp.StatusCode >= 300 {
return fmt.Errorf("server returned %d: %s", resp.StatusCode, body["error"])