Class: RailsTracepointStack::SkillInstaller
- Inherits:
-
Object
- Object
- RailsTracepointStack::SkillInstaller
- Defined in:
- lib/rails_tracepoint_stack/skill_installer.rb
Overview
Copies the packaged agent skill into the host app.
A skill living in this gem's repository only helps someone working on the gem. Agents look for skills inside the project they are working on, so the file has to land there for the gem to ever get picked up on its own.
Constant Summary collapse
- SKILL_PATH =
".claude/skills/debug-with-tracepoint/SKILL.md".freeze
- TEMPLATE_PATH =
File.("templates/skill.md", __dir__).freeze
Instance Attribute Summary collapse
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#force ⇒ Object
readonly
Returns the value of attribute force.
Instance Method Summary collapse
-
#initialize(destination: Dir.pwd, force: false) ⇒ SkillInstaller
constructor
A new instance of SkillInstaller.
-
#install ⇒ Object
Returns the path written, or nil when a skill was already there.
- #target_path ⇒ Object
Constructor Details
#initialize(destination: Dir.pwd, force: false) ⇒ SkillInstaller
Returns a new instance of SkillInstaller.
15 16 17 18 |
# File 'lib/rails_tracepoint_stack/skill_installer.rb', line 15 def initialize(destination: Dir.pwd, force: false) @destination = destination @force = force end |
Instance Attribute Details
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
13 14 15 |
# File 'lib/rails_tracepoint_stack/skill_installer.rb', line 13 def destination @destination end |
#force ⇒ Object (readonly)
Returns the value of attribute force.
13 14 15 |
# File 'lib/rails_tracepoint_stack/skill_installer.rb', line 13 def force @force end |
Instance Method Details
#install ⇒ Object
Returns the path written, or nil when a skill was already there.
21 22 23 24 25 26 27 |
# File 'lib/rails_tracepoint_stack/skill_installer.rb', line 21 def install return nil if File.exist?(target_path) && !force FileUtils.mkdir_p(File.dirname(target_path)) File.write(target_path, template) target_path end |
#target_path ⇒ Object
29 30 31 |
# File 'lib/rails_tracepoint_stack/skill_installer.rb', line 29 def target_path File.join(destination, SKILL_PATH) end |