ClaudeAgentSDK.CLI (claude_agent_sdk v0.6.9)

View Source

Centralized Claude CLI discovery and version tracking.

This module consolidates executable lookup logic and provides helpers for checking installation status, parsing the installed version, and warning when the detected version is below the supported minimum.

Summary

Functions

Attempts to find the Claude CLI executable.

Like find_executable/0 but raises when the CLI is not available.

Returns true if the Claude CLI is installed and discoverable.

Returns the minimum supported Claude CLI version.

Returns the recommended Claude CLI version for this SDK release.

Returns the installed Claude CLI version as a string.

True if the installed version meets or exceeds the minimum.

Emits a warning when the installed CLI is below the supported minimum or unknown.

Functions

find_executable()

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

Attempts to find the Claude CLI executable.

Tries candidates in order (claude-code, then claude) and returns {:ok, path} when found or {:error, :not_found} otherwise.

find_executable!()

@spec find_executable!() :: String.t()

Like find_executable/0 but raises when the CLI is not available.

installed?()

@spec installed?() :: boolean()

Returns true if the Claude CLI is installed and discoverable.

minimum_version()

@spec minimum_version() :: String.t()

Returns the minimum supported Claude CLI version.

version()

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

Returns the installed Claude CLI version as a string.

version_supported?()

@spec version_supported?() :: boolean()

True if the installed version meets or exceeds the minimum.

warn_if_outdated()

@spec warn_if_outdated() :: :ok

Emits a warning when the installed CLI is below the supported minimum or unknown.