ClaudeCode.Plugin (ClaudeCode v0.36.3)

View Source

Plugin management functions wrapping the claude plugin CLI commands.

Provides functions to install, uninstall, enable, disable, update, list, and validate plugins from configured marketplaces.

All functions resolve the CLI binary via the internal Adapter.Port.Resolver and execute commands synchronously via the system command abstraction.

Note: Remote node support is not yet implemented — these commands run on the local machine only.

Examples

# List installed plugins
{:ok, plugins} = ClaudeCode.Plugin.list()

# Install a plugin from a marketplace
{:ok, _} = ClaudeCode.Plugin.install("code-simplifier@claude-plugins-official")

# Enable/disable a plugin
{:ok, _} = ClaudeCode.Plugin.enable("code-simplifier@claude-plugins-official")
{:ok, _} = ClaudeCode.Plugin.disable("code-simplifier@claude-plugins-official")

Summary

Functions

Disables an enabled plugin.

Disables all enabled plugins.

Enables a disabled plugin.

Installs a plugin from available marketplaces.

Lists installed plugins.

Uninstalls an installed plugin.

Updates a plugin to the latest version.

Types

scope()

@type scope() :: :user | :project | :local

t()

@type t() :: %ClaudeCode.Plugin{
  enabled: boolean(),
  id: String.t(),
  install_path: String.t() | nil,
  installed_at: String.t() | nil,
  last_updated: String.t() | nil,
  mcp_servers: map() | nil,
  project_path: String.t() | nil,
  scope: scope() | nil,
  version: String.t() | nil
}

Functions

disable(plugin_id, opts \\ [])

@spec disable(
  String.t(),
  keyword()
) :: {:ok, String.t()} | {:error, String.t()}

Disables an enabled plugin.

Options

  • :scope - Scope: :user, :project, or :local (default: auto-detect)

Examples

{:ok, _} = ClaudeCode.Plugin.disable("code-simplifier@claude-plugins-official")

disable_all(opts \\ [])

@spec disable_all(keyword()) :: {:ok, String.t()} | {:error, String.t()}

Disables all enabled plugins.

Options

  • :scope - Scope: :user, :project, or :local (default: auto-detect)

Examples

{:ok, _} = ClaudeCode.Plugin.disable_all()
{:ok, _} = ClaudeCode.Plugin.disable_all(scope: :project)

enable(plugin_id, opts \\ [])

@spec enable(
  String.t(),
  keyword()
) :: {:ok, String.t()} | {:error, String.t()}

Enables a disabled plugin.

Options

  • :scope - Scope: :user, :project, or :local (default: auto-detect)

Examples

{:ok, _} = ClaudeCode.Plugin.enable("code-simplifier@claude-plugins-official")

install(plugin_id, opts \\ [])

@spec install(
  String.t(),
  keyword()
) :: {:ok, String.t()} | {:error, String.t()}

Installs a plugin from available marketplaces.

Use plugin@marketplace format for a specific marketplace, or just plugin to search all configured marketplaces.

Options

  • :scope - Installation scope: :user (default), :project, or :local

Examples

{:ok, _} = ClaudeCode.Plugin.install("code-simplifier@claude-plugins-official")
{:ok, _} = ClaudeCode.Plugin.install("my-plugin@my-org", scope: :project)

list(opts \\ [])

@spec list(keyword()) :: {:ok, [t()]} | {:error, String.t()}

Lists installed plugins.

Returns a list of %ClaudeCode.Plugin{} structs parsed from claude plugin list --json.

Examples

{:ok, plugins} = ClaudeCode.Plugin.list()
Enum.each(plugins, fn p -> IO.puts("#{p.id} (enabled: #{p.enabled})") end)

uninstall(plugin_id, opts \\ [])

@spec uninstall(
  String.t(),
  keyword()
) :: {:ok, String.t()} | {:error, String.t()}

Uninstalls an installed plugin.

Options

  • :scope - Uninstall from scope: :user (default), :project, or :local

Examples

{:ok, _} = ClaudeCode.Plugin.uninstall("code-simplifier@claude-plugins-official")

update(plugin_id, opts \\ [])

@spec update(
  String.t(),
  keyword()
) :: {:ok, String.t()} | {:error, String.t()}

Updates a plugin to the latest version.

A session restart is required for updates to take effect.

Options

  • :scope - Scope: :user, :project, :local, or :managed

Examples

{:ok, _} = ClaudeCode.Plugin.update("code-simplifier@claude-plugins-official")