Class: HunkReviewChanges::Installer::Runner

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

Overview

Drives the install command: detect which agents are present, let the user pick (or take an explicit list), install the skill into each, and print a summary.

Constant Summary collapse

ADAPTERS =
[ClaudeCode, Codex, Cursor, OpenCode].freeze
ALIASES =

Accepts agent keys plus a few friendly aliases from --agent.

{
  "claude-code" => :claude, "claudecode" => :claude,
  "cursor-agent" => :cursor, "open-code" => :opencode
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(repo: MARKETPLACE_REPO, only: nil, input: $stdin, output: $stdout) ⇒ Runner

Returns a new instance of Runner.



22
23
24
25
26
27
28
# File 'lib/hunk_review_changes/installer/runner.rb', line 22

def initialize(repo: MARKETPLACE_REPO, only: nil, input: $stdin, output: $stdout)
  @source = SkillSource.new(repo)
  @only = only
  @input = input
  @output = output
  @adapters = ADAPTERS.map(&:new)
end

Instance Method Details

#runObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/hunk_review_changes/installer/runner.rb', line 30

def run
  if @only
    ensure_known!(@only)
    selected = by_keys(@only)
  else
    selected = prompt
  end
  if selected.empty?
    @output.puts "Nothing selected — no changes made."
    return []
  end

  @output.puts "\nInstalling from #{@source.repo}"
  results = selected.map do |adapter|
    @output.puts "#{adapter.label}"
    adapter.install!(@source)
  end
  report(results)
  results
end