Module: Strata::CLI::AgentMode

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



8
9
10
11
# File 'lib/strata/cli/agent_mode.rb', line 8

def self.included(base)
  base.class_option :agent, type: :boolean, default: false,
    desc: "Agent mode: structured output, no interactive prompts"
end

Instance Method Details

#agent_mode?Boolean

Returns:

  • (Boolean)


13
14
15
16
17
# File 'lib/strata/cli/agent_mode.rb', line 13

def agent_mode?
  value = options[:agent]
  value = options["agent"] if value.nil?
  value == true
end

#reject_agent_mode!(message, code: "agent_mode_unsupported") ⇒ Object



19
20
21
22
23
# File 'lib/strata/cli/agent_mode.rb', line 19

def reject_agent_mode!(message, code: "agent_mode_unsupported")
  return unless agent_mode?

  AgentOutput.emit_error(message, code: code)
end