Class: Fizzy::CLI::Skill

Inherits:
Thor
  • Object
show all
Defined in:
lib/fizzy/cli/skill.rb

Constant Summary collapse

SKILL_URL =
"https://raw.githubusercontent.com/dpaluy/fizzy-cli/master/skills/fizzy-cli/SKILL.md"
TARGET_PATHS =
{
  "claude" => {
    "user" => File.join(Dir.home, ".claude", "skills", "fizzy-cli"),
    "project" => File.join(".claude", "skills", "fizzy-cli")
  },
  "codex" => {
    "user" => File.join(Dir.home, ".agents", "skills", "fizzy-cli"),
    "project" => File.join(".agents", "skills", "fizzy-cli")
  }
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


62
# File 'lib/fizzy/cli/skill.rb', line 62

def self.exit_on_failure? = true

Instance Method Details

#installObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/fizzy/cli/skill.rb', line 27

def install
  content = fetch_skill

  targets_for(options[:target]).each do |target|
    dir = TARGET_PATHS.dig(target, options[:scope])
    path = File.join(dir, "SKILL.md")

    if File.exist?(path) && File.read(path) == content
      say "Already up to date: #{path}"
    else
      verb = File.exist?(path) ? "Updated" : "Installed"
      FileUtils.mkdir_p(dir)
      File.write(path, content)
      say "#{verb}: #{path}"
    end
  end
end

#uninstallObject



48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/fizzy/cli/skill.rb', line 48

def uninstall
  targets_for(options[:target]).each do |target|
    dir = TARGET_PATHS.dig(target, options[:scope])

    unless File.directory?(dir)
      say "Not installed: #{dir}"
      next
    end

    FileUtils.rm_rf(dir)
    say "Removed: #{dir}"
  end
end