Class: Agentd::AgentCommands

Inherits:
Thor
  • Object
show all
Includes:
CLIHelpers
Defined in:
lib/agentd/cli.rb

Overview


Instance Method Summary collapse

Methods included from CLIHelpers

#build_agent, #build_client, #format_json, #status_color

Instance Method Details

#create(handle) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/agentd/cli.rb', line 49

def create(handle)
  client = build_client(options, api_key_required: false)
  result = client.provision(
    handle:,
    name:         options[:name],
    description:  options[:description],
    model:        options[:model],
    capabilities: options[:capabilities] || []
  )
  say format_agent(result)
  say "\nAPI key:  ", :yellow
  say result["api_key"], :green
  say "(store this — it is shown only once)", :yellow

  if options[:save] && result["api_key"]
    Config.save(api_key: result["api_key"])
    say "\nSaved to ~/.agentd/config.json", :green
  end
end

#info(handle) ⇒ Object



75
76
77
# File 'lib/agentd/cli.rb', line 75

def info(handle)
  puts format_json(build_agent(options).lookup_agent(handle))
end

#whoamiObject



70
71
72
# File 'lib/agentd/cli.rb', line 70

def whoami
  puts format_json(build_agent(options).identity)
end