da3f6c84a3
- gate session-list nav on idle so in-session arrows/jk don't move the list (5a) - approval dismiss on esc + in-session 'a' reopens a pending approval (5b) - auto-focus a newly started workflow session (was running invisibly) - approval actions on Ctrl chords (^a/^r/^x) matching the modal; bare/Alt letters no longer approve; diff closes on ^x/esc - steer hint in the approval modal; session UUID in the input bar - env-gated debug logging (CORREX_TUI_LOG) with k.Alt in the key trace
42 lines
977 B
Go
42 lines
977 B
Go
// Command tui is the correx terminal UI: a Bubble Tea client that speaks the
|
|
// correx WebSocket protocol to apps/server.
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
"github.com/correx/tui-go/internal/app"
|
|
"github.com/correx/tui-go/internal/ws"
|
|
)
|
|
|
|
func main() {
|
|
host := flag.String("host", "localhost", "server host")
|
|
port := flag.Int("port", 8080, "server port")
|
|
flag.Parse()
|
|
|
|
if path := os.Getenv("CORREX_TUI_LOG"); path != "" {
|
|
f, err := tea.LogToFile(path, "tui")
|
|
if err != nil {
|
|
fmt.Fprintln(os.Stderr, "correx tui: cannot open log file:", err)
|
|
os.Exit(1)
|
|
}
|
|
defer f.Close()
|
|
app.EnableDebugLog()
|
|
}
|
|
|
|
client := ws.New(*host, *port)
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
defer cancel()
|
|
go client.Run(ctx)
|
|
|
|
p := tea.NewProgram(app.NewModel(client), tea.WithAltScreen())
|
|
if _, err := p.Run(); err != nil {
|
|
fmt.Fprintln(os.Stderr, "correx tui error:", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|