Class: Aidp::Harness::SimpleUserInterface

Inherits:
Object
  • Object
show all
Includes:
MessageDisplay
Defined in:
lib/aidp/harness/simple_user_interface.rb

Overview

Simple, focused user interface for collecting feedback Replaces the bloated UserInterface with minimal, clean code

Constant Summary

Constants included from MessageDisplay

MessageDisplay::COLOR_MAP

Instance Method Summary collapse

Methods included from MessageDisplay

#display_message, included, #message_display_prompt

Constructor Details

#initialize(prompt: TTY::Prompt.new) ⇒ SimpleUserInterface

Returns a new instance of SimpleUserInterface.



12
13
14
# File 'lib/aidp/harness/simple_user_interface.rb', line 12

def initialize(prompt: TTY::Prompt.new)
  @prompt = prompt
end

Instance Method Details

#collect_feedback(questions, context = nil) ⇒ Object

Main method - collect responses for questions



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/aidp/harness/simple_user_interface.rb', line 17

def collect_feedback(questions, context = nil)
  show_context(context) if context

  responses = {}
  questions.each_with_index do |question_data, index|
    key = "question_#{question_data[:number] || index + 1}"
    responses[key] = ask_question(question_data)
  end

  responses
end

#get_confirmation(message, default: true) ⇒ Object



29
30
31
# File 'lib/aidp/harness/simple_user_interface.rb', line 29

def get_confirmation(message, default: true)
  @prompt.yes?(message, default: default)
end