tui: loom-core bootstrap — initialize plugin registry, storage & event bus #84

Closed
opened 2026-04-12 13:23:00 +00:00 by claude-desktop · 0 comments
Collaborator

User Story

As a loom-tui user, I want the TUI to initialize loom-core's plugin registry, SQLite storage, and event bus at startup, so that all screens can interact with the actual backend instead of running as empty scaffolds.

Context

All Phase 1–7 tickets (#11–#46) built the UI scaffolds — screens, components, overlays, keybindings — but none of them wire loom-core into the application. The TUI currently starts with no PluginManager, no GalleryStorage, no AiJobWorker, and no event broadcast subscription. This ticket is the foundation for every subsequent integration ticket.

Acceptance Criteria

Bootstrap

  • main.rs initializes loom-core config loading (AppSettings) at startup
  • PluginManager is created and wrapped in Arc<RwLock<…>>; PluginBridge facade is available
  • GalleryStorage (SQLite) is opened/migrated
  • AiJobWorker is started
  • All handles are stored in AppCtx and accessible to screens

Event Bus

  • tokio::sync::broadcast channel from loom-core is subscribed in the TUI event loop
  • Core events (generation progress, plugin messages, errors) are merged into EventStream
  • Events are routed to the correct screen/overlay via App::process_event

Error Handling

  • If loom-core initialization fails (e.g., database locked, plugin dir missing), a full-screen error dialog is shown with actionable instructions
  • Backend unreachable at startup is a non-fatal warning (notification bar), not a crash

Tests

  • Unit test: AppCtx construction with mock/test loom-core handles
  • Integration test: bootstrap sequence completes without panic on a clean config directory

Out of Scope

  • Wiring individual screens to loom-core (covered by #TBD per-screen integration tickets)
  • Image renderer threading (separate ticket)

References

  • Spec §1 (Architecture Overview), §5 (Plugin System Integration)
  • Tracking issue: #47
## User Story As a **loom-tui user**, I want the TUI to initialize loom-core's plugin registry, SQLite storage, and event bus at startup, so that all screens can interact with the actual backend instead of running as empty scaffolds. ## Context All Phase 1–7 tickets (#11–#46) built the UI scaffolds — screens, components, overlays, keybindings — but none of them wire loom-core into the application. The TUI currently starts with no `PluginManager`, no `GalleryStorage`, no `AiJobWorker`, and no event broadcast subscription. This ticket is the **foundation** for every subsequent integration ticket. ## Acceptance Criteria ### Bootstrap - [ ] `main.rs` initializes `loom-core` config loading (`AppSettings`) at startup - [ ] `PluginManager` is created and wrapped in `Arc<RwLock<…>>`; `PluginBridge` facade is available - [ ] `GalleryStorage` (SQLite) is opened/migrated - [ ] `AiJobWorker` is started - [ ] All handles are stored in `AppCtx` and accessible to screens ### Event Bus - [ ] `tokio::sync::broadcast` channel from loom-core is subscribed in the TUI event loop - [ ] Core events (generation progress, plugin messages, errors) are merged into `EventStream` - [ ] Events are routed to the correct screen/overlay via `App::process_event` ### Error Handling - [ ] If loom-core initialization fails (e.g., database locked, plugin dir missing), a full-screen error dialog is shown with actionable instructions - [ ] Backend unreachable at startup is a non-fatal warning (notification bar), not a crash ### Tests - [ ] Unit test: `AppCtx` construction with mock/test loom-core handles - [ ] Integration test: bootstrap sequence completes without panic on a clean config directory ## Out of Scope - Wiring individual screens to loom-core (covered by #TBD per-screen integration tickets) - Image renderer threading (separate ticket) ## References - Spec §1 (Architecture Overview), §5 (Plugin System Integration) - Tracking issue: #47
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/loom#84
No description provided.