Class: Agentd::CLI

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

Overview


Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


367
# File 'lib/agentd/cli.rb', line 367

def self.exit_on_failure? = true

Instance Method Details

#exec(task) ⇒ Object



391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
# File 'lib/agentd/cli.rb', line 391

def exec(task)
  key = options[:api_key] || Agentd.api_key
  if key.nil?
    say "Error: API key required. Run `agentd login` first.", :red
    exit 1
  end
  runner = Runner.new(
    api_key:  key,
    endpoint: options[:endpoint] || Agentd.endpoint,
    model:    options[:model],
    ollama:   options[:ollama],
    verbose:  options[:verbose]
  )
  runner.run(task)
end

#loginObject



377
378
379
380
381
382
383
384
385
# File 'lib/agentd/cli.rb', line 377

def 
  say "agentd.link — login", :bold
  say "Enter your API key (from https://agentd.link/login):"
  key = ask("> ", echo: false)
  puts
  Config.save(api_key: key.strip)
  say "Saved to ~/.agentd/config.json", :green
  say "Run `agentd agent whoami` to verify."
end