Archived
Add submarine TUI prototype with mock data
Bubble Tea prototype for browsing repositories with many nested git submodules: collapsible tree, pins shown as ref + distance, summarized issue words with severity levels, detail pane, async loading via a Provider interface backed by mock data. Includes docs/ with requirements, state model, UX guide, architecture and decision log, plus AGENTS.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
// Command submarine is a TUI for repositories with many git submodules.
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
zone "github.com/lrstanley/bubblezone"
|
||||
|
||||
"submarine/internal/submodule"
|
||||
"submarine/internal/submodule/mock"
|
||||
"submarine/internal/tui"
|
||||
)
|
||||
|
||||
func main() {
|
||||
useMock := flag.Bool("mock", true, "use built-in mock data instead of a real repository")
|
||||
flag.Parse()
|
||||
|
||||
var provider submodule.Provider
|
||||
if *useMock {
|
||||
provider = mock.New()
|
||||
} else {
|
||||
fmt.Fprintln(os.Stderr, "only --mock is supported in the prototype")
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
// Detect the background (for adaptive colors) before Bubble Tea takes
|
||||
// over stdin; the result is cached by lipgloss.
|
||||
lipgloss.HasDarkBackground()
|
||||
|
||||
zone.NewGlobal()
|
||||
defer zone.Close()
|
||||
|
||||
p := tea.NewProgram(tui.New(ctx, provider), tea.WithAltScreen(), tea.WithMouseCellMotion())
|
||||
if _, err := p.Run(); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user