Class: Aidp::Workflows::GuidedAgent

Inherits:
Object
  • Object
show all
Includes:
DebugMixin, MessageDisplay
Defined in:
lib/aidp/workflows/guided_agent.rb

Overview

Guided workflow agent that uses AI to help users select appropriate workflows Acts as a copilot to match user intent to AIDP capabilities

Defined Under Namespace

Classes: ConversationError

Constant Summary

Constants included from DebugMixin

DebugMixin::DEBUG_BASIC, DebugMixin::DEBUG_OFF, DebugMixin::DEBUG_VERBOSE

Constants included from MessageDisplay

MessageDisplay::COLOR_MAP, MessageDisplay::CRITICAL_TYPES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DebugMixin

#debug_basic?, #debug_command, #debug_enabled?, #debug_error, #debug_execute_command, #debug_level, #debug_log, #debug_logger, #debug_provider, #debug_step, #debug_timing, #debug_verbose?, included, shared_logger

Methods included from MessageDisplay

#display_message, included, #message_display_prompt, #quiet_mode?

Constructor Details

#initialize(project_dir, prompt: nil, use_enhanced_input: true, verbose: false, config_manager: nil, provider_manager: nil) ⇒ GuidedAgent

Returns a new instance of GuidedAgent.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/aidp/workflows/guided_agent.rb', line 26

def initialize(project_dir, prompt: nil, use_enhanced_input: true, verbose: false, config_manager: nil, provider_manager: nil)
  @project_dir = project_dir

  # Use EnhancedInput with Reline for full readline-style key bindings
  @prompt = if use_enhanced_input && prompt.nil?
    Aidp::CLI::EnhancedInput.new
  else
    prompt || TTY::Prompt.new
  end

  @config_manager = config_manager || Aidp::Harness::ConfigManager.new(project_dir)
  @provider_manager = provider_manager || Aidp::Harness::ProviderManager.new(@config_manager, prompt: @prompt)
  @conversation_history = []
  @user_input = {}
  @verbose = verbose
  @debug_env = ENV["DEBUG"] == "1" || ENV["DEBUG"] == "2"
end

Instance Attribute Details

#config_managerObject (readonly)

Expose for testability



23
24
25
# File 'lib/aidp/workflows/guided_agent.rb', line 23

def config_manager
  @config_manager
end

#conversation_historyObject (readonly)

Expose for testability



23
24
25
# File 'lib/aidp/workflows/guided_agent.rb', line 23

def conversation_history
  @conversation_history
end

#project_dirObject (readonly)

Expose for testability



23
24
25
# File 'lib/aidp/workflows/guided_agent.rb', line 23

def project_dir
  @project_dir
end

#provider_manager=(value) ⇒ Object (writeonly)

Sets the attribute provider_manager

Parameters:

  • value

    the value to set the attribute provider_manager to.



24
25
26
# File 'lib/aidp/workflows/guided_agent.rb', line 24

def provider_manager=(value)
  @provider_manager = value
end

#user_inputObject (readonly)

Expose for testability



23
24
25
# File 'lib/aidp/workflows/guided_agent.rb', line 23

def user_input
  @user_input
end

Instance Method Details

#select_workflowObject

Main entry point for guided workflow selection Uses plan-then-execute approach: iterative planning conversation to identify needed steps, then executes those steps



47
48
49
50
51
52
53
54
55
56
# File 'lib/aidp/workflows/guided_agent.rb', line 47

def select_workflow
  display_message("\nšŸ¤– Welcome to AIDP Guided Workflow!", type: :highlight)
  display_message("I'll help you plan and execute your project.\n", type: :info)

  validate_provider_configuration!

  plan_and_execute_workflow
rescue => e
  raise ConversationError, "Failed to guide workflow selection: #{e.message}"
end