ClaudeCode.Plugin.Marketplace (ClaudeCode v0.36.3)

View Source

Marketplace management functions wrapping claude plugin marketplace CLI commands.

Marketplaces are catalogs that define where plugins can be discovered and installed from. They can reference plugins from GitHub repos, git URLs, npm packages, and more.

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 configured marketplaces
{:ok, marketplaces} = ClaudeCode.Plugin.Marketplace.list()

# Add a marketplace from GitHub
{:ok, _output} = ClaudeCode.Plugin.Marketplace.add("owner/repo")

# Remove a marketplace
{:ok, _output} = ClaudeCode.Plugin.Marketplace.remove("my-marketplace")

# Update all marketplaces
{:ok, _output} = ClaudeCode.Plugin.Marketplace.update()

Summary

Functions

Adds a marketplace from a URL, path, or GitHub repo.

Lists all configured marketplaces.

Removes a configured marketplace by name.

Updates marketplace(s) from their source.

Types

scope()

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

t()

@type t() :: %ClaudeCode.Plugin.Marketplace{
  install_location: String.t() | nil,
  name: String.t(),
  repo: String.t() | nil,
  source: String.t()
}

Functions

add(source, opts \\ [])

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

Adds a marketplace from a URL, path, or GitHub repo.

Accepts the same source formats as the CLI: GitHub shorthand ("owner/repo"), full git URLs, or local paths.

Options

  • :scope - Where to declare the marketplace: :user (default), :project, or :local
  • :sparse - List of paths for git sparse-checkout (for monorepos)

Examples

{:ok, _} = ClaudeCode.Plugin.Marketplace.add("owner/repo")
{:ok, _} = ClaudeCode.Plugin.Marketplace.add("https://gitlab.com/org/plugins.git", scope: :project)
{:ok, _} = ClaudeCode.Plugin.Marketplace.add("owner/monorepo", sparse: [".claude-plugin", "plugins"])

list(opts \\ [])

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

Lists all configured marketplaces.

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

Examples

{:ok, marketplaces} = ClaudeCode.Plugin.Marketplace.list()
Enum.each(marketplaces, fn m -> IO.puts("#{m.name} (#{m.source})") end)

remove(name)

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

Removes a configured marketplace by name.

Examples

{:ok, _} = ClaudeCode.Plugin.Marketplace.remove("my-marketplace")

update(name \\ nil)

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

Updates marketplace(s) from their source.

When called without a name, updates all marketplaces. When called with a name, updates only that marketplace.

Examples

{:ok, _} = ClaudeCode.Plugin.Marketplace.update()
{:ok, _} = ClaudeCode.Plugin.Marketplace.update("my-marketplace")