xonecas.io
60255
Zn

Zoea-Nova / commit d80f9ea

feat: add --start-swarm CLI flag

Auto-starts all idle myses on application launch when enabled.
Default: disabled (opt-in behavior)

xonecas2026-02-07 d80f9ea43f5505c1f68fe03c3e395134d3d3bbf2 parent 28e686f

3 files changed

cmd/zoea/main.go+2−1
@@ -37,6 +37,7 @@ func main() {
3737 debug = flag.Bool("debug", false, "Enable debug logging")
3838 testMCP = flag.Bool("test-mcp", false, "Test MCP connection and tool calling, then exit")
3939 offline = flag.Bool("offline", false, "Run in offline mode with stub MCP server")
40+ startSwarm = flag.Bool("start-swarm", false, "Auto-start all idle myses on launch")
4041 )
4142 flag.Parse()
4243
@@ -159,7 +160,7 @@ func main() {
159160 eventCh := bus.Subscribe()
160161
161162 // Create and run TUI
162- model := tui.New(commander, s, eventCh)
163+ model := tui.New(commander, s, eventCh, *startSwarm)
163164
164165 // Set cleanup callback to close event bus before quit
165166 model.SetOnQuit(func() {
internal/tui/app.go+19−1
@@ -43,6 +43,7 @@ type Model struct {
4343 focusID string
4444
4545 pendingProvider string
46+ startSwarm bool // auto-start idle myses on launch
4647
4748 // Swarm broadcast history
4849 swarmMessages []SwarmMessage
@@ -89,7 +90,7 @@ type EventMsg struct {
8990 }
9091
9192 // New creates a new TUI model.
92-func New(commander *core.Commander, s *store.Store, eventCh <-chan core.Event) Model {
93+func New(commander *core.Commander, s *store.Store, eventCh <-chan core.Event, startSwarm bool) Model {
9394 // Initialize spinner with hexagonal theme (matching logo)
9495 sp := spinner.New()
9596 sp.Spinner = spinner.Spinner{
@@ -113,6 +114,7 @@ func New(commander *core.Commander, s *store.Store, eventCh <-chan core.Event) M
113114 loadingSet: make(map[string]bool),
114115 viewport: vp,
115116 netIndicator: NewNetIndicator(),
117+ startSwarm: startSwarm,
116118 }
117119 }
118120
@@ -123,6 +125,11 @@ func (m *Model) SetOnQuit(fn func()) {
123125
124126 // Init initializes the model.
125127 func (m Model) Init() tea.Cmd {
128+ // Auto-start idle myses if flag enabled
129+ if m.startSwarm {
130+ go m.autoStartIdleMyses()
131+ }
132+
126133 return tea.Batch(
127134 m.netIndicator.Init(),
128135 m.refreshMyses(),
@@ -131,6 +138,17 @@ func (m Model) Init() tea.Cmd {
131138 )
132139 }
133140
141+// autoStartIdleMyses starts all myses in idle state (no error).
142+func (m Model) autoStartIdleMyses() {
143+ myses := m.commander.ListMyses()
144+ for _, mysis := range myses {
145+ // Start myses that are not errored (idle state)
146+ if mysis.LastError() == nil {
147+ _ = m.commander.StartMysis(mysis.ID())
148+ }
149+ }
150+}
151+
134152 // Update handles messages.
135153 func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
136154 var cmds []tea.Cmd
internal/tui/tui_test.go+1−1
@@ -50,7 +50,7 @@ func setupTestModel(t *testing.T) (Model, func()) {
5050
5151 commander := core.NewCommander(s, reg, bus, cfg)
5252
53- model := New(commander, s, eventCh)
53+ model := New(commander, s, eventCh, false)
5454 model.width = 80
5555 model.height = 24