app

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Overview

Package app is the Bubble Tea application layer: the controller that owns the home model, routes keyboard input, and composes the ui view components.

Keyboard dispatch is two-staged: handleKeyPress in app.go selects a per-state handler in state_*.go, and within the default state keys flow through the Lua script engine via app_scripts.go's scriptHost adapter. The canonical keymap is script/defaults.lua, which users can extend or override from ~/.loom/scripts/*.lua.

Concurrency: the Lua script.Engine is not goroutine-safe, so every dispatch runs under the engine's mutex via a tea.Cmd goroutine; the goroutine emits a scriptDoneMsg that the main loop consumes in handleScriptDone. Never touch Bubble Tea state from inside the Lua engine — queue it on scriptHost and finalize on the main goroutine.

Index

Constants

View Source
const GlobalInstanceLimit = 10

GlobalInstanceLimit caps the number of simultaneously-tracked instances per workspace slot. Once reached, New/Prompt flows short- circuit with an error-bar message instead of allocating another worktree. The cap is a soft guardrail — tmux server memory and git worktree overhead are the real upper bound; raise deliberately.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, wsCtx *config.WorkspaceContext, registry *config.WorkspaceRegistry, appConfig *config.Config, program string, autoYes bool, pendingDir string, noScripts bool) error

Run starts the Bubble Tea program and blocks until the user quits or ctx is cancelled. It wires the home model, installs a shutdown hook that drains suspended Lua coroutines, and swallows no errors — a non-nil return means tea.Program.Run failed.

Parameters:

  • wsCtx is the resolved workspace context; nil falls back to the global config directory.
  • registry is the workspace registry for the startup workspace picker.
  • appConfig is the pre-loaded config from the resolved workspace dir.
  • program overrides the default agent command for new instances (empty string uses appConfig.GetProgram()).
  • autoYes enables the daemon-driven auto-confirm flow.
  • pendingDir is an optional directory to seed the new-instance overlay with (used by `loom` invoked from a non-workspace dir).
  • noScripts disables loading user scripts from ~/.loom/scripts; embedded defaults still load so core keybindings work.

Types

This section is empty.

Jump to

Keyboard shortcuts

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