Class: Aidp::Skills::Wizard::Prompter

Inherits:
Object
  • Object
show all
Defined in:
lib/aidp/skills/wizard/prompter.rb

Overview

Interactive prompter for the skill wizard

Uses TTY::Prompt to gather user input through guided questions.

Examples:

Basic usage

prompter = Prompter.new
responses = prompter.gather_responses(template_library)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Prompter.



18
19
20
# File 'lib/aidp/skills/wizard/prompter.rb', line 18

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

Instance Attribute Details

#promptObject (readonly)

Returns the value of attribute prompt.



16
17
18
# File 'lib/aidp/skills/wizard/prompter.rb', line 16

def prompt
  @prompt
end

Instance Method Details

#gather_responses(template_library, options: {}) ⇒ Hash

Gather all responses for creating a skill

Parameters:

  • template_library (TemplateLibrary)

    Library for template selection

  • options (Hash) (defaults to: {})

    Options for the wizard

Options Hash (options:):

  • :id (String)

    Pre-filled skill ID

  • :name (String)

    Pre-filled skill name

  • :minimal (Boolean)

    Skip optional sections

  • :from_template (String)

    Template ID to inherit from

  • :clone (String)

    Skill ID to clone

Returns:

  • (Hash)

    Complete set of responses



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/aidp/skills/wizard/prompter.rb', line 32

def gather_responses(template_library, options: {})
  responses = {}

  # Step 1: Template selection
  if options[:from_template]
    responses[:base_skill] = template_library.find(options[:from_template])
    unless responses[:base_skill]
      raise Aidp::Errors::ValidationError, "Template not found: #{options[:from_template]}"
    end
  elsif options[:clone]
    responses[:base_skill] = template_library.find(options[:clone])
    unless responses[:base_skill]
      raise Aidp::Errors::ValidationError, "Skill not found: #{options[:clone]}"
    end
  elsif !options[:minimal]
    responses[:base_skill] = prompt_template_selection(template_library)
  end

  # Step 2: Identity & Metadata
  responses.merge!(prompt_identity(options))

  # Step 3: Expertise & Keywords
  responses.merge!(prompt_expertise) unless options[:minimal]

  # Step 4: When to use
  responses.merge!(prompt_when_to_use) unless options[:minimal]

  # Step 5: Compatible providers
  responses[:compatible_providers] = prompt_providers unless options[:minimal]

  # Step 6: Content
  responses[:content] = prompt_content(responses[:name], responses[:base_skill])

  responses
end