From 2fe594b550e89f1edf01fb4aae63a1b4e6a16354 Mon Sep 17 00:00:00 2001 From: Brad Gessler Date: Mon, 22 Jun 2026 18:13:52 -0700 Subject: [PATCH] v2/rails: delegate session from the CLI instance to the shell current_user/login/whoami call `session` on the Thor instance; the v2 shell has it (the session shim), but the instance didn't delegate. Add `def session = shell.session` to V2::Server::Thor::Helpers (matching v1's `def_delegators :shell, :session`), so unchanged Thor session code works over v2. Verified: v2-only ogplus whoami now returns the graceful 'must log in' instead of NameError. --- v2/ruby/lib/terminalwire/v2/rails.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/v2/ruby/lib/terminalwire/v2/rails.rb b/v2/ruby/lib/terminalwire/v2/rails.rb index 46c8cc8..6f488dc 100644 --- a/v2/ruby/lib/terminalwire/v2/rails.rb +++ b/v2/ruby/lib/terminalwire/v2/rails.rb @@ -23,6 +23,13 @@ def session end end +# Delegate `session` from the CLI instance to its shell — matching v1's +# `def_delegators :shell, :session` — so unchanged Thor code that calls `session` +# (current_user, login, whoami) works over v2 without app changes. +Terminalwire::V2::Server::Thor::Helpers.module_eval do + def session = shell.session +end + module Terminalwire module V2 # Drop-in Rails integration for serving a Terminalwire CLI over BOTH the v1