Class: Ace::Overseer::CLI::Commands::WorkOn
- Inherits:
-
Support::Cli::Command
- Object
- Support::Cli::Command
- Ace::Overseer::CLI::Commands::WorkOn
- Includes:
- Support::Cli::Base
- Defined in:
- lib/ace/overseer/cli/commands/work_on.rb
Instance Method Summary collapse
- #call(task: nil, preset: nil, runtime: "tmux", work: nil, agent: nil, **options) ⇒ Object
-
#initialize(orchestrator: nil, lab_client: nil) ⇒ WorkOn
constructor
A new instance of WorkOn.
Constructor Details
#initialize(orchestrator: nil, lab_client: nil) ⇒ WorkOn
Returns a new instance of WorkOn.
21 22 23 24 25 |
# File 'lib/ace/overseer/cli/commands/work_on.rb', line 21 def initialize(orchestrator: nil, lab_client: nil) super() @orchestrator = orchestrator || Organisms::WorkOnOrchestrator.new @lab_client = lab_client || Molecules::LabClient.new end |
Instance Method Details
#call(task: nil, preset: nil, runtime: "tmux", work: nil, agent: nil, **options) ⇒ Object
27 28 29 30 31 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 |
# File 'lib/ace/overseer/cli/commands/work_on.rb', line 27 def call(task: nil, preset: nil, runtime: "tmux", work: nil, agent: nil, **) if runtime == "lab" if task || preset raise Ace::Support::Cli::Error, "--task and --preset are not supported with Lab runtime" end raise Ace::Support::Cli::Error, "--work and --agent are required for Lab runtime" if work.to_s.empty? || agent.to_s.empty? output = @lab_client.call("work", "dispatch", work, "--agent", agent, json: false) puts output unless [:quiet] return end raise Ace::Support::Cli::Error, "unsupported runtime: #{runtime}" unless runtime == "tmux" 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 = [:quiet] ? nil : ->(msg) { puts msg } @orchestrator.call( task_ref: task_refs.first, task_refs: task_refs, cli_preset: preset, on_progress: progress ) return if [: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.) end |