Class: Aidp::Harness::UI::Navigation::WorkflowSelector

Inherits:
Base
  • Object
show all
Defined in:
lib/aidp/harness/ui/navigation/workflow_selector.rb

Overview

Handles workflow mode selection (simple vs advanced)

Defined Under Namespace

Classes: InvalidModeError, SelectionError, WorkflowError

Constant Summary collapse

WORKFLOW_MODES =
{
  simple: {
    name: "Simple Mode",
    description: "Predefined workflows with guided templates",
    icon: "🚀"
  },
  advanced: {
    name: "Advanced Mode",
    description: "Custom workflow configuration",
    icon: "⚙️"
  }
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ui_components = {}, prompt: nil) ⇒ WorkflowSelector

Returns a new instance of WorkflowSelector.



36
37
38
39
40
41
42
# File 'lib/aidp/harness/ui/navigation/workflow_selector.rb', line 36

def initialize(ui_components = {}, prompt: nil)
  super()
  @prompt = prompt || ui_components[:prompt] || TTY::Prompt.new
  @pastel = Pastel.new
  @formatter = ui_components[:formatter] || WorkflowFormatter.new
  @state_manager = ui_components[:state_manager]
end

Instance Attribute Details

#promptObject (readonly)

Expose for testability



21
22
23
# File 'lib/aidp/harness/ui/navigation/workflow_selector.rb', line 21

def prompt
  @prompt
end

Instance Method Details

#get_available_modesObject



63
64
65
# File 'lib/aidp/harness/ui/navigation/workflow_selector.rb', line 63

def get_available_modes
  WORKFLOW_MODES.keys
end

#get_mode_info(mode) ⇒ Object



67
68
69
70
# File 'lib/aidp/harness/ui/navigation/workflow_selector.rb', line 67

def get_mode_info(mode)
  validate_mode(mode)
  WORKFLOW_MODES[mode]
end

#is_advanced_mode?(mode) ⇒ Boolean

Returns:

  • (Boolean)


76
77
78
# File 'lib/aidp/harness/ui/navigation/workflow_selector.rb', line 76

def is_advanced_mode?(mode)
  mode == :advanced
end

#is_simple_mode?(mode) ⇒ Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/aidp/harness/ui/navigation/workflow_selector.rb', line 72

def is_simple_mode?(mode)
  mode == :simple
end

#select_workflow_modeObject



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/aidp/harness/ui/navigation/workflow_selector.rb', line 44

def select_workflow_mode
  display_mode_selection
  selection = prompt_for_mode_selection
  validate_selection(selection)

  selected_mode = parse_selection(selection)
  record_selection(selected_mode)
  selected_mode
rescue => e
  raise SelectionError, "Failed to select workflow mode: #{e.message}"
end

#show_mode_description(mode) ⇒ Object



56
57
58
59
60
61
# File 'lib/aidp/harness/ui/navigation/workflow_selector.rb', line 56

def show_mode_description(mode)
  validate_mode(mode)

  mode_info = WORKFLOW_MODES[mode]
  display_mode_info(mode_info)
end