Class: Silas::Skill
- Inherits:
-
Data
- Object
- Data
- Silas::Skill
- Defined in:
- lib/silas/skill.rb
Overview
A flat markdown playbook with a description: frontmatter key — the description is advertised to the model; the body loads on demand via the load_skill tool (eve's progressive-disclosure mechanism).
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description
5 6 7 |
# File 'lib/silas/skill.rb', line 5 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name
5 6 7 |
# File 'lib/silas/skill.rb', line 5 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path
5 6 7 |
# File 'lib/silas/skill.rb', line 5 def path @path end |
Class Method Details
.parse(path) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/silas/skill.rb', line 6 def self.parse(path) content = File.read(path) description = if content =~ /\A---\s*\n(.*?)\n---\s*\n/m Regexp.last_match(1)[/^description:\s*(.+)$/, 1].to_s.strip else "" end new(name: File.basename(path, ".md"), description: description, path: path.to_s) end |
Instance Method Details
#body ⇒ Object
17 18 19 |
# File 'lib/silas/skill.rb', line 17 def body File.read(path).sub(/\A---\s*\n.*?\n---\s*\n/m, "") end |