Class: Aircana::Generators::AgentsGenerator
- Inherits:
-
BaseGenerator
- Object
- BaseGenerator
- Aircana::Generators::AgentsGenerator
- Defined in:
- lib/aircana/generators/agents_generator.rb
Constant Summary collapse
- PRESET_COLORS =
%w[red blue green cyan yellow magenta purple pink teal orange].freeze
Instance Attribute Summary collapse
-
#agent_description ⇒ Object
readonly
Returns the value of attribute agent_description.
-
#agent_name ⇒ Object
readonly
Returns the value of attribute agent_name.
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#kb_name ⇒ Object
readonly
Returns the value of attribute kb_name.
-
#skill_name ⇒ Object
readonly
Returns the value of attribute skill_name.
Attributes inherited from BaseGenerator
Class Method Summary collapse
-
.from_manifest(kb_name) ⇒ Object
Generate agent markdown from manifest data.
- .generate_agent_description_from_manifest(manifest, kb_name) ⇒ Object
Instance Method Summary collapse
-
#initialize(kb_name:, agent_description: nil, color: nil, file_in: nil, file_out: nil) ⇒ AgentsGenerator
constructor
A new instance of AgentsGenerator.
Methods inherited from BaseGenerator
Constructor Details
#initialize(kb_name:, agent_description: nil, color: nil, file_in: nil, file_out: nil) ⇒ AgentsGenerator
Returns a new instance of AgentsGenerator.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/aircana/generators/agents_generator.rb', line 13 def initialize(kb_name:, agent_description: nil, color: nil, file_in: nil, file_out: nil) @kb_name = kb_name @agent_name = kb_name @agent_description = agent_description || generate_agent_description @skill_name = generate_skill_name @color = color || PRESET_COLORS.sample super( file_in: file_in || default_template_path, file_out: file_out || default_output_path ) end |
Instance Attribute Details
#agent_description ⇒ Object (readonly)
Returns the value of attribute agent_description.
11 12 13 |
# File 'lib/aircana/generators/agents_generator.rb', line 11 def agent_description @agent_description end |
#agent_name ⇒ Object (readonly)
Returns the value of attribute agent_name.
11 12 13 |
# File 'lib/aircana/generators/agents_generator.rb', line 11 def agent_name @agent_name end |
#color ⇒ Object (readonly)
Returns the value of attribute color.
11 12 13 |
# File 'lib/aircana/generators/agents_generator.rb', line 11 def color @color end |
#kb_name ⇒ Object (readonly)
Returns the value of attribute kb_name.
11 12 13 |
# File 'lib/aircana/generators/agents_generator.rb', line 11 def kb_name @kb_name end |
#skill_name ⇒ Object (readonly)
Returns the value of attribute skill_name.
11 12 13 |
# File 'lib/aircana/generators/agents_generator.rb', line 11 def skill_name @skill_name end |
Class Method Details
.from_manifest(kb_name) ⇒ Object
Generate agent markdown from manifest data
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/aircana/generators/agents_generator.rb', line 27 def self.from_manifest(kb_name) manifest = Contexts::Manifest.read_manifest(kb_name) raise Error, "No manifest found for knowledge base '#{kb_name}'" unless manifest # Use the same description generation as skills agent_description = generate_agent_description_from_manifest(manifest, kb_name) new( kb_name: kb_name, agent_description: agent_description ) end |
.generate_agent_description_from_manifest(manifest, kb_name) ⇒ Object
40 41 42 43 44 |
# File 'lib/aircana/generators/agents_generator.rb', line 40 def self.generate_agent_description_from_manifest(manifest, kb_name) # Same description as skill - optimized for Claude's agent discovery source_count = manifest["sources"]&.size || 0 "Discover critical context for #{kb_name.split("-").join(" ")} from #{source_count} knowledge sources" end |