feat: add `glab mr note update` and `glab mr note delete` commands
What does this MR do?
Adds two new subcommands under glab mr note:
update [<id>|<branch>] <note-id>— replaces the body of an existing note. Accepts-mflag, editor, or stdin input.delete [<id>|<branch>] <note-id>— permanently deletes a note with a confirmation prompt (skippable with--yes).
Both commands accept a numeric note ID (visible in glab mr note list -F json or note URLs like #note_12345) and automatically resolve the parent discussion ID via the API.
Related
ability to add MR comment for specific file and... (#1311 - closed)
closes glab mr note update/delete (#8312 - closed)
Manual testing strategy
Build the binary with make build, then run through the following steps using a test MR.
1. Create a test note
./bin/glab mr note create <MR_IID> -m "test comment"
# Expected: prints URL like …/merge_requests/<IID>#note_<NOTE_ID>2. Verify note exists
./bin/glab mr note list <MR_IID> -F json | grep <NOTE_ID>
# Expected: note ID appears in JSON output3. Update the note
./bin/glab mr note update <MR_IID> <NOTE_ID> -m "UPDATED test comment"
# Expected: prints URL …/merge_requests/<IID>#note_<NOTE_ID>4. Verify update
./bin/glab mr note list <MR_IID> -F json | grep "UPDATED test comment"
# Expected: updated body appears in output5. Update via stdin
echo "body from stdin" | ./bin/glab mr note update <MR_IID> <NOTE_ID>
# Expected: note body updated to "body from stdin"6. Delete with confirmation prompt
./bin/glab mr note delete <MR_IID> <NOTE_ID>
# Expected: shows note preview with author, asks "Are you sure you want to delete this note?"
# Type "yes" → prints "✓ Deleted note <NOTE_ID> from !<IID>"7. Verify deletion
./bin/glab mr note list <MR_IID> -F json | grep <NOTE_ID>
# Expected: no match (note is gone)8. Delete with --yes flag (skip confirmation)
# Create another note first
./bin/glab mr note create <MR_IID> -m "to be deleted"
./bin/glab mr note delete <MR_IID> <NEW_NOTE_ID> --yes
# Expected: deletes immediately without prompt9. Error cases
# Non-existent note ID
./bin/glab mr note update <MR_IID> 999999 -m "nope"
# Expected: error "note 999999 not found in merge request !<IID>"
# Invalid (non-numeric) note ID
./bin/glab mr note delete <MR_IID> abc123
# Expected: error "invalid note ID \"abc123\": must be a numeric note ID, not a discussion ID prefix"
# Empty message
./bin/glab mr note update <MR_IID> <NOTE_ID> -m ""
# Expected: opens editor (or error if no stdin/editor)
# Delete without --yes in non-interactive mode
echo "" | ./bin/glab mr note delete <MR_IID> <NOTE_ID>
# Expected: error "--yes required when not running interactively"Automated test run (2026-05-18) ✅
All 9 steps passed against MR !3268 (merged):
- Steps 1–7: create → verify → update → verify update → delete with interactive confirm → verify deletion
- Step 8:
--yesflag deletes immediately without prompt - Step 9: all error cases return expected messages (non-existent note, invalid ID, empty body, non-interactive without
--yes)