-
Notifications
You must be signed in to change notification settings - Fork 31
feat: add -a/--agent flag to rover merge #546
Description
Summary
Add an -a, --agent <agent>[:<model>] flag to rover merge so users can specify the AI agent (and optionally the model) used for commit message generation and conflict resolution, without changing their default settings.
Originally proposed in #462 by @dataforxyz.
Motivation
Currently, rover merge always uses the AI agent configured in user settings (or defaults to Claude). There is no way to override this per invocation. A -a flag would let users pick a different agent or model on the fly — useful for testing, cost control, or preferring a specific model for conflict resolution.
This also aligns with how rover task already accepts an --agent flag.
Proposed Behavior
rover merge <taskId> -a claude:sonnet
rover merge <taskId> -a gemini
rover merge <taskId> # falls back to user settings as today
The flag value is parsed as <agent>[:<model>]:
claude→ Claude with default modelclaude:haiku→ Claude with Haiku modelgemini→ Gemini with default model
When -a is provided, it takes precedence over user settings. When omitted, the existing behavior (load from user settings, default to Claude) is preserved.
Implementation Notes
- Parse the flag using
parseAgentStringfromsrc/utils/agent-parser.ts. - Pass the resolved model to
getAIAgentTool(agent, model)so the agent CLI receives--model <model>. - Also fix
getRecentCommits()in the merge command to pass the current branch explicitly instead of relying ongetMainBranch(), which can fail when the default branch ismasterinstead ofmain.