summaryrefslogtreecommitdiff
path: root/internal/cli/create.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/create.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/create.go')
-rw-r--r--internal/cli/create.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/internal/cli/create.go b/internal/cli/create.go
index fdad932..addd034 100644
--- a/internal/cli/create.go
+++ b/internal/cli/create.go
@@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
- "net/http"
+ "io"
"github.com/spf13/cobra"
)
@@ -52,7 +52,7 @@ func createTask(serverURL, name, instructions, workingDir, model, parentID strin
"priority": priority,
"claude": map[string]interface{}{
"instructions": instructions,
- "working_dir": workingDir,
+ "project_dir": workingDir,
"model": model,
"max_budget_usd": budget,
},
@@ -62,20 +62,26 @@ func createTask(serverURL, name, instructions, workingDir, model, parentID strin
}
data, _ := json.Marshal(body)
- resp, err := http.Post(serverURL+"/api/tasks", "application/json", bytes.NewReader(data)) //nolint:noctx
+ resp, err := httpClient.Post(serverURL+"/api/tasks", "application/json", bytes.NewReader(data)) //nolint:noctx
if err != nil {
return fmt.Errorf("POST /api/tasks: %w", err)
}
defer resp.Body.Close()
+ raw, _ := io.ReadAll(resp.Body)
var result map[string]interface{}
- _ = json.NewDecoder(resp.Body).Decode(&result)
+ if err := json.Unmarshal(raw, &result); 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: %v", resp.StatusCode, result["error"])
}
id, _ := result["id"].(string)
+ if id == "" {
+ return fmt.Errorf("server returned task without id field")
+ }
fmt.Printf("Created task %s\n", id)
if autoStart {