Skip to content

Interactive gremlins --watch: arrow-key selection with inline expanding log tail #324

@xbrianh

Description

@xbrianh

Proposal

gremlins --watch becomes a single-pane interactive TUI:

  • Fleet rows render as today (KIND/ID/STAGE/LIVENESS/AGE/BOSS/CLIENT/DESCRIPTION).
  • ↑/↓ move selection; the selected row is highlighted.
  • The selected row expands inline: dimmed live log tail appears directly below it; rows after the selection shift down. Switching selection collapses the previous row and expands the new one.
  • q quits. Other keys (drill-in, stop, land) optional follow-ups.

The log tail follows a log -f of the selected gremlin's log file. Bounded buffer (e.g. last 500 lines or so) to keep redraws cheap; auto-scrolls. Dimmed styling matches Claude Code's pattern of streaming output below a prompt.

Why single-pane (accordion) instead of split

  • Spatial locality: log lines appear next to the gremlin they belong to.
  • Self-adjusting: log gets whatever vertical space the rest of the table doesn't claim. Small fleet, lots of log; large fleet, less log.
  • No fixed-height pane waste when the fleet is small.

Implementation notes

  • textual is the natural fit — collapsible rows are first-class and async log streaming integrates cleanly.
  • Fall back to today's static refresh when stdout isn't a TTY (piped output, etc.).
  • Selection persistence: when the table refreshes (a gremlin finishes, a new one launches), keep the cursor on the same gremlin ID, not the same row index.
  • Log file source: each gremlin's <state-dir>/log is the canonical stream — same file gremlins log -f reads.

Acceptance

  • Launching gremlins --watch in a TTY shows the table with one row pre-selected and its log expanded below.
  • ↑/↓ moves selection; previous row collapses, new row expands with its log.
  • q exits cleanly.
  • Non-TTY invocation falls back to the current static refresh behavior.

Dependencies

Depends on #736 (surface active inner stage for container stages) — the STAGE column already renders the nested path before this TUI lands.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions