Class: RubynCode::CLI::Commands::Agents
- Inherits:
-
Base
- Object
- Base
- RubynCode::CLI::Commands::Agents
show all
- Defined in:
- lib/rubyn_code/cli/commands/agents.rb
Overview
‘/agents` — list the sub-agent types available to spawn_agent: the built-in explore/worker plus any custom agents defined in .rubyn-code/agents/*.md or ~/.rubyn-code/agents/*.md.
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
aliases, all_names, hidden?
Class Method Details
.command_name ⇒ Object
10
|
# File 'lib/rubyn_code/cli/commands/agents.rb', line 10
def self.command_name = '/agents'
|
.description ⇒ Object
11
|
# File 'lib/rubyn_code/cli/commands/agents.rb', line 11
def self.description = 'List available sub-agent types (built-in + custom)'
|
Instance Method Details
#execute(_args, ctx) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/rubyn_code/cli/commands/agents.rb', line 13
def execute(_args, ctx)
catalog = RubynCode::SubAgents::Catalog.new(project_root: ctx.project_root)
ctx.renderer.info('Available sub-agent types:')
catalog.all.each do |agent|
tag = agent.custom? ? '(custom)' : '(built-in)'
access = agent.read_only? ? 'read-only' : 'read/write'
puts " #{agent.name.ljust(18)} #{tag} [#{access}] — #{agent.description}"
end
puts
ctx.renderer.info('Define your own in .rubyn-code/agents/<name>.md') if catalog.custom_names.empty?
nil
rescue StandardError => e
ctx.renderer.error("Could not list agents: #{e.message}")
nil
end
|