summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-03-07 23:53:15 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-03-08 05:18:41 +0000
commitebdb12fc37c9c8db460827fdba1aa10e5b208cb9 (patch)
treeb0f4b12e9251b836e6efef283c9b7ad959c9692f
parentf11f1f8c7d3ce9caca592323def9cc598e5c7392 (diff)
feat(wiring): configure GeminiRunner and update API server
-rw-r--r--internal/api/server.go11
-rw-r--r--internal/cli/run.go19
-rw-r--r--internal/cli/serve.go24
-rw-r--r--internal/config/config.go2
4 files changed, 40 insertions, 16 deletions
diff --git a/internal/api/server.go b/internal/api/server.go
index af4710b..6f343b6 100644
--- a/internal/api/server.go
+++ b/internal/api/server.go
@@ -26,6 +26,7 @@ type Server struct {
logger *slog.Logger
mux *http.ServeMux
claudeBinPath string // path to claude binary; defaults to "claude"
+ geminiBinPath string // path to gemini binary; defaults to "gemini"
elaborateCmdPath string // overrides claudeBinPath; used in tests
validateCmdPath string // overrides claudeBinPath for validate; used in tests
startNextTaskScript string // path to start-next-task script; overridden in tests
@@ -33,7 +34,7 @@ type Server struct {
workDir string // working directory injected into elaborate system prompt
}
-func NewServer(store *storage.DB, pool *executor.Pool, logger *slog.Logger, claudeBinPath string) *Server {
+func NewServer(store *storage.DB, pool *executor.Pool, logger *slog.Logger, claudeBinPath, geminiBinPath string) *Server {
wd, _ := os.Getwd()
s := &Server{
store: store,
@@ -44,6 +45,7 @@ func NewServer(store *storage.DB, pool *executor.Pool, logger *slog.Logger, clau
logger: logger,
mux: http.NewServeMux(),
claudeBinPath: claudeBinPath,
+ geminiBinPath: geminiBinPath,
workDir: wd,
}
s.routes()
@@ -276,7 +278,7 @@ func (s *Server) handleCreateTask(w http.ResponseWriter, r *http.Request) {
var input struct {
Name string `json:"name"`
Description string `json:"description"`
- Claude task.ClaudeConfig `json:"claude"`
+ Agent task.AgentConfig `json:"agent"`
Timeout string `json:"timeout"`
Priority string `json:"priority"`
Tags []string `json:"tags"`
@@ -292,7 +294,7 @@ func (s *Server) handleCreateTask(w http.ResponseWriter, r *http.Request) {
ID: uuid.New().String(),
Name: input.Name,
Description: input.Description,
- Claude: input.Claude,
+ Agent: input.Agent,
Priority: task.Priority(input.Priority),
Tags: input.Tags,
DependsOn: []string{},
@@ -302,6 +304,9 @@ func (s *Server) handleCreateTask(w http.ResponseWriter, r *http.Request) {
UpdatedAt: now,
ParentTaskID: input.ParentTaskID,
}
+ if t.Agent.Type == "" {
+ t.Agent.Type = "claude"
+ }
if t.Priority == "" {
t.Priority = task.PriorityNormal
}
diff --git a/internal/cli/run.go b/internal/cli/run.go
index c666406..3624cea 100644
--- a/internal/cli/run.go
+++ b/internal/cli/run.go
@@ -51,7 +51,7 @@ func runTasks(file string, parallel int, dryRun bool) error {
if dryRun {
fmt.Printf("Validated %d task(s) successfully.\n", len(tasks))
for _, t := range tasks {
- fmt.Printf(" - %s (model: %s, timeout: %v)\n", t.Name, t.Claude.Model, t.Timeout.Duration)
+ fmt.Printf(" - %s (model: %s, timeout: %v)\n", t.Name, t.Agent.Model, t.Timeout.Duration)
}
return nil
}
@@ -73,12 +73,19 @@ func runTasks(file string, parallel int, dryRun bool) error {
}
logger := slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: level}))
- runner := &executor.ClaudeRunner{
- BinaryPath: cfg.ClaudeBinaryPath,
- Logger: logger,
- LogDir: cfg.LogDir,
+ runners := map[string]executor.Runner{
+ "claude": &executor.ClaudeRunner{
+ BinaryPath: cfg.ClaudeBinaryPath,
+ Logger: logger,
+ LogDir: cfg.LogDir,
+ },
+ "gemini": &executor.GeminiRunner{
+ BinaryPath: cfg.GeminiBinaryPath,
+ Logger: logger,
+ LogDir: cfg.LogDir,
+ },
}
- pool := executor.NewPool(parallel, runner, store, logger)
+ pool := executor.NewPool(parallel, runners, store, logger)
// Handle graceful shutdown.
ctx, cancel := context.WithCancel(context.Background())
diff --git a/internal/cli/serve.go b/internal/cli/serve.go
index 363e276..2ecb6cd 100644
--- a/internal/cli/serve.go
+++ b/internal/cli/serve.go
@@ -54,15 +54,25 @@ func serve(addr string) error {
if len(addr) > 0 && addr[0] != ':' {
apiURL = "http://" + addr
}
- runner := &executor.ClaudeRunner{
- BinaryPath: cfg.ClaudeBinaryPath,
- Logger: logger,
- LogDir: cfg.LogDir,
- APIURL: apiURL,
+
+ runners := map[string]executor.Runner{
+ "claude": &executor.ClaudeRunner{
+ BinaryPath: cfg.ClaudeBinaryPath,
+ Logger: logger,
+ LogDir: cfg.LogDir,
+ APIURL: apiURL,
+ },
+ "gemini": &executor.GeminiRunner{
+ BinaryPath: cfg.GeminiBinaryPath,
+ Logger: logger,
+ LogDir: cfg.LogDir,
+ APIURL: apiURL,
+ },
}
- pool := executor.NewPool(cfg.MaxConcurrent, runner, store, logger)
+
+ pool := executor.NewPool(cfg.MaxConcurrent, runners, store, logger)
- srv := api.NewServer(store, pool, logger, cfg.ClaudeBinaryPath)
+ srv := api.NewServer(store, pool, logger, cfg.ClaudeBinaryPath, cfg.GeminiBinaryPath)
srv.StartHub()
httpSrv := &http.Server{
diff --git a/internal/config/config.go b/internal/config/config.go
index da7f264..a66524a 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -10,6 +10,7 @@ type Config struct {
DBPath string `toml:"-"`
LogDir string `toml:"-"`
ClaudeBinaryPath string `toml:"claude_binary_path"`
+ GeminiBinaryPath string `toml:"gemini_binary_path"`
MaxConcurrent int `toml:"max_concurrent"`
DefaultTimeout string `toml:"default_timeout"`
ServerAddr string `toml:"server_addr"`
@@ -24,6 +25,7 @@ func Default() *Config {
DBPath: filepath.Join(dataDir, "claudomator.db"),
LogDir: filepath.Join(dataDir, "executions"),
ClaudeBinaryPath: "claude",
+ GeminiBinaryPath: "gemini",
MaxConcurrent: 3,
DefaultTimeout: "15m",
ServerAddr: ":8484",