feat(mr): list and discard pending review comments

Description

Adds --draft to glab mr note list and glab mr note delete so a pending review can be inspected and individual comments discarded from the CLI. Until now the only way to see or drop a pending comment was the browser.

  • glab mr note list --draft lists your pending review comments on the MR. Output shows the draft ID, file:line when the comment is on the diff, a (reply to …) marker for replies, and the body. --file still narrows the result; --type and --state are rejected since drafts have neither. -F json returns the raw draft objects.
  • glab mr note delete --draft <id> discards one pending comment. It fetches the draft first so the confirmation prompt shows the body, and keeps the existing --yes rules and destructive annotation.
  • mr note create --draft and mr note publish help now point at the two new flags.
  • General drafts come back from the API with an empty position object rather than none, so hasFilePosition checks for a file path instead of a nil pointer before printing file:line.

Follows the plan in #8563 (closed).

Resolves #8563 (closed)

How has this been tested?

  • make lint and go test ./internal/commands/mr/... pass.
  • New unit tests cover list with drafts, with --file, with -F json, empty list, API error, and --draft combined with --type/--state; delete with --yes, non-interactive without --yes, unknown ID, API error, and declining the prompt.
  • Manually against a test MR on gitlab.com:
  glab mr note create 1 --draft -m "first"
  glab mr note create 1 --draft --file main.go --line 3 -m "second"
  glab mr note list 1 --draft
  glab mr note list 1 --draft --file main.go
  glab mr note delete 1 --draft <id>
  glab mr note list 1 --draft
  • make gen-docs regenerated docs/source/mr/note/{create,delete,list,publish}.md.

Screenshots (if appropriate):

Screenshot_2026-09-25_at_1.49.17_AM

/assign-reviewer @phikai

Edited by Aditya Parida

Merge request reports

Loading
Loading