Skip to content

[feature] sp tui — interactive full-screen scratch browser #26

Description

@rwrife

Pitch

The 2026 "terminal renaissance" rewards small tools that offer an optional TUI (Posting, lazygit, serpl, etc.). scratchpatch is currently pure command + colorized table — great for scripting, but browsing/managing many scratches means eyeballing sp ls and copy-pasting IDs. sp tui adds an optional full-screen Bubble Tea browser over the same store: arrow-key through live + morgue scratches, preview content in a side pane, and act on the selection (open, rm→morgue, resurrect, promote, pin) without ever leaving the terminal.

This is explicitly a v0.2 capability — the v0.1 PLAN.md deliberately deferred a TUI ("no full-screen UI" in M-scope). Now that the command surface is stable, the TUI is a thin interactive shell over existing store/index/render logic, not a rewrite.

Why it fits

  • Reuses internal/store, internal/index, internal/ttl, and the existing secret-scan + expiry classification. No new source-of-truth.
  • Charm stack (lipgloss) is already a dependency; bubbletea + bubbles are the natural companions.
  • Strictly additive: scripting/--json paths untouched; sp tui is opt-in and degrades to a clear error when stdout is not a TTY.

Acceptance criteria

  • sp tui launches a full-screen browser listing live scratches (id, name, age, expires-in, size, 🔑 secret marker), color-coded by expiry like sp ls.
  • Toggle to the morgue view (e.g. tab/m) showing purge countdowns.
  • Right-hand preview pane shows the selected scratch's content (respects/notes secret scratches; does not dump raw credentials by default).
  • Key-bound actions on the selection: open in $EDITOR (suspend/restore TUI), rm (→ morgue), resurrect, promote, with a confirmation for anything that moves files. All go through existing store operations (still two-step / never hard-delete from the TUI).
  • Live filter/search box (by name/tag).
  • Graceful, clear error when not attached to a TTY ("sp tui needs an interactive terminal; use sp ls/sp ls --json for scripting").
  • Help/keybinding footer; q/esc quits cleanly and restores the terminal.
  • No changes to any --json or plain command output; TUI code isolated (e.g. internal/tui).
  • Tests where practical (model update/transition unit tests via Bubble Tea's test helpers); go build/go vet/go test ./.../gofmt clean.
  • README documents sp tui and its keybindings.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature / backlog item

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions