Class: Gem::Commands::SkillCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::SkillCommand
- Defined in:
- lib/gem/skill/cli/gem_command.rb
Overview
Registered as ‘gem skill` via lib/rubygems_plugin.rb. Manages the global ~/.gem/skills cache.
Instance Method Summary collapse
- #arguments ⇒ Object
- #description ⇒ Object
- #execute ⇒ Object
-
#initialize ⇒ SkillCommand
constructor
A new instance of SkillCommand.
- #usage ⇒ Object
Constructor Details
#initialize ⇒ SkillCommand
Returns a new instance of SkillCommand.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gem/skill/cli/gem_command.rb', line 13 def initialize super "skill", "Manage Claude Code AI skills for Ruby gems" add_option("-f", "--force", "Regenerate even if already cached") { |_, o| o[:force] = true } add_option("-a", "--all", "Purge all cached versions of a gem") { |_, o| o[:all] = true } add_option("-m", "--model MODEL", "LLM model to use (default: #{Gem::Skill::Generator::DEFAULT_MODEL})") do |model, o| o[:model] = model end add_option("-v", "--version", "Print gem-skill version and exit") { |_, o| o[:version] = true } end |
Instance Method Details
#arguments ⇒ Object
24 25 26 |
# File 'lib/gem/skill/cli/gem_command.rb', line 24 def arguments "SUBCOMMAND one of: install, list, purge, setup" end |
#description ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/gem/skill/cli/gem_command.rb', line 36 def description <<~DESC install Generate and cache a SKILL.md for a gem. list Show all skills in the global cache (~/.gem/skills). purge Remove a specific cached version. setup Register gem-skill as a Bundler plugin (run once after install). Use 'bundle skill install' in any project after running 'gem skill setup'. DESC end |
#execute ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/gem/skill/cli/gem_command.rb', line 47 def execute if [:version] say Gem::Skill::VERSION return end Gem::Skill.configure_llm! subcmd = [:args].shift case subcmd when "install" then cmd_install when "list" then cmd_list when "purge" then cmd_purge when "setup" then cmd_setup when nil say usage else alert_error "Unknown subcommand: #{subcmd.inspect}" say usage end end |
#usage ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/gem/skill/cli/gem_command.rb', line 28 def usage "#{program_name} install GEM_NAME [GEM_NAME ...]\n" \ " #{program_name} list\n" \ " #{program_name} purge GEM_NAME VERSION\n" \ " #{program_name} purge GEM_NAME --all\n" \ " #{program_name} setup" end |