Module cli_download

Module cli_download 

Source
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

  1. First, check if CLI is already installed (PATH, common locations)
  2. If not found, check the SDK’s local cache directory
  3. 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