MingaClaudeBridge.Binary (minga_claude_bridge v0.1.0)

Copy Markdown View Source

Finds the claude executable and reads its version.

resolve/1 returns an absolute path, so the transport starts that exact file and never searches PATH again. It checks, in order:

  1. CLAUDE_BRIDGE_CLI, which must be an absolute path to an executable file.
  2. claude on PATH.
  3. ~/.local/bin/claude, then ~/.claude/local/claude, where the Claude Code installers put it.

version/2 runs claude --version with a timeout. It is for diagnostics only; the session checks the version Claude Code reports in its initialize answer.

Summary

Functions

Returns true when path is a regular file (or a link to one) with an execute bit set.

Resolves the claude executable.

Runs path --version and returns the version number from its first line, for example "2.1.330". Kills the process after timeout milliseconds.

Types

error()

@type error() ::
  :claude_not_found | {:invalid_cli_override, :not_absolute | :not_executable}

Functions

executable?(path)

@spec executable?(Path.t()) :: boolean()

Returns true when path is a regular file (or a link to one) with an execute bit set.

resolve(opts \\ [])

@spec resolve(keyword()) :: {:ok, Path.t()} | {:error, error()}

Resolves the claude executable.

Options, for tests:

version(path, timeout \\ 5000)

@spec version(Path.t(), timeout()) ::
  {:ok, String.t()}
  | {:error, :timeout | {:exit_status, integer()} | :unparsable}

Runs path --version and returns the version number from its first line, for example "2.1.330". Kills the process after timeout milliseconds.