Class: Ace::Overseer::CLI::Commands::WorkOn

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

Instance Method Summary collapse

Constructor Details

#initialize(orchestrator: nil) ⇒ WorkOn

Returns a new instance of WorkOn.



18
19
20
21
# File 'lib/ace/overseer/cli/commands/work_on.rb', line 18

def initialize(orchestrator: nil)
  super()
  @orchestrator = orchestrator || Organisms::WorkOnOrchestrator.new
end

Instance Method Details

#call(task: nil, preset: nil, **options) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/ace/overseer/cli/commands/work_on.rb', line 23

def call(task: nil, preset: nil, **options)
  Atoms::RepoGuard.ensure_repo!

  task_refs = normalize_task_refs(task)
  if task_refs.empty?
    raise Ace::Support::Cli::Error.new("--task is required. Usage: ace-overseer work-on --task <ref>")
  end

  progress = options[:quiet] ? nil : ->(msg) { puts msg }
  @orchestrator.call(
    task_ref: task_refs.first,
    task_refs: task_refs,
    cli_preset: preset,
    on_progress: progress
  )

  return if options[:quiet]

  puts "Done. Switch to tmux window and run /ace-assign-drive"
rescue Ace::Support::Cli::Error
  raise
rescue => e
  raise Ace::Support::Cli::Error.new(e.message)
end