ClaudeCode.CLI (ClaudeCode v0.1.0)
View SourceHandles CLI subprocess management for Claude Code.
This module is responsible for:
- Finding the claude binary
- Building command arguments from validated options
- Managing the subprocess lifecycle
Summary
Functions
Builds the command and arguments for running the Claude CLI.
Finds the claude binary in the system PATH.
Validates that the Claude CLI is properly installed and accessible.
Functions
@spec build_command(String.t(), String.t(), keyword(), String.t() | nil) :: {:ok, {String.t(), [String.t()]}} | {:error, term()}
Builds the command and arguments for running the Claude CLI.
Accepts validated options from the Options module and converts them to CLI flags. If a session_id is provided, automatically adds --resume flag for session continuity.
Returns {:ok, {executable, args}}
or {:error, reason}
.
@spec find_binary() :: {:ok, String.t()} | {:error, :not_found}
Finds the claude binary in the system PATH.
Returns {:ok, path}
if found, {:error, :not_found}
otherwise.
@spec validate_installation() :: :ok | {:error, term()}
Validates that the Claude CLI is properly installed and accessible.