Class: HunkReviewChanges::Installer::SkillSource
- Inherits:
-
Object
- Object
- HunkReviewChanges::Installer::SkillSource
- Defined in:
- lib/hunk_review_changes/installer/skill_source.rb
Overview
Provides a local checkout of the marketplace repo so adapters can read the skill from it. The marketplace repo is the single source of truth for the skill across agents; the gem never ships its own copy. A local path is used as-is (handy for testing); a remote URL is shallow-cloned to a temp dir on first use.
Defined Under Namespace
Classes: Error
Instance Attribute Summary collapse
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Instance Method Summary collapse
-
#checkout ⇒ Object
Path to a local checkout of the marketplace repo.
-
#initialize(repo) ⇒ SkillSource
constructor
A new instance of SkillSource.
- #local? ⇒ Boolean
-
#skill_dir ⇒ Object
Directory holding the skill (SKILL.md and any support files) in the checkout.
Constructor Details
#initialize(repo) ⇒ SkillSource
Returns a new instance of SkillSource.
18 19 20 |
# File 'lib/hunk_review_changes/installer/skill_source.rb', line 18 def initialize(repo) @repo = repo end |
Instance Attribute Details
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
16 17 18 |
# File 'lib/hunk_review_changes/installer/skill_source.rb', line 16 def repo @repo end |
Instance Method Details
#checkout ⇒ Object
Path to a local checkout of the marketplace repo.
27 28 29 |
# File 'lib/hunk_review_changes/installer/skill_source.rb', line 27 def checkout @checkout ||= local? ? File.(@repo) : clone end |
#local? ⇒ Boolean
22 23 24 |
# File 'lib/hunk_review_changes/installer/skill_source.rb', line 22 def local? File.directory?(@repo) end |
#skill_dir ⇒ Object
Directory holding the skill (SKILL.md and any support files) in the checkout.
32 33 34 35 36 37 38 39 |
# File 'lib/hunk_review_changes/installer/skill_source.rb', line 32 def skill_dir dir = File.join(checkout, "plugins", PLUGIN_NAME, "skills", SKILL_NAME) unless File.exist?(File.join(dir, "SKILL.md")) raise Error, "no SKILL.md at #{dir} — is #{@repo} the marketplace repo?" end dir end |