Class: Diogenes::Targets::Copilot
- Defined in:
- lib/diogenes/targets/copilot.rb,
sig/generated/diogenes/targets/copilot.rbs
Constant Summary collapse
- OUTPUT_PATH =
: String
".github/copilot-instructions.md"
Instance Method Summary collapse
-
#build(sources:) ⇒ Array[String]
: (sources: untyped) -> Array.
-
#header ⇒ String
: () -> String.
-
#render(sources) ⇒ String
: (untyped) -> String.
-
#rules_section(rules) ⇒ String
: (Array) -> String.
-
#skills_section(skills) ⇒ String
: (Array) -> String.
Methods inherited from Base
#generated_banner, #initialize, #skill_file_content, #write, #write_skill_files
Constructor Details
This class inherits a constructor from Diogenes::Targets::Base
Instance Method Details
#build(sources:) ⇒ Array[String]
: (sources: untyped) -> Array
10 11 12 13 |
# File 'lib/diogenes/targets/copilot.rb', line 10 def build(sources:) skill_files = write_skill_files(sources.skills, skills_dir: ".agents/skills") [write(OUTPUT_PATH, render(sources))] + skill_files end |
#header ⇒ String
: () -> String
26 27 28 |
# File 'lib/diogenes/targets/copilot.rb', line 26 def header "<!-- #{generated_banner("copilot")} -->" end |
#render(sources) ⇒ String
: (untyped) -> String
18 19 20 21 22 23 |
# File 'lib/diogenes/targets/copilot.rb', line 18 def render(sources) parts = [header] parts << rules_section(sources.rules) unless sources.rules.empty? parts << skills_section(sources.skills) unless sources.skills.empty? parts.join("\n\n") end |
#rules_section(rules) ⇒ String
: (Array) -> String
31 32 33 34 35 36 37 38 |
# File 'lib/diogenes/targets/copilot.rb', line 31 def rules_section(rules) lines = ["## Always apply these rules", ""] rules.each do |rule| lines << rule.content lines << "" end lines.join("\n").strip end |
#skills_section(skills) ⇒ String
: (Array) -> String
41 42 43 44 45 46 47 |
# File 'lib/diogenes/targets/copilot.rb', line 41 def skills_section(skills) lines = ["## Available slash commands", ""] skills.each do |skill| lines << "- **#{skill.command}**: #{skill.description}" end lines.join("\n").strip end |