summaryrefslogtreecommitdiff
path: root/internal/cli
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-03-14 00:39:22 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-03-14 00:39:22 +0000
commit2ee988ccc04c09ceb6de7cdb75c94114e85d01b9 (patch)
tree29100e3e4b33748c544b9a42cb74e964df49b96e /internal/cli
parent98ccde12b08ad0b7f53e42de959a72d8382179e3 (diff)
feat: add agent selector to UI and support direct agent assignment
- Added an agent selector (Auto, Claude, Gemini) to the Start Next Task button. - Updated the backend to pass query parameters as environment variables to scripts. - Modified the executor pool to skip classification when a specific agent is requested. - Added --agent flag to claudomator start command. - Updated tests to cover the new functionality.
Diffstat (limited to 'internal/cli')
-rw-r--r--internal/cli/create.go2
-rw-r--r--internal/cli/create_test.go6
-rw-r--r--internal/cli/start.go16
3 files changed, 14 insertions, 10 deletions
diff --git a/internal/cli/create.go b/internal/cli/create.go
index e5435d3..396cd77 100644
--- a/internal/cli/create.go
+++ b/internal/cli/create.go
@@ -88,7 +88,7 @@ func createTask(serverURL, name, instructions, workingDir, model, agentType, par
fmt.Printf("Created task %s\n", id)
if autoStart {
- return startTask(serverURL, id)
+ return startTask(serverURL, id, agentType)
}
return nil
}
diff --git a/internal/cli/create_test.go b/internal/cli/create_test.go
index 4ce1071..71b403e 100644
--- a/internal/cli/create_test.go
+++ b/internal/cli/create_test.go
@@ -42,7 +42,7 @@ func TestStartTask_EscapesTaskID(t *testing.T) {
}))
defer srv.Close()
- err := startTask(srv.URL, "task/with/slashes")
+ err := startTask(srv.URL, "task/with/slashes", "")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
@@ -93,7 +93,7 @@ func TestStartTask_NonJSONResponse_ReturnsError(t *testing.T) {
}))
defer srv.Close()
- err := startTask(srv.URL, "task-abc")
+ err := startTask(srv.URL, "task-abc", "")
if err == nil {
t.Fatal("expected error for non-JSON response, got nil")
}
@@ -115,7 +115,7 @@ func TestStartTask_TimesOut(t *testing.T) {
httpClient = &http.Client{Timeout: 50 * time.Millisecond}
defer func() { httpClient = orig }()
- err := startTask(srv.URL, "task-abc")
+ err := startTask(srv.URL, "task-abc", "")
if err == nil {
t.Fatal("expected timeout error, got nil")
}
diff --git a/internal/cli/start.go b/internal/cli/start.go
index 9e66e00..99af9a5 100644
--- a/internal/cli/start.go
+++ b/internal/cli/start.go
@@ -8,28 +8,32 @@ import (
"github.com/spf13/cobra"
)
-
func newStartCmd() *cobra.Command {
var serverURL string
+ var agent string
cmd := &cobra.Command{
Use: "start <task-id>",
Short: "Queue a task for execution via the running server",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
- return startTask(serverURL, args[0])
+ return startTask(serverURL, args[0], agent)
},
}
cmd.Flags().StringVar(&serverURL, "server", "http://localhost:8484", "claudomator server URL")
+ cmd.Flags().StringVar(&agent, "agent", "", "agent to use (claude, gemini, or auto)")
return cmd
}
-func startTask(serverURL, id string) error {
- url := fmt.Sprintf("%s/api/tasks/%s/run", serverURL, url.PathEscape(id))
- resp, err := httpClient.Post(url, "application/json", nil) //nolint:noctx
+func startTask(serverURL, id, agent string) error {
+ u := fmt.Sprintf("%s/api/tasks/%s/run", serverURL, url.PathEscape(id))
+ if agent != "" {
+ u += "?agent=" + url.QueryEscape(agent)
+ }
+ resp, err := httpClient.Post(u, "application/json", nil) //nolint:noctx
if err != nil {
- return fmt.Errorf("POST %s: %w", url, err)
+ return fmt.Errorf("POST %s: %w", u, err)
}
defer resp.Body.Close()