This document is the authoritative architecture note for LazyWorktree. Use it when changing package ownership, runtime flow, or other cross-cutting behaviour.
For a contributor-focused summary, see
docs/development/architecture.md.
LazyWorktree has two entry paths that share core subsystems:
- the Bubble Tea TUI in
internal/app - the scripting and machine-facing CLI in
internal/cli
cmd/lazyworktree stays intentionally small. Command wiring and startup live in
internal/bootstrap, while shared behaviour lives in packages such as
internal/git, internal/config, internal/security, internal/theme, and
internal/multiplexer.
internal/bootstrapowns command wiring, config bootstrap, and mode selection.internal/appowns the interactive model, rendering, async UI flows, and modal screens.internal/cliowns non-interactive and machine-readable operations.internal/gitowns Git, GitHub, and GitLab command execution and parsing.internal/configowns global config loading, Git config overlays, and.wtrepository config loading.internal/securityowns trust decisions for.wtlifecycle hooks.internal/themeowns built-in themes, custom themes, and terminal detection.internal/multiplexerowns tmux, zellij, shell, and container command assembly.
- Keep TUI-specific behaviour in
internal/app; do not route CLI logic through the UI model. - Keep command environment shaping and escaping rules shared so TUI and CLI do not drift.
- Keep rendering theme-backed; avoid hardcoded colours in UI code.
- Treat
.wtexecution as a trust-gated boundary and preserve the existing TOFU model unless an explicit security design change is intended.
Update this note when a change affects:
- package or subsystem ownership
- startup and control-flow boundaries
- config precedence rules
- trust and execution boundaries
- other architectural decisions that contributors need before editing