Expand description
CLI download and management utilities Automatic Claude Code CLI download and management
This module provides functionality to automatically download and manage the Claude Code CLI binary, similar to Python SDK’s bundling approach.
§Download Strategy
- First, check if CLI is already installed (PATH, common locations)
- If not found, check the SDK’s local cache directory
- If not cached, download from official source and cache locally
§Cache Location
- Unix:
~/.cache/cc-sdk/cli/ - macOS:
~/Library/Caches/cc-sdk/cli/ - Windows:
%LOCALAPPDATA%\cc-sdk\cli\
§Feature Flag
The download functionality requires the auto-download feature (enabled by default).
To disable, use default-features = false in your Cargo.toml.
Constants§
- DEFAULT_
CLI_ VERSION - Default CLI version to download if not specified
- MIN_
CLI_ VERSION - Minimum CLI version required by this SDK
Functions§
- download_
cli - Download the Claude Code CLI to the cache directory
- ensure_
cli - Ensure the CLI is available, downloading if necessary
- get_
cache_ dir - Get the cache directory for the SDK
- get_
cached_ cli_ path - Get the path to the cached CLI binary
- is_
cli_ cached - Check if the cached CLI exists and is executable