Class: RosettAi::Thor::Tasks::Plugins
- Inherits:
-
Thor
- Object
- Thor
- RosettAi::Thor::Tasks::Plugins
- Defined in:
- lib/rosett_ai/thor/tasks/plugins.rb
Overview
Thor task for plugin management (list, install, remove).
Constant Summary collapse
- VALID_TYPES =
['engine', 'gui', 'mcp'].freeze
Instance Method Summary collapse
Instance Method Details
#install(type, name) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/rosett_ai/thor/tasks/plugins.rb', line 61 def install(type, name) validate_type!(type) package = plugin_package_name(type, name) warn t('installing', package: package) pm = select_package_manager if pm.install(package) RosettAi::Plugins::Registry.reset! RosettAi::Plugins::Registry.discover! warn Rainbow(t('installed', package: package)).green else warn Rainbow(t('install_failed', package: package)).red exit 1 end end |
#list(type) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/rosett_ai/thor/tasks/plugins.rb', line 31 def list(type) validate_type!(type) type_sym = type.to_sym names = RosettAi::Plugins::Registry.available(type_sym) if names.empty? warn t('no_plugins', type: type) return end if tty_output? print_list_tty(type_sym, names) else print_list_json(type_sym, names) end end |
#remove(type, name) ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/rosett_ai/thor/tasks/plugins.rb', line 88 def remove(type, name) validate_type!(type) package = plugin_package_name(type, name) warn t('removing', package: package) pm = select_package_manager if pm.remove(package) RosettAi::Plugins::Registry.reset! RosettAi::Plugins::Registry.discover! warn Rainbow(t('removed', package: package)).green else warn Rainbow(t('remove_failed', package: package)).red exit 1 end end |