Class: Agentilda::CLI::Unblock

Inherits:
Base
  • Object
show all
Defined in:
lib/agentilda/cli/unblock/unblock.rb

Overview

agentilda unblock NNN… — hand a stopped plan to the agent that drains its blocked.md.

Deliberately not part of run. ⭕️ and 🅱️ are StateMachine::SETTLED, so the loop never offers a blocked plan to anybody, and that is the property that makes the state mean anything: the plan waits for a human, and no agent quietly decides otherwise. Answers arriving is not a fact the tool can observe, so a human typing this command is the signal, and there is nothing else that could produce it.

Constant Summary collapse

DEFAULT_AGENT =

The agent that knows the shape of blocked.md.

"lando-broker"
PROBLEMS =

What each token turned out to be, for whoever has to fix it.

{
  missing: "no plan of that number",
  not_blocked: "no blocked.md, so there is nothing to drain"
}.freeze

Constants included from UI

UI::MAX_WIDTH, UI::METER_WIDTH, UI::MIN_WIDTH, UI::NO_FAILURE, UI::NO_FIELDS, UI::NO_TIMEOUT, UI::PROGRESS_THRESHOLD, UI::TIMER_WARNING, UI::TIMER_WIDTH

Instance Method Summary collapse

Methods inherited from Base

inherited

Methods included from UI

abbreviate, activity_for, animate?, box, box_height, color?, concurrently, countdown, default_jobs, display_width, elapsed, #error, fit, #info, line, log, logging_activity, meter, monotonic, once, paint, #paint, pastel, popup, report_line, reset!, said, #say, solo_spinner, spinning, stepping, #success, threaded, tty?, #warn, width

Instance Method Details

#call(plans:, **options) ⇒ void

This method returns an undefined value.

Parameters:

  • plans (Array<String>)
  • options (Hash)


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/agentilda/cli/unblock/unblock.rb', line 43

def call(plans:, **options)
  tree = tree_for(options)
  quiet?(options)
  unblocker = Unblocker.new(tree:, agent: agent_for(options), root: options[:root],
    commit: commit?(options), executor: Executor.new(root: options[:root] || File.dirname(tree.dir),
      dry_run: !commit?(options)))

  targets = unblocker.resolve(plans)
  refused(targets, tree, options)
  subjects = targets.select(&:drainable?).map(&:subject)
  exit(worst(targets, [])) if subjects.empty?

  credentials_warning if commit?(options) && !quiet?(options)
  preflight(subjects, unblocker, options)

  outcomes = unblocker.call(subjects)
  outcomes.each { |outcome| report(outcome, options) }
  footer(outcomes, options) unless quiet?(options)
  exit(worst(targets, outcomes))
end