Skip to main content

Module ai_backend_args

Module ai_backend_args 

Source
Expand description

Per-command AI backend flags (--ai-backend, --model, --beta-header, the --claude-cli-* escape hatches, and --models-yaml).

These used to be global = true on the root Cli, so every subcommand accepted them and all but a handful silently ignored them (#1778). They are now declared only on the commands that read them.

Placement rule: a flag attaches to the narrowest node whose entire subtree reads it — subtree-global = true there (the gmail --account precedent), or #[command(flatten)]ed onto individual leaves when the readers are scattered, as the AI commands are. clap then rejects a flag on a command that would ignore it, and --help is accurate by construction.

The values are still forwarded to environment variables by apply rather than threaded as parameters: resolve_backend/resolve_model, preflight, ClaudeCliAiClient, and the MCP binary all read the environment, so none of them changes. Each owning command calls apply as the first line of its execute(), before preflight and before building a client.

Structs§

AiBackendArgs
The AI backend flags, flattened onto every command that builds an AI client (git commit message {twiddle,check,staged}, git branch create pr, ai chat, ai jev verify-decision).
ModelsYamlArg
--models-yaml: the one AI flag also read by a non-AI command (config models show), so it is its own group.