Class: Rubino::CLI::ChatCommand

Inherits:
Object
  • Object
show all
Includes:
UI::ProbeWaitIndicator
Defined in:
lib/rubino/cli/chat_command.rb

Overview

Interactive and non-interactive chat session command. Supported flags:

-q/--query    one-shot non-interactive prompt
-c/--continue resume most recent session
-r/--resume   resume session by ID or title
--provider    override provider
--yolo        skip all approval prompts
--max-turns   override max tool iterations
--ignore-rules skip AGENTS.md and context files

Constant Summary collapse

DOUBLE_TAP_SECONDS =

Window (seconds) for the Aider-style double-tap: a second Ctrl+C within this of the first re-raises so the user can actually quit.

2.0
REWIND_SNIPPET_CHARS =

Picker snippet length — enough to recognize the message at a glance.

60
YOLO_CONFIRM_MIN_SECONDS =

The confirm press must come after a deliberate beat (a blind mash re-arms instead of confirming — the exact failure mode of #152 was 2-5 quick presses while watching the stream) and before the arm goes stale (the toast is long gone; a lone later press must re-confirm).

0.3
YOLO_CONFIRM_WINDOW_SECONDS =
5.0
PROMPT_CARET =
""
PROMPT_RAIL =
""

Instance Method Summary collapse

Methods included from UI::ProbeWaitIndicator

#probe_thinking_finished, #probe_thinking_started

Constructor Details

#initialize(options = {}) ⇒ ChatCommand

Returns a new instance of ChatCommand.



37
38
39
# File 'lib/rubino/cli/chat_command.rb', line 37

def initialize(options = {})
  @options = options
end

Instance Method Details

#executeObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/rubino/cli/chat_command.rb', line 41

def execute
  ensure_setup!
  ensure_model_configured!

  query = opt(:query) || opt(:q)
  if query
    run_oneshot(query)
  else
    run_interactive
  end
rescue Rubino::AmbiguousSessionError, Rubino::SessionError => e
  # Render session-resolution errors as a clean stderr message + non-zero
  # exit, not a Ruby stack trace. AmbiguousSessionError's message
  # already includes the candidate list, so just print it.
  warn e.message
  exit(1)
end