Class: Pu::Skills::SyncGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Pu::Skills::SyncGenerator
- Includes:
- PlutoniumGenerators::Generator
- Defined in:
- lib/generators/pu/skills/sync/sync_generator.rb
Instance Method Summary collapse
Methods included from PlutoniumGenerators::Generator
derive_association_name, find_shared_namespace, included
Methods included from PlutoniumGenerators::Concerns::Logger
#debug, #error, #exception, #info, #success, #warn
Methods included from PlutoniumGenerators::Concerns::Config
Instance Method Details
#start ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/generators/pu/skills/sync/sync_generator.rb', line 12 def start source_dir = Plutonium.root.join(".claude", "skills") destination_dir = Rails.root.join(".claude", "skills") unless File.directory?(source_dir) say_status("error", "Source skills directory not found: #{source_dir}", :red) return end # Create destination directory if it doesn't exist FileUtils.mkdir_p(destination_dir) # Get all skill directories skill_dirs = Dir.children(source_dir).select { |f| File.directory?(source_dir.join(f)) } if skill_dirs.empty? say_status("info", "No skills found to sync", :yellow) return end say_status("info", "Syncing #{skill_dirs.size} skills from Plutonium...", :blue) # Remove skills that no longer exist in source remove_stale_skills(source_dir, destination_dir, skill_dirs) skill_dirs.each do |skill_name| sync_skill(source_dir, destination_dir, skill_name) end say_status("success", "Skills synced successfully!", :green) rescue => e exception "#{self.class} failed:", e end |