From 2e2b2187b957e9af78797a67ec5c6874615fae02 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Sun, 8 Feb 2026 21:35:45 -1000 Subject: 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 --- internal/cli/list.go | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 internal/cli/list.go (limited to 'internal/cli/list.go') diff --git a/internal/cli/list.go b/internal/cli/list.go new file mode 100644 index 0000000..a7515a1 --- /dev/null +++ b/internal/cli/list.go @@ -0,0 +1,59 @@ +package cli + +import ( + "fmt" + "os" + "text/tabwriter" + + "github.com/claudomator/claudomator/internal/storage" + "github.com/claudomator/claudomator/internal/task" + "github.com/spf13/cobra" +) + +func newListCmd() *cobra.Command { + var state string + + cmd := &cobra.Command{ + Use: "list", + Short: "List tasks", + RunE: func(cmd *cobra.Command, args []string) error { + return listTasks(state) + }, + } + + cmd.Flags().StringVar(&state, "state", "", "filter by state (PENDING, RUNNING, COMPLETED, FAILED)") + + return cmd +} + +func listTasks(state string) error { + store, err := storage.Open(cfg.DBPath) + if err != nil { + return fmt.Errorf("opening db: %w", err) + } + defer store.Close() + + filter := storage.TaskFilter{} + if state != "" { + filter.State = task.State(state) + } + + tasks, err := store.ListTasks(filter) + if err != nil { + return err + } + + if len(tasks) == 0 { + fmt.Println("No tasks found.") + return nil + } + + w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0) + fmt.Fprintln(w, "ID\tNAME\tSTATE\tPRIORITY\tCREATED") + for _, t := range tasks { + fmt.Fprintf(w, "%.8s\t%s\t%s\t%s\t%s\n", + t.ID, t.Name, t.State, t.Priority, t.CreatedAt.Format("2006-01-02 15:04")) + } + w.Flush() + return nil +} -- cgit v1.2.3