Class: Ace::PromptPrep::CLI::Commands::Setup

Inherits:
Support::Cli::Command
  • Object
show all
Includes:
Support::Cli::Base
Defined in:
lib/ace/prompt_prep/cli/commands/setup.rb

Overview

ace-support-cli Command class for the setup command

This wraps the existing PromptInitializer logic in a ace-support-cli compatible interface, maintaining complete parity with the Thor implementation.

Instance Method Summary collapse

Instance Method Details

#call(**options) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/ace/prompt_prep/cli/commands/setup.rb', line 49

def call(**options)
  template_uri = options[:template] || Organisms::PromptInitializer::DEFAULT_TEMPLATE_URI
  force = options[:force] || options[:no_archive] || false

  # Resolve task prompt path (handles both explicit --task and auto-detection)
  task_prompt_path = resolve_task_prompt_path(options[:task])
  # Extract target directory from resolved path
  target_dir = task_prompt_path ? File.dirname(task_prompt_path) : nil

  result = Organisms::PromptInitializer.setup(
    template_uri: template_uri,
    force: force,
    target_dir: target_dir
  )

  unless result[:success]
    raise Ace::Support::Cli::Error.new("Setup failed: #{result[:error]}")
  end

  $stdout.puts "Prompt initialized:"
  $stdout.puts "  Path: #{result[:path]}"
  if result[:archive_path]
    $stdout.puts "  Archive: #{result[:archive_path]}"
  end
rescue => e
  raise Ace::Support::Cli::Error.new("Setup failed: #{e.message}")
end