Class: Senren::Rails::SkillWriter
- Inherits:
-
Object
- Object
- Senren::Rails::SkillWriter
- Defined in:
- lib/senren/rails/skill_writer.rb
Overview
Writes the centralized .senren/skill.md file for AI agents.
The file contains a generated region delimited by HTML comments:
<!-- senren:skill:start -->
...generated by SkillWriter...
<!-- senren:skill:end -->
Anything outside that region is preserved across regeneration.
Constant Summary collapse
- START_MARKER =
'<!-- senren:skill:start -->'- END_MARKER =
'<!-- senren:skill:end -->'- GROUP_ORDER =
%w[actions forms overlays navigation layout data saas rich].freeze
Instance Attribute Summary collapse
-
#paths ⇒ Object
readonly
Returns the value of attribute paths.
-
#registry ⇒ Object
readonly
Returns the value of attribute registry.
Instance Method Summary collapse
-
#initialize(registry: Registry.load!, paths: HostPaths.new) ⇒ SkillWriter
constructor
A new instance of SkillWriter.
- #sync! ⇒ Object
Constructor Details
#initialize(registry: Registry.load!, paths: HostPaths.new) ⇒ SkillWriter
Returns a new instance of SkillWriter.
24 25 26 27 |
# File 'lib/senren/rails/skill_writer.rb', line 24 def initialize(registry: Registry.load!, paths: HostPaths.new) @registry = registry @paths = paths end |
Instance Attribute Details
#paths ⇒ Object (readonly)
Returns the value of attribute paths.
22 23 24 |
# File 'lib/senren/rails/skill_writer.rb', line 22 def paths @paths end |
#registry ⇒ Object (readonly)
Returns the value of attribute registry.
22 23 24 |
# File 'lib/senren/rails/skill_writer.rb', line 22 def registry @registry end |
Instance Method Details
#sync! ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/senren/rails/skill_writer.rb', line 29 def sync! installed = installed_names body = render(installed) paths.senren_dir.mkpath existing = paths.skill_file.exist? ? paths.skill_file.read : default_outer_template new_content = inject(existing, body) paths.skill_file.write(new_content) paths.skill_file end |