Class: Aidp::Execute::DeterministicUnits::Runner

Inherits:
Object
  • Object
show all
Includes:
MessageDisplay, RescueLogging
Defined in:
lib/aidp/execute/deterministic_unit.rb

Overview

Executes deterministic units by running commands or internal behaviours.

Constant Summary collapse

DEFAULT_TIMEOUT =

One hour ceiling for long-running commands

3600

Constants included from MessageDisplay

MessageDisplay::COLOR_MAP

Instance Method Summary collapse

Methods included from RescueLogging

__log_rescue_impl, log_rescue, #log_rescue

Methods included from MessageDisplay

#display_message, included, #message_display_prompt

Constructor Details

#initialize(project_dir, command_runner: nil, clock: Time) ⇒ Runner

Returns a new instance of Runner.



122
123
124
125
126
# File 'lib/aidp/execute/deterministic_unit.rb', line 122

def initialize(project_dir, command_runner: nil, clock: Time)
  @project_dir = project_dir
  @clock = clock
  @command_runner = command_runner || build_default_command_runner
end

Instance Method Details

#run(definition, context = {}) ⇒ Object

Raises:

  • (ArgumentError)


128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/aidp/execute/deterministic_unit.rb', line 128

def run(definition, context = {})
  raise ArgumentError, "Unit #{definition.name} is not enabled" unless definition.enabled

  case definition.type
  when :command
    execute_command_unit(definition, context)
  when :wait
    execute_wait_unit(definition, context)
  else
    raise ArgumentError, "Unsupported deterministic unit type: #{definition.type}"
  end
end