Add built-in support to check merge request conflict status via glab mr view
Problem
There is currently no straightforward way to check whether a merge request has conflicts using the glab CLI.
While the GitLab API exposes a merge_status field (e.g., can_be_merged, cannot_be_merged, unchecked, etc.), this is not easily accessible via glab, especially for users without --json and --jq support (e.g., on older versions or simpler shell environments).
Use Case
Many users rely on glab mr create in automation scripts and would like to check if a merge request is mergeable before taking further actions, like sending notifications (e.g., to Microsoft Teams, Slack, etc).
Currently, users must either:
- Parse the MR URL and make a manual REST API call, or
- Upgrade to the latest
glabversion and use--json/--jq(which still isn’t clearly documented for this use case)
Feature Request
Add a flag like:
glab mr view <id> --conflict-status
<!-- implementation plan added during 2026-09 backlog triage -->
## Implementation plan
> **Note:** This plan was drafted during an AI-assisted triage of the backlog and has not been validated by a maintainer. Treat it as a starting point: file paths, line numbers, and the approach may need adjusting.
1. Add the conflict field to the non-TTY output. In `internal/commands/mr/view/mr_view.go`, in `rawMRPreview` (line 318), add a line after the `target_branch` field: `fmt.Fprintf(&out, "conflicts:\t%v\n", mr.HasConflicts)`. Match the surrounding style, including the trailing `//nolint:forbidigo` comment the other `Fprintf` calls carry. Use `mr.HasConflicts`, not `mr.DetailedMergeStatus`: the latter reports only the first blocking reason, so a conflicting merge request can come back as `discussions_not_resolved`.
2. Cover it in tests. Extend `Test_rawMRPreview` in `internal/commands/mr/view/mr_view_test.go` (line 238). The shared `mr` fixture is a `gitlab.MergeRequest` with an embedded `BasicMergeRequest`; `HasConflicts` lives on `BasicMergeRequest`. Add a table case asserting `conflicts:\tfalse` for the existing fixture and one with `HasConflicts: true` asserting `conflicts:\ttrue`. The table already supports `want` and `notWant` string slices.
3. Document the scripting path. In `NewCmdView` in `internal/commands/mr/view/mr_view.go` (line 47), add `glab mr view 123 --output json --jq '.has_conflicts'` to the `Example` heredoc, and extend `Long` with one sentence saying conflict status appears as `conflicts:` in plain-text output and as `has_conflicts` in JSON.
4. Regenerate the docs. Run `make gen-docs` and commit the regenerated `docs/source/mr/view.md` in the same commit. Never edit files under `docs/source/` by hand.
5. Verify. Run `go test ./internal/commands/mr/view/...` and `make lint`.
Out of scope for this change: a dedicated `--conflict-status` flag or a conflict-specific exit code. Those grow the flag surface for one field that the steps above already expose in both output modes.Edited by Kai Armstrong