Class: Aidp::CLI::FirstRunWizard

Inherits:
Object
  • Object
show all
Includes:
MessageDisplay
Defined in:
lib/aidp/cli/first_run_wizard.rb

Overview

Wrapper around Aidp::Setup::Wizard to preserve existing CLI entry points.

Constant Summary

Constants included from MessageDisplay

MessageDisplay::COLOR_MAP

Class Method Summary collapse

Instance Method Summary collapse

Methods included from MessageDisplay

#display_message, included, #message_display_prompt

Constructor Details

#initialize(project_dir, prompt: TTY::Prompt.new, wizard_class: Aidp::Setup::Wizard) ⇒ FirstRunWizard

Returns a new instance of FirstRunWizard.



36
37
38
39
40
# File 'lib/aidp/cli/first_run_wizard.rb', line 36

def initialize(project_dir, prompt: TTY::Prompt.new, wizard_class: Aidp::Setup::Wizard)
  @project_dir = project_dir
  @prompt = prompt
  @wizard_class = wizard_class
end

Class Method Details

.ensure_config(project_dir, non_interactive: false, prompt: TTY::Prompt.new, wizard_class: Aidp::Setup::Wizard) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/aidp/cli/first_run_wizard.rb', line 13

def self.ensure_config(project_dir, non_interactive: false, prompt: TTY::Prompt.new, wizard_class: Aidp::Setup::Wizard)
  return true if Aidp::Config.config_exists?(project_dir)

  wizard = new(project_dir, prompt: prompt, wizard_class: wizard_class)

  if non_interactive
    wizard.create_minimal_config
    wizard.send(:display_message, "Created minimal configuration (non-interactive default)", type: :success)
    true
  else
    wizard.run
  end
end

.setup_config(project_dir, non_interactive: false, prompt: TTY::Prompt.new, wizard_class: Aidp::Setup::Wizard) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/aidp/cli/first_run_wizard.rb', line 27

def self.setup_config(project_dir, non_interactive: false, prompt: TTY::Prompt.new, wizard_class: Aidp::Setup::Wizard)
  if non_interactive
    new(project_dir, prompt: prompt, wizard_class: wizard_class).send(:display_message, "Configuration setup skipped in non-interactive environment", type: :info)
    return true
  end

  new(project_dir, prompt: prompt, wizard_class: wizard_class).run
end

Instance Method Details

#create_minimal_configObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/aidp/cli/first_run_wizard.rb', line 47

def create_minimal_config
  Aidp::ConfigPaths.ensure_config_dir(@project_dir)
  minimal = {
    "schema_version" => Aidp::Setup::Wizard::SCHEMA_VERSION,
    "generated_by" => "aidp setup wizard minimal",
    "generated_at" => Time.now.utc.iso8601,
    "providers" => {
      "llm" => {
        "name" => "cursor",
        "model" => "cursor-agent",
        "temperature" => 0.2,
        "max_tokens" => 1024
      }
    },
    "work_loop" => {
      "test" => {
        "unit" => "bundle exec rspec",
        "timeout_seconds" => 1800
      }
    }
  }

  File.write(Aidp::ConfigPaths.config_file(@project_dir), minimal.to_yaml)
end

#runObject



42
43
44
45
# File 'lib/aidp/cli/first_run_wizard.rb', line 42

def run
  wizard = @wizard_class.new(@project_dir, prompt: @prompt)
  wizard.run
end