Module: Binpacker::Skills
- Defined in:
- lib/binpacker/skills.rb,
sig/binpacker/skills.rbs
Overview
Registry for the gem-shipped, user-facing agent skills. Skills live in the
gem's top-level skills/ directory, each as skills/
Constant Summary collapse
- ROOT =
File.("../../skills", __dir__)
Class Method Summary collapse
-
.body(name) ⇒ String
The SKILL.md body for a skill.
- .exist?(name) ⇒ Boolean
-
.list ⇒ Array[Hash[Symbol, String]]
[{ name:, path: }], sorted by name.
-
.path(name) ⇒ String?
Absolute path of a skill's SKILL.md, or nil when unknown.
Class Method Details
.body(name) ⇒ String
The SKILL.md body for a skill.
30 31 32 33 34 |
# File 'lib/binpacker/skills.rb', line 30 def body(name) file = path(name) raise Error, "unknown skill: #{name}" unless file File.read(file) end |
.exist?(name) ⇒ Boolean
19 20 21 |
# File 'lib/binpacker/skills.rb', line 19 def exist?(name) !path(name).nil? end |
.list ⇒ Array[Hash[Symbol, String]]
[{ name:, path: }], sorted by name.
13 14 15 16 17 |
# File 'lib/binpacker/skills.rb', line 13 def list Dir.glob(File.join(ROOT, "*", "SKILL.md")).sort.map do |file| { name: File.basename(File.dirname(file)), path: file } end end |
.path(name) ⇒ String?
Absolute path of a skill's SKILL.md, or nil when unknown.
24 25 26 27 |
# File 'lib/binpacker/skills.rb', line 24 def path(name) file = File.join(ROOT, name, "SKILL.md") File.file?(file) ? file : nil end |