Skip to main content

Module plugin_operations

Module plugin_operations 

Source
Expand description

Core plugin operations (install, uninstall, enable, disable, update)

This module provides pure library functions that can be used by both:

  • CLI commands (claude plugin install/uninstall/enable/disable/update)
  • Interactive UI (ManagePlugins.tsx)

Functions in this module:

  • Do NOT call process::exit()
  • Do NOT write to console
  • Return result objects indicating success/failure with messages
  • Can throw errors for unexpected failures

Structs§

CachePluginOptions
Cache plugin options
CachePluginResult
Cache plugin result
InstalledPluginsV2
Installed plugins data (V2 format)
LoadedPlugin
Loaded plugin structure
PluginInfo
Plugin info from marketplace lookup
PluginInstallationEntry
Installation entry in installed_plugins_v2.json
PluginOperationResult
Result of a plugin operation
PluginUpdateResult
Result of a plugin update operation
SettingsJson
Settings JSON structure

Enums§

InstallResolutionResult
Resolution result for install
InstallableScope
Installation scope type
PluginScope
Plugin scope (broader, includes ‘managed’)
SettingSource
Setting source mapping

Constants§

VALID_INSTALLABLE_SCOPES
Valid installable scopes (excludes ‘managed’ which can only be installed from managed-settings.json)
VALID_UPDATE_SCOPES
Valid scopes for update operations (includes ‘managed’ since managed plugins can be updated)

Functions§

assert_installable_scope
Assert that a scope is a valid installable scope at runtime
disable_all_plugins_op
Disable all enabled plugins
disable_plugin_op
Disable a plugin
enable_plugin_op
Enable a plugin
get_plugin_installation_from_v2
Get the most relevant installation for a plugin from V2 data. For project/local scoped plugins, prioritizes installations matching the current project. Priority order: local (matching project) > project (matching project) > user > first available
get_project_path_for_scope
Get the project path for scopes that are project-specific. Returns the original cwd for ‘project’ and ‘local’ scopes, None otherwise.
install_plugin_op
Install a plugin (settings-first).
is_installable_scope
Type guard to check if a scope is an installable scope (not ‘managed’)
is_plugin_enabled_at_project_scope
Is this plugin enabled (value === true) in .claude/settings.json?
scope_to_setting_source
Convert installable scope to setting source
set_plugin_enabled_op
Set plugin enabled/disabled status (settings-first).
uninstall_plugin_op
Uninstall a plugin
update_plugin_op
Update a plugin to the latest version.