Module: Gem::Skill
- Defined in:
- lib/gem/skill/cli/bundle_command.rb,
lib/gem/skill/generator.rb,
lib/gem/skill/lockfile.rb,
lib/gem/skill/version.rb,
lib/gem/skill/fetcher.rb,
lib/gem/skill/runner.rb,
lib/gem/skill/linker.rb,
lib/rubygems_plugin.rb,
lib/rubygems_plugin.rb,
lib/gem/skill/cache.rb,
lib/gem/skill.rb
Defined Under Namespace
Modules: BundlerCommand, Cache, InstallSkillOption, Linker, Lockfile, Runner Classes: Error, Fetcher, Generator
Constant Summary collapse
- VERSION =
"0.1.3"- ENV_KEY_MAP =
{ anthropic_api_key: "ANTHROPIC_API_KEY", openai_api_key: "OPENAI_API_KEY", gemini_api_key: "GEMINI_API_KEY", mistral_api_key: "MISTRAL_API_KEY", deepseek_api_key: "DEEPSEEK_API_KEY", openrouter_api_key: "OPENROUTER_API_KEY", xai_api_key: "XAI_API_KEY" }.freeze
Class Attribute Summary collapse
-
.pending_lock ⇒ Object
readonly
Returns the value of attribute pending_lock.
-
.pending_skills ⇒ Object
readonly
Returns the value of attribute pending_skills.
Class Method Summary collapse
-
.configure_llm! ⇒ Object
Configure RubyLLM from environment variables.
- .generate_one_skill(name, version, spinner) ⇒ Object
- .generate_pending_skills ⇒ Object
Class Attribute Details
.pending_lock ⇒ Object (readonly)
Returns the value of attribute pending_lock.
27 28 29 |
# File 'lib/rubygems_plugin.rb', line 27 def pending_lock @pending_lock end |
.pending_skills ⇒ Object (readonly)
Returns the value of attribute pending_skills.
27 28 29 |
# File 'lib/rubygems_plugin.rb', line 27 def pending_skills @pending_skills end |
Class Method Details
.configure_llm! ⇒ Object
Configure RubyLLM from environment variables. Called automatically by the CLI commands so users don’t need a separate initializer for standalone use. No-op if RubyLLM is already configured (e.g. in a Rails app).
27 28 29 30 31 32 33 34 |
# File 'lib/gem/skill.rb', line 27 def self.configure_llm! RubyLLM.configure do |config| ENV_KEY_MAP.each do |attr, env_var| value = ENV[env_var] config.public_send(:"#{attr}=", value) if value end end end |
.generate_one_skill(name, version, spinner) ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'lib/rubygems_plugin.rb', line 52 def generate_one_skill(name, version, spinner) spinner.auto_spin Generator.new(name, version).generate spinner.success("done") rescue => e spinner.error("failed") warn "gem-skill: #{name}: #{e.}" end |
.generate_pending_skills ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rubygems_plugin.rb', line 29 def generate_pending_skills return if @pending_skills.empty? configure_llm! multi = TTY::Spinner::Multi.new( "[:spinner] Writing skills", format: :dots, output: $stderr ) threads = @pending_skills.map do |gem_info| name = gem_info[:name] version = gem_info[:version] sp = multi.register(" [:spinner] :title") sp.update(title: "#{name} #{version}") Thread.new(name, version, sp) { |n, v, spinner| generate_one_skill(n, v, spinner) } end threads.each(&:join) rescue => e warn "gem-skill: #{e.}" end |