Skip to content

Ritual Runner TUI Overlay (RT.2-RT.8)#22

Open
JasonWarrenUK wants to merge 1 commit intomainfrom
feat/ritual-overlay
Open

Ritual Runner TUI Overlay (RT.2-RT.8)#22
JasonWarrenUK wants to merge 1 commit intomainfrom
feat/ritual-overlay

Conversation

@JasonWarrenUK
Copy link
Copy Markdown
Owner

Ritual Runner TUI Overlay (RT.2-RT.8)

Overview

Adds the TUI modal overlay that wraps the ritual runner state machine, enabling users to interact with scheduled and manually-triggered rituals through a step-by-step popup interface.

Summary

Imagine you've hired a very polite butler who appears at your desk every morning holding a clipboard. He walks you through your daily checklist one item at a time, only leaves when you've finished or performed a secret three-key handshake to dismiss him, and then quietly checks back every minute to see if there's another clipboard to present. That butler is now living inside your terminal.

Tip

No migration steps required. If you have ritual JSONC files in your store's rituals/ directory, the overlay will start presenting them automatically based on their schedule. Use :ritual <name> in the command palette to trigger one manually.


Changes

internal/tui/ritual_overlay.go — New file: modal overlay component
  • ritualOverlay struct wrapping ritual.Runner with viewport and textinput
  • Open() / Close() / IsActive() lifecycle methods
  • Update() routes key input based on current step type:
    • prompt: routes to textinput, Enter calls runner.SubmitPrompt()
    • query_list: j/k/s/x/e navigation forwarded via runner.HandleKey()
    • gate: Esc Esc d defer sequence, enter/space to advance
    • summary/view/action: enter/space to advance, esc to dismiss (nudge only)
  • View() renders bordered modal box with title ("Name — Step N/M"), scrollable viewport content, and step-specific footer hints
  • Step tracker maintained externally since Runner doesn't expose its index
internal/tui/app.go — Ritual integration into the main TUI loop
  • Added ritualOverlay, schedulerState, rituals fields to Model
  • New message types: ritualTriggerMsg, ritualCheckTickMsg
  • New(): loads rituals via ritual.LoadRituals(), creates scheduler state, registers :ritual palette command
  • Init(): returns ritualCheckTick() that fires immediately then every 60s
  • Update(): overlay gets first crack at messages when active (same pattern as palette); handles check tick → pending ritual detection → trigger; dismisses ritual in scheduler state on overlay close
  • View(): composites ritual overlay on top of frame using lipgloss Compositor

Introduces a modal overlay that wraps the ritual.Runner state machine,
presenting each step type (query_summary, query_list, prompt, gate,
action, view) in a bordered popup similar to the command palette.

- ritualOverlay struct with Open/Close/Update/View lifecycle
- Scheduler integration: 60s tick checks for due rituals, triggers first
  pending, dismisses on close
- Palette :ritual command for manual triggering by name
- Compositor layering in View() for overlay-on-top rendering
- Step-specific input routing: textinput for prompts, j/k/s/x/e for
  lists, enter/space for generic steps, Esc Esc d defer sequence for gates
- Footer keybinding hints per step type

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant