Class: Aidp::Setup::Wizard

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

Overview

Interactive setup wizard for configuring AIDP. Guides the user through provider, work loop, NFR, logging, and mode settings while remaining idempotent and safe to re-run.

Constant Summary collapse

SCHEMA_VERSION =
1
DEVCONTAINER_COMPONENT =
"setup_wizard.devcontainer"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project_dir = Dir.pwd, prompt: nil, dry_run: false) ⇒ Wizard

Returns a new instance of Wizard.



29
30
31
32
33
34
35
36
37
# File 'lib/aidp/setup/wizard.rb', line 29

def initialize(project_dir = Dir.pwd, prompt: nil, dry_run: false)
  @project_dir = project_dir
  @prompt = prompt || TTY::Prompt.new
  @dry_run = dry_run
  @warnings = []
  @existing_config = load_existing_config
  @config = deep_symbolize(@existing_config)
  @saved = false
end

Instance Attribute Details

#dry_runObject (readonly)

Returns the value of attribute dry_run.



27
28
29
# File 'lib/aidp/setup/wizard.rb', line 27

def dry_run
  @dry_run
end

#project_dirObject (readonly)

Returns the value of attribute project_dir.



27
28
29
# File 'lib/aidp/setup/wizard.rb', line 27

def project_dir
  @project_dir
end

#promptObject (readonly)

Returns the value of attribute prompt.



27
28
29
# File 'lib/aidp/setup/wizard.rb', line 27

def prompt
  @prompt
end

Instance Method Details

#runObject



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
67
68
69
70
71
72
# File 'lib/aidp/setup/wizard.rb', line 39

def run
  display_welcome
  # Normalize any legacy or label-based model_family entries before prompting
  normalize_existing_model_families!
  return @saved if skip_wizard?

  configure_providers
  configure_work_loop
  configure_branching
  configure_artifacts
  configure_nfrs
  configure_logging
  configure_modes
  configure_devcontainer

  yaml_content = generate_yaml
  display_preview(yaml_content)
  display_diff(yaml_content) if @existing_config.any?

  return true if dry_run_mode?(yaml_content)

  if prompt.yes?("Save this configuration?", default: true)
    save_config(yaml_content)
    prompt.ok("✅ Configuration saved to #{relative_config_path}")
    show_next_steps
    display_warnings
    @saved = true
  else
    prompt.warn("Configuration not saved")
    display_warnings
  end

  @saved
end

#saved?Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/aidp/setup/wizard.rb', line 74

def saved?
  @saved
end