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
showResolvedandshowUnresolvedoptions to the command - Implement
filterDiscussionsByResolutionto 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:
-
✅ !2892 (merged): Switch to Discussions API (foundation) - This MR: Add filtering flags
-
Next MR: Add
glab mr note resolve/unresolvecommands
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
filterDiscussionsByResolutioncovering all cases - All existing tests still pass
- Documentation generated
Edited by Kai Armstrong