# `LlmCore.CLIProvider.Registry`
[🔗](https://github.com/fosferon/llm_core/blob/v0.3.0/lib/llm_core/cli_provider/registry.ex#L1)

Query surface for CLI-based LLM providers.

Merges built-in CLI providers (shipped in `priv/config/llm_core.toml`) with
TOML-configured ones (project/global overrides). TOML definitions win on conflict.

## Usage

    # All known CLI providers with structured metadata
    LlmCore.CLIProvider.Registry.list()

    # Only those with binary in PATH
    LlmCore.CLIProvider.Registry.available()

    # Fetch by atom ID or string alias
    {:ok, entry} = LlmCore.CLIProvider.Registry.fetch(:droid)
    {:ok, entry} = LlmCore.CLIProvider.Registry.fetch("pi")

    # Get a ready-to-use provider struct
    {:ok, provider} = LlmCore.CLIProvider.Registry.resolve(:claude_code)

    # Inspect capabilities
    {:ok, caps} = LlmCore.CLIProvider.Registry.capabilities(:codex_cli)

Each entry includes: `id`, `aliases`, `binary`, `available?`, `install_hint`,
`default_model`, `capabilities`, `supports_auto_approve?`, `supports_sandbox_bypass?`,
`supports_system_prompt_file?`, `supports_cwd?`, `supports_add_dir?`, `metadata`.

## Resolution Order

1. TOML-configured CLI providers (from `Config.Store`) — override builtins
2. Built-in providers (from `CLIProvider.@builtins`)

## Usage

    # List all known CLI providers
    CLIProvider.Registry.list()

    # Only those with the binary in PATH
    CLIProvider.Registry.available()

    # Fetch by id or alias
    {:ok, entry} = CLIProvider.Registry.fetch(:droid)
    {:ok, entry} = CLIProvider.Registry.fetch("pi")

    # Get a ready-to-use struct
    {:ok, provider} = CLIProvider.Registry.resolve(:droid)

    # Inspect capabilities
    caps = CLIProvider.Registry.capabilities(:droid)

# `entry`

```elixir
@type entry() :: %{
  id: atom(),
  aliases: [String.t()],
  binary: String.t(),
  available?: boolean(),
  install_hint: String.t() | nil,
  default_model: String.t() | nil,
  model_resolution: :gc_default | :provider_runtime | :explicit_only,
  capabilities: map(),
  supports_auto_approve?: boolean(),
  supports_sandbox_bypass?: boolean(),
  supports_system_prompt_file?: boolean(),
  supports_cwd?: boolean(),
  supports_add_dir?: boolean(),
  metadata: map()
}
```

# `available`

```elixir
@spec available() :: [entry()]
```

Returns only CLI providers whose binary is found in PATH.

# `capabilities`

```elixir
@spec capabilities(atom() | String.t()) :: {:ok, map()} | {:error, :not_found}
```

Returns the capability map for a CLI provider.

# `fetch`

```elixir
@spec fetch(atom() | String.t()) :: {:ok, entry()} | {:error, :not_found}
```

Fetches a CLI provider entry by id (atom or string) or alias.

# `list`

```elixir
@spec list() :: [entry()]
```

Returns all known CLI providers with metadata.
Runtime-configured providers override builtins with the same name.

# `resolve`

```elixir
@spec resolve(atom() | String.t()) ::
  {:ok, LlmCore.LLM.CLIProvider.t()} | {:error, :not_found}
```

Resolves a CLI provider into a ready-to-use `%CLIProvider{}` struct.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
