feat(mr view): add --resolved and --unresolved filtering flags

Summary

Add --resolved and --unresolved flags to glab mr view to filter discussions by their resolution status. Both flags imply --comments, so users don't need to specify both.

Changes

  • Add showResolved and showUnresolved options to the command
  • Implement filterDiscussionsByResolution to filter discussions based on resolution status
  • Filter only considers resolvable discussions (skips system notes and non-resolvable notes)
  • A discussion is considered resolved when all its resolvable notes are resolved
  • Comprehensive unit tests for filtering logic

Usage Examples

# Show only unresolved discussions
glab mr view 123 --unresolved

# Show only resolved discussions
glab mr view 123 --resolved

# Both flags can be used together to show all resolvable discussions
glab mr view 123 --resolved --unresolved

Why This Change?

This is the second MR in a stack of three:

  1. !2892 (merged): Switch to Discussions API (foundation)
  2. This MR: Add filtering flags
  3. Next MR: Add glab mr note resolve/unresolve commands

These filters help reviewers and maintainers quickly see:

  • What discussions still need attention (--unresolved)
  • What has been addressed (--resolved)

Filtering Logic

A discussion is:

  • Resolved: When all resolvable notes in the thread are marked as resolved
  • Unresolved: When at least one resolvable note is not resolved
  • Ignored: Non-resolvable discussions (like system notes) are excluded from both filters

Test Plan

  • Unit tests for filterDiscussionsByResolution covering all cases
  • All existing tests still pass
  • Documentation generated
Edited by Kai Armstrong

Merge request reports

Loading