feat: TUI views, full state machine, and server integration

Add title, lobby, class select, game, shop, and result screens.
Rewrite model.go with 6-screen state machine and input routing.
Wire server/ssh.go and main.go with lobby and store.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-24 00:11:56 +09:00
parent 15956efb18
commit 4e76e48588
10 changed files with 646 additions and 10 deletions

View File

@@ -9,10 +9,12 @@ import (
"github.com/charmbracelet/wish/bubbletea"
tea "github.com/charmbracelet/bubbletea"
gossh "golang.org/x/crypto/ssh"
"github.com/tolelom/catacombs/game"
"github.com/tolelom/catacombs/store"
"github.com/tolelom/catacombs/ui"
)
func Start(host string, port int) error {
func Start(host string, port int, lobby *game.Lobby, db *store.DB) error {
s, err := wish.NewServer(
wish.WithAddress(fmt.Sprintf("%s:%d", host, port)),
wish.WithHostKeyPath(".ssh/catacombs_host_key"),
@@ -26,7 +28,7 @@ func Start(host string, port int) error {
if s.PublicKey() != nil {
fingerprint = gossh.FingerprintSHA256(s.PublicKey())
}
m := ui.NewModel(pty.Window.Width, pty.Window.Height, fingerprint)
m := ui.NewModel(pty.Window.Width, pty.Window.Height, fingerprint, lobby, db)
return m, []tea.ProgramOption{tea.WithAltScreen()}
}),
),