Class: TheLocal::Installer

Inherits:
Object
  • Object
show all
Defined in:
lib/the_local/installer.rb

Overview

Copies each allowed provider’s committed agent file into a destination’s .claude/agents/ directory, verbatim. Plain Ruby so the Rails generator is a thin wrapper over it.

Constant Summary collapse

AGENTS_DIR =
".claude/agents"

Instance Method Summary collapse

Constructor Details

#initialize(registry:, destination:, allowed_gems:) ⇒ Installer

Returns a new instance of Installer.



12
13
14
15
16
# File 'lib/the_local/installer.rb', line 12

def initialize(registry:, destination:, allowed_gems:)
  @registry = registry
  @destination = destination
  @allowed_gems = allowed_gems
end

Instance Method Details

#callObject



18
19
20
21
22
23
24
25
26
# File 'lib/the_local/installer.rb', line 18

def call
  agents_dir = File.join(@destination, AGENTS_DIR)
  FileUtils.mkdir_p(agents_dir)

  installed_agents.each do |agent|
    ensure_committed!(agent)
    FileUtils.cp(agent.source_path, File.join(agents_dir, agent.filename))
  end
end