AGENTS.md@pkg/tui · git:20260727.58ba826 · 2026-07-27 · sha256 4f182cf5fbf234d4
AGENTS.md@pkg/tui git:20260727.58ba826A
Immutable. This exact content is served forever at /api/v1/blob/4f182cf5fbf234d4.
# pkg/tui — AGENTS.md Fullscreen terminal chat app for Astonish (Claude Code / OpenCode–style). ## Scope - `app.go` — bubbletea root model (header, transcript viewport, status, input) - `approval.go` — tool approval overlay (`y`/`n`/options) - `sessions.go` — sessions picker + resume/new session - `commands.go` — slash command palette definitions and filtering (`/plan`, `/files`, `/sessions`, …) - `file_completion.go` — local `@file` completion and bounded inline context expansion - `theme.go` — lipgloss theme tokens (numbers, +/−, brand, NO_COLOR) - `wrap.go` — content margins, line truncation, padding - `events/` — event types + transcript reducer (+ `LoadHistory`) - `backend/` — `Backend` interface; platform impl is `pkg/launcher.platformBackend` - `render/` — pure markdown/code/diff/activity renderers (unit-test heavy) ## Key rules 1. **Chat is always platform-backed.** Requires `astonish login`. No in-process agent path in the TUI. 2. **TUI never imports `pkg/daemon` or agent wiring.** It only consumes `backend.Backend` and reduces `events.Event`. 3. **cmd stays thin** — no bubbletea models under `cmd/astonish`. 4. Soft-degrade Studio-only SSE events (`app_preview`, browser handoff, …) to system notices. 5. Plan mode is a TUI toggle that uses `backend.TurnOptions.SystemContext`; do not fork the agent/runtime path. ## Entry points - `astonish chat` → `launcher.RunChatTUI` → `tui.Run` - bare `astonish` → same path when stdin/stdout are TTYs and login exists ## When editing - Pure rendering / reducers: put tests next to the package. - Architecture: `docs/architecture/terminal-app.md`.