Class: RubynCode::CLI::Commands::Context

Inherits:
Data
  • Object
show all
Defined in:
lib/rubyn_code/cli/commands/context.rb

Overview

Immutable context object passed to every slash command. Provides access to all REPL dependencies without coupling commands to the REPL class itself.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#agent_loopObject (readonly)

Returns the value of attribute agent_loop

Returns:

  • (Object)

    the current value of agent_loop



9
10
11
# File 'lib/rubyn_code/cli/commands/context.rb', line 9

def agent_loop
  @agent_loop
end

#background_workerObject (readonly)

Returns the value of attribute background_worker

Returns:

  • (Object)

    the current value of background_worker



9
10
11
# File 'lib/rubyn_code/cli/commands/context.rb', line 9

def background_worker
  @background_worker
end

#budget_enforcerObject (readonly)

Returns the value of attribute budget_enforcer

Returns:

  • (Object)

    the current value of budget_enforcer



9
10
11
# File 'lib/rubyn_code/cli/commands/context.rb', line 9

def budget_enforcer
  @budget_enforcer
end

#context_managerObject (readonly)

Returns the value of attribute context_manager

Returns:

  • (Object)

    the current value of context_manager



9
10
11
# File 'lib/rubyn_code/cli/commands/context.rb', line 9

def context_manager
  @context_manager
end

#conversationObject (readonly)

Returns the value of attribute conversation

Returns:

  • (Object)

    the current value of conversation



9
10
11
# File 'lib/rubyn_code/cli/commands/context.rb', line 9

def conversation
  @conversation
end

#dbObject (readonly)

Returns the value of attribute db

Returns:

  • (Object)

    the current value of db



9
10
11
# File 'lib/rubyn_code/cli/commands/context.rb', line 9

def db
  @db
end

#llm_clientObject (readonly)

Returns the value of attribute llm_client

Returns:

  • (Object)

    the current value of llm_client



9
10
11
# File 'lib/rubyn_code/cli/commands/context.rb', line 9

def llm_client
  @llm_client
end

#message_handlerObject (readonly)

Returns the value of attribute message_handler

Returns:

  • (Object)

    the current value of message_handler



9
10
11
# File 'lib/rubyn_code/cli/commands/context.rb', line 9

def message_handler
  @message_handler
end

#permission_tierObject (readonly)

Returns the value of attribute permission_tier

Returns:

  • (Object)

    the current value of permission_tier



9
10
11
# File 'lib/rubyn_code/cli/commands/context.rb', line 9

def permission_tier
  @permission_tier
end

#plan_modeObject (readonly)

Returns the value of attribute plan_mode

Returns:

  • (Object)

    the current value of plan_mode



9
10
11
# File 'lib/rubyn_code/cli/commands/context.rb', line 9

def plan_mode
  @plan_mode
end

#project_rootObject (readonly)

Returns the value of attribute project_root

Returns:

  • (Object)

    the current value of project_root



9
10
11
# File 'lib/rubyn_code/cli/commands/context.rb', line 9

def project_root
  @project_root
end

#rendererObject (readonly)

Returns the value of attribute renderer

Returns:

  • (Object)

    the current value of renderer



9
10
11
# File 'lib/rubyn_code/cli/commands/context.rb', line 9

def renderer
  @renderer
end

#session_idObject (readonly)

Returns the value of attribute session_id

Returns:

  • (Object)

    the current value of session_id



9
10
11
# File 'lib/rubyn_code/cli/commands/context.rb', line 9

def session_id
  @session_id
end

#session_persistenceObject (readonly)

Returns the value of attribute session_persistence

Returns:

  • (Object)

    the current value of session_persistence



9
10
11
# File 'lib/rubyn_code/cli/commands/context.rb', line 9

def session_persistence
  @session_persistence
end

#skill_loaderObject (readonly)

Returns the value of attribute skill_loader

Returns:

  • (Object)

    the current value of skill_loader



9
10
11
# File 'lib/rubyn_code/cli/commands/context.rb', line 9

def skill_loader
  @skill_loader
end

Instance Method Details

#plan_mode?Boolean

Returns:

  • (Boolean)


40
# File 'lib/rubyn_code/cli/commands/context.rb', line 40

def plan_mode? = plan_mode

#send_message(text) ⇒ Object

Parameters:

  • text (String)

    message to send through the agent loop



35
36
37
# File 'lib/rubyn_code/cli/commands/context.rb', line 35

def send_message(text)
  message_handler&.call(text)
end

#with_message_handler(handler) ⇒ Object

Convenience: return a new Context with a message handler attached. Used by commands like /review that delegate to the LLM.

Parameters:

  • handler (Proc)

    the REPL’s handle_message proc



30
31
32
# File 'lib/rubyn_code/cli/commands/context.rb', line 30

def with_message_handler(handler)
  with(message_handler: handler)
end