Add page-based TUI DSL
Each screen is now a self-contained `page` block with its own `enter`, `render`, and `key` handlers. Shared logic lives in a `helpers` block mixed into the render context. A `chrome` block renders persistent UI (header, sidebar, footer) before every frame. New context primitives: `go(page)` for transitions, `reload` to re-run the current page's `enter` block, `printable` key binding for text input. `FlowRunner#run_tui` now passes the flow context to TUIRunner so username and other session data are available without reaching into internals. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,7 +18,7 @@ module BBS
|
||||
red: "\e[1;31m",
|
||||
}.freeze
|
||||
|
||||
attr_reader :session_id
|
||||
attr_reader :session_id, :session
|
||||
|
||||
def initialize(session, session_id, flow)
|
||||
@session = session
|
||||
@@ -343,7 +343,7 @@ module BBS
|
||||
end
|
||||
|
||||
def run_tui(step)
|
||||
TUIRunner.new(@session, @session_id, step[:definition]).run
|
||||
TUIRunner.new(@session, @session_id, step[:definition], context: @ctx).run
|
||||
nil
|
||||
rescue IOError, Errno::EPIPE, Errno::ECONNRESET
|
||||
:halt
|
||||
|
||||
Reference in New Issue
Block a user