Skip to content

feat: add -a/--agent flag to rover merge #546

@Angelmmiguel

Description

@Angelmmiguel

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 model
  • claude:haiku → Claude with Haiku model
  • gemini → 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 parseAgentString from src/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 on getMainBranch(), which can fail when the default branch is master instead of main.

Reference

Metadata

Metadata

Assignees

Labels

pkg:cliCLI package related

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions