app

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 42 Imported by: 0

Documentation

Overview

Package app is the Kram CLI's Bubble Tea program: a chat transcript over a durable daemon session, with a compact live footer tracking the gateway's real fallback behavior and two on-demand panels — routing strategy and context-window usage. The CLI never talks to an LLM provider or persists anything itself — it's purely a view over what the daemon and gateway already own.

First-run setup wizard — an 8-step onboarding flow that runs the first time Kram starts with no completed setup (see internal/onboarding and cmd/kram's -setup flag). Technically split into two stages because gateway/daemon can only start once a valid config exists, and the tools/skills step needs a live daemon connection to list what's really registered — but every step shares one numbered header so it reads as one continuous flow to the user (see DECISIONS.md, "First-run wizard").

Stage 1 (steps 1-5: Environment, Projects, Providers, Routing, Permissions) runs as a second, standalone tea.Program (RunWizard), entirely before the daemon/gateway exist — nothing in it may touch m.daemon/m.gateway. The Providers step reuses phaseAccounts itself (see accounts.go's wizardMode branches) rather than a third phase.

Stage 2 (steps 6-8: Tools & Skills, System Check, Summary) runs inside the normal, post-daemon program, entered directly via app.New's openOnToolsPreset instead of the picker.

Shared visual chrome for the first-run wizard: every step renders through renderWizardFrame so the whole flow reads as one designed surface — gradient wordmark, step trail, a centered bordered card and a consistent key bar — instead of eight ad-hoc top-left text blocks. The palette stays Kram's own (see styles.go): subtle chrome, semantic colors, the identity gradient reserved for the wordmark.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model is the CLI's full Bubble Tea state.

func New

func New(daemon *daemonclient.Client, gateway *statusclient.Client, sessionID, combo, workspace string, openOnToolsPreset bool, wizard WizardResult) Model

New builds the initial model. If sessionID is empty, the program opens on the session picker instead of going straight to chat — unless openOnToolsPreset is true, meaning the first-run wizard just completed successfully in a separate program moments ago (see wizard.go, cmd/kram/main.go), in which case it opens on the wizard's Stage-2 continuation (tools/skills preset) instead, so the setup flow feels continuous instead of dropping into an empty picker. wizard carries Stage 1's choices purely for Stage-2's summary screen to display — this Model is a separate process/program from Stage 1's, so it has no other way to know what an earlier program's user picked; ignored (pass a zero WizardResult) when openOnToolsPreset is false.

func (Model) Init

func (m Model) Init() tea.Cmd

Init kicks off the session picker (if no session was given up front) or loads whatever history the daemon already has for an explicit session (it may not be empty — sessions are durable), plus a first, silent context-usage fetch so the footer icon has real data as soon as the screen draws.

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type WizardResult

type WizardResult struct {
	Cancelled       bool
	BootSplashShown bool // prevents Stage 2 from replaying boot in the same invocation
	Workspace       string
	ProjectsRoot    string
	Strategy        string // "" (Auto), "smart", "round-robin"
	PermPreset      string // "recommended", "strict", "autonomous"
}

WizardResult is what Stage 1 hands back to cmd/kram's main() once its standalone program exits.

func RunWizard

func RunWizard(explicitWorkspace string, workspaceExplicit bool) (WizardResult, error)

RunWizard runs Stage 1 (steps 1-5) as its own standalone Bubble Tea program — no daemon/gateway exist yet at this point, which is exactly why this can't just be a phase inside the normal post-daemon program. explicitWorkspace/workspaceExplicit mirror whatever -workspace the user passed (or didn't) on the command line.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL