app

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package app is the root Bubble Tea model for the squad TUI. It composes three sub-views — sidebar (left), focused-run panel (right), and a polymorphic bottom pane (default: composer) — under a single status indicator. The model owns selection, dimensions, and the animation frame; sub-views handle their own internal state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MockRuns

func MockRuns() []sidebar.Run

MockRuns returns a hand-crafted list of runs covering all sidebar states so the TUI has interesting content before the real subprocess registry lands. Treat as a fixture, not an example.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App is the root model. It holds either a static list of runs (mock / test mode) or a set of disk-backed tailers, but not both. The renderer derives the sidebar list from whichever source is populated.

func AsApp

func AsApp(m tea.Model) (App, bool)

AsApp narrows a tea.Model back to App. Kept in production code so the per-file go-critic runner can resolve the type — test files alone cannot reference sibling-file types under gocritic's caseOrder check.

func New

func New(runs []sidebar.Run) App

New returns an App rendering a static list of runs (no disk I/O). Use this for tests and demos.

func NewWithSessions

func NewWithSessions(sessionsRoot, workingDir, providerToken string) (App, error)

NewWithSessions returns an App that auto-discovers + tails the session directories under sessionsRoot (typically ".squad/sessions"). Missing root is not an error — the app renders empty until sessions appear. workingDir is the directory in which launched subprocesses are spawned.

func (App) Init

func (a App) Init() tea.Cmd

Init starts the animation tick and forwards Init to the pane.

func (App) Quitting

func (a App) Quitting() bool

Quitting reports whether ctrl-c has been pressed.

func (App) Selected

func (a App) Selected() string

Selected returns the currently-selected run's session ID, or "" if no run is selected.

func (App) Size

func (a App) Size() (int, int)

Size returns the current (width, height) from the most recent WindowSizeMsg, or (0, 0) before the first resize.

func (App) Update

func (a App) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update is the root message router.

func (App) View

func (a App) View() string

View renders the full screen.

Layout:

╭── SQUAD ──────────────────────────────────────────────────╮
│  RUNS                    FOCUSED                          │
│  WORKING (3)             session id ...                   │
│  ▶ go-review             metrics, events, errors          │
│  ...                                                      │
│  ✻ Working · go-review · 3m 12s          esc to interrupt │
╰───────────────────────────────────────────────────────────╯
  toast message (if any)
> type a prompt, /command, !shell, or @file …

The panel is padded vertically to fill (height - toast - composer), so the chrome reaches the bottom of the terminal instead of leaving dead black space below.

func (App) WithAgents

func (a App) WithAgents(names []string) App

WithAgents seeds the discovered-agents list shown in the launch form typeahead. Order is preserved; callers should pass already-sorted names.

func (App) WithPresets

func (a App) WithPresets(store *presets.Store) App

WithPresets attaches a presets store. Returns the receiver so calls chain cleanly with the constructors.

func (App) WithProviderToken

func (a App) WithProviderToken(token string) App

WithProviderToken seeds the resolved config provider.token used by the launch form's API-key readiness check.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL