mix oban_claude.run (oban_claude v0.1.0)

Copy Markdown View Source

Fire a single claude run from the CLI (no queue, no database).

The engine-level, one-shot counterpart to the Oban queue: CLI flags parse into the same ObanClaude.Args.new/1 vocabulary, run through ObanClaude.run/2, and the {oban_return, result} verdict is printed. No Oban, no repo, no app supervision -- just one claude call.

Examples

mix oban_claude.run "summarize the repo" --working-dir . --permission-mode plan
mix oban_claude.run "review this" --model sonnet --allowed-tools Read --allowed-tools Grep
mix oban_claude.run "extract the facts" --json-schema priv/schema.json --json

This makes a real (billable) claude call and uses the claude CLI's own authentication.

Options

Every flag maps to an ObanClaude.Args.new/1 option. The prompt is the first positional argument (or --prompt).

  • --model, --fallback-model, --agent -- strings
  • --working-dir, --system-prompt, --append-system-prompt -- strings
  • --permission-mode -- one of default, accept_edits, bypass_permissions, dont_ask, plan, auto
  • --effort -- one of low, medium, high, xhigh, max
  • --max-turns, --timeout -- integers
  • --max-budget-usd -- float
  • --worktree -- true/false for an ephemeral worktree, or a name for a named one (e.g. --worktree issue-42). Needs --working-dir to be a git repo.
  • --json-schema -- path/string for a structured-output run
  • --add-dir, --allowed-tools, --disallowed-tools, --mcp-config -- repeatable (pass the flag once per value)

Output flag:

  • --json -- print a machine-readable JSON summary instead of text

Summary

Functions

Parse argv into a validated string-keyed args map (via ObanClaude.Args.new/1).

Functions

build_args(argv)

@spec build_args([String.t()]) :: %{required(String.t()) => term()}

Parse argv into a validated string-keyed args map (via ObanClaude.Args.new/1).

Separated from run/1 so the flag parsing and vocabulary mapping are testable without a claude call. Raises on an unknown flag, a bad value, or a missing prompt.