diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-02-08 21:35:45 -1000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-02-08 21:35:45 -1000 |
| commit | 2e2b2187b957e9af78797a67ec5c6874615fae02 (patch) | |
| tree | 1181dbb7e43f5d30cb025fa4d50fd4e7a2c893b3 /internal/cli/status.go | |
Initial project: task model, executor, API server, CLI, storage, reporter
Claudomator automation toolkit for Claude Code with:
- Task model with YAML parsing, validation, state machine (49 tests, 0 races)
- SQLite storage for tasks and executions
- Executor pool with bounded concurrency, timeout, cancellation
- REST API + WebSocket for mobile PWA integration
- Webhook/multi-notifier system
- CLI: init, run, serve, list, status commands
- Console, JSON, HTML reporters with cost tracking
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/cli/status.go')
| -rw-r--r-- | internal/cli/status.go | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/internal/cli/status.go b/internal/cli/status.go new file mode 100644 index 0000000..4613fee --- /dev/null +++ b/internal/cli/status.go @@ -0,0 +1,63 @@ +package cli + +import ( + "fmt" + "os" + "text/tabwriter" + + "github.com/claudomator/claudomator/internal/storage" + "github.com/spf13/cobra" +) + +func newStatusCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "status <task-id>", + Short: "Show task status and execution history", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + return showStatus(args[0]) + }, + } + return cmd +} + +func showStatus(id string) error { + store, err := storage.Open(cfg.DBPath) + if err != nil { + return fmt.Errorf("opening db: %w", err) + } + defer store.Close() + + // Try full ID first, then prefix match. + t, err := store.GetTask(id) + if err != nil { + return fmt.Errorf("task %q not found", id) + } + + fmt.Printf("Task: %s\n", t.Name) + fmt.Printf("ID: %s\n", t.ID) + fmt.Printf("State: %s\n", t.State) + fmt.Printf("Priority: %s\n", t.Priority) + fmt.Printf("Model: %s\n", t.Claude.Model) + if t.Description != "" { + fmt.Printf("Description: %s\n", t.Description) + } + + execs, err := store.ListExecutions(t.ID) + if err != nil { + return err + } + + if len(execs) > 0 { + fmt.Printf("\nExecutions (%d):\n", len(execs)) + w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0) + fmt.Fprintln(w, " ID\tSTATUS\tEXIT\tCOST\tDURATION\tSTARTED") + for _, e := range execs { + dur := e.EndTime.Sub(e.StartTime) + fmt.Fprintf(w, " %.8s\t%s\t%d\t$%.4f\t%v\t%s\n", + e.ID, e.Status, e.ExitCode, e.CostUSD, dur.Round(1e9), e.StartTime.Format("15:04:05")) + } + w.Flush() + } + return nil +} |
