ClaudeWrapper.Command behaviour (ClaudeWrapper v0.12.0)

Copy Markdown View Source

Behaviour for CLI commands.

Every command knows how to build its argument list and how to parse its output. This is the Elixir equivalent of the Rust ClaudeCommand trait.

Summary

Functions

Run a command synchronously through the configured ClaudeWrapper.Runner.

Types

args()

@type args() :: [String.t()]

Callbacks

args()

@callback args() :: args()

parse_output(stdout, exit_code)

@callback parse_output(stdout :: String.t(), exit_code :: non_neg_integer()) ::
  {:ok, term()} | {:error, term()}

Functions

run(mod, command, config)

@spec run(module(), struct(), ClaudeWrapper.Config.t()) ::
  {:ok, term()} | {:error, term()}

Run a command synchronously through the configured ClaudeWrapper.Runner.

Returns the parsed output on success. On timeout the default runner abandons the OS process; ClaudeWrapper.Runner.Forcola kills it.