# apps/tui-go

## Purpose

Terminal UI for correx. A Go/Bubble Tea application that connects to `apps/server` over WebSocket and renders session state in a "Soft + blue" visual style.

## Ownership

All sources under `apps/tui-go/`. Separate Go module (`github.com/correx/tui-go`) — independent build and test toolchain from the Gradle/Kotlin apps.

## Local Contracts

- Connects to `apps/server` at the configured WebSocket endpoint; does not import any Kotlin/JVM code.
- **Receives** `ServerMessage` JSON over WebSocket (session lifecycle, approval requests, clarification requests, narration, proposed workflows, health/metrics).
- **Sends** `ClientMessage` JSON (StartSession, ApproveToolCall, RejectToolCall, AnswerClarification, SetChatMode, etc.).
- Protocol types are mirrored in `internal/protocol/` — must stay in sync with `apps/server/src/.../protocol/`.
- Visual theme: "Soft + blue" (see `internal/app/theme.go`). Reference design lives in `docs/visual/ref/`.
- Key layout defined in `internal/app/key.go`.
- Main model in `internal/app/model.go`; update loop in `internal/app/update.go`; rendering in `internal/app/view.go`.
- Overlays (sessions, tasks, config, ideas) in `internal/app/overlays.go` and sibling files.

## Work Guidance

- Standard Go conventions: `gofmt`-formatted, exported names for cross-package types, unexported for internal.
- Add new WS message handling in `internal/ws/client.go` → dispatch via Bubble Tea `Msg` types → handled in `update.go`.
- New UI panels follow the existing card/overlay pattern (see `clarcard.go`, `proposecard.go`).
- Keep theme constants in `theme.go`; do not hardcode colors elsewhere.

## Verification

```bash
cd apps/tui-go && go build ./... && go test ./...
```

## Child DOX Index

No child AGENTS.md (leaf module).
