ClaudeCode.Adapter.Port.Resolver (ClaudeCode v0.32.2)
View SourceResolves the Claude CLI binary for the local adapter.
This module handles finding the CLI binary using one of three resolution modes:
:bundled(default) -- Uses the binary inpriv/bin/. Auto-installs if missing. Verifies version matches the SDK's pinned version and re-installs on mismatch.:global-- Finds an existing system install via PATH or common locations. No auto-install."/path/to/claude"-- Uses that exact binary path.
Can also be configured via application config:
config :claude_code, cli_path: :global
Summary
Functions
Finds the claude binary using the configured resolution mode.
Validates that the Claude CLI is properly installed and accessible.
Functions
Finds the claude binary using the configured resolution mode.
Resolution Modes
The :cli_path option (or app config) determines how the binary is found:
:bundled(default) -- Use priv/bin/ binary. Auto-installs if missing. Verifies the installed version matchesInstaller.configured_version()and re-installs on mismatch.:global-- Finds an existing system install via PATH or common locations. Does not auto-install. Returns{:error, :not_found}if not found."/path/to/claude"-- Uses that exact binary. Returns{:error, :not_found}if it doesn't exist.
Examples
iex> ClaudeCode.Adapter.Port.Resolver.find_binary()
{:ok, "/path/to/priv/bin/claude"}
iex> ClaudeCode.Adapter.Port.Resolver.find_binary(cli_path: :global)
{:ok, "/usr/local/bin/claude"}
iex> ClaudeCode.Adapter.Port.Resolver.find_binary(cli_path: "/custom/path/claude")
{:ok, "/custom/path/claude"}
Validates that the Claude CLI is properly installed and accessible.