Class: RubynCode::CLI::REPL

Inherits:
Object
  • Object
show all
Includes:
ReplCommands, ReplLifecycle, ReplSetup
Defined in:
lib/rubyn_code/cli/repl.rb

Constant Summary

Constants included from ReplLifecycle

RubynCode::CLI::ReplLifecycle::GOODBYE_MESSAGES

Instance Method Summary collapse

Constructor Details

#initialize(session_id: nil, project_root: Dir.pwd, yolo: false) ⇒ REPL

Returns a new instance of REPL.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/rubyn_code/cli/repl.rb', line 15

def initialize(session_id: nil, project_root: Dir.pwd, yolo: false)
  @project_root = project_root
  @input_handler = InputHandler.new
  @renderer = Renderer.new
  @renderer.yolo = yolo
  @spinner = Spinner.new
  @running = true
  @session_id = session_id
  @permission_tier = yolo ? :unrestricted : :allow_read
  @plan_mode = false

  setup_components!
  setup_command_registry!
  setup_readline!
end

Instance Method Details

#runObject



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/rubyn_code/cli/repl.rb', line 31

def run
  @version_check = VersionCheck.new(renderer: @renderer)
  @version_check.start

  @renderer.welcome
  @version_check.notify

  at_exit { shutdown! }

  @last_interrupt = nil
  run_input_loop
  shutdown!
end