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.
12 13 14 15 16 17 18 19 20 |
# File 'lib/gem/skill/cli/gem_command.rb', line 12 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 end |
Instance Method Details
#arguments ⇒ Object
22 23 24 |
# File 'lib/gem/skill/cli/gem_command.rb', line 22 def arguments "SUBCOMMAND one of: install, list, purge" end |
#description ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/gem/skill/cli/gem_command.rb', line 33 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. Use 'bundle skill install' (after: bundle plugin install gem-skill) to generate and link skills for an entire project from Gemfile.lock. DESC end |
#execute ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/gem/skill/cli/gem_command.rb', line 44 def execute 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 nil say usage else alert_error "Unknown subcommand: #{subcmd.inspect}" say usage end end |
#usage ⇒ Object
26 27 28 29 30 31 |
# File 'lib/gem/skill/cli/gem_command.rb', line 26 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" end |