feat(mrs): consolidate 20 MR tools into 5 CQRS tools (#15)#23
Conversation
CQRS CONSOLIDATION: - browse_merge_requests: list, get, diffs, compare actions - browse_mr_discussions: list, drafts, draft actions - manage_merge_request: create, update, merge actions - manage_mr_discussion: comment, thread, reply, update actions - manage_draft_notes: create, update, publish, publish_all, delete actions IMPLEMENTATION: - Refactored registry.ts to use gitlab helper for proper typing - Updated schemas with Zod discriminated unions for action-based validation - Complete test coverage with 56 unit tests for all CQRS tools DOCUMENTATION: - Updated README.md tool counts (85 → 61 tools) - Added v5.0 migration guide for CQRS consolidation - Updated USE_MRS and USE_FILES env var descriptions BREAKING CHANGE: Individual MR tools replaced with action-based CQRS tools
📊 Test Coverage ReportOverall Coverage: 84.86% Coverage Details
📈 Coverage Report: View detailed coverage report
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR consolidates 20 individual merge request tools into 5 CQRS (Command Query Responsibility Segregation) action-based tools, reducing the total tool count from 85 to 61 while maintaining all functionality. The refactoring introduces a cleaner architecture with browse_* tools for queries and manage_* tools for commands, using Zod discriminated unions for type-safe action dispatching.
Changes:
- Refactored MR tools from 20 individual tools to 5 CQRS tools with action-based dispatching
- Updated schemas to use discriminated unions with action fields
- Migrated from
enhancedFetchto newgitlabhelper for better type safety - Added 56 comprehensive unit tests covering all CQRS tool actions
- Updated documentation with migration guide for users
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Added [email protected] dependency |
| package.json | Added conventional changelog dependency for semantic versioning |
| .releaserc.json | Enhanced semantic-release configuration with conventionalcommits preset |
| .gitignore | Added CLAUDE.md to exclusions |
| src/entities/mrs/schema.ts | New CQRS command schemas with discriminated unions for manage_* tools |
| src/entities/mrs/schema-readonly.ts | New CQRS query schemas with discriminated unions for browse_* tools |
| src/entities/mrs/registry.ts | Consolidated 20 tools into 5 CQRS tools with action-based handlers |
| tests/unit/entities/mrs/registry.test.ts | Updated tests for CQRS tools with comprehensive action coverage |
| README.md | Updated documentation with tool consolidation details and migration guide |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
PR REVIEW FIXES: - README.md: Fix tool count "17 tools → 20 tools" to reflect actual count - registry.ts: Pass include_diverged_commits_count and include_rebase_in_progress to "get" and "diffs" actions (fields were defined but unused) - registry.test.ts: Clarify toQuery mock comment to explain it mirrors real implementation, clarify resetAllMocks comment about preserving mock implementation TEST IMPROVEMENTS: - Add test for "get MR by IID with include flags" - Add test for "get MR diffs with include flags" - Update existing test expectations for undefined query params Coverage: 90.35% statements, 84.21% branches, 100% functions, 97.05% lines
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 9 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
README FIXES: - Clarify migration guide heading: "v5.0" → "v5.x → v6.0" - Update summary heading: "Consolidated Tools in v5.0" → "CQRS Tools Introduced in v6.0" - Fix Core/Projects count: "8 tools → CQRS" → "13 tools → 5 CQRS tools" TEST IMPROVEMENTS (coverage 90.35% → 92.1%): - Add test for create draft note with in_reply_to_discussion_id - Add test for update MR with array parameters (assignee_ids, reviewer_ids) - Statements: 92.1%, Branches: 86.84%, Functions: 100%, Lines: 99.01% Note: Copilot review incorrectly flagged Files/Core CQRS tools as non-existent, but they DO exist from previous PRs (#12, #19, #20).
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 9 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No existing users to migrate - remove unnecessary documentation: - Remove 'Migration Guide (v5.x → v6.0)' section with CQRS consolidation details - Remove 'Migration from v2.0' section with Work Items migration details - Remove stray 'Version 5.0.0' heading at end of file Also add clarifying comment in schema-readonly.ts explaining why project_id is optional in BrowseMRsListSchema (cross-project search).
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 9 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
## [6.1.0](v6.0.0...v6.1.0) (2026-01-19) ### ⚠ BREAKING CHANGES * **mrs:** Individual MR tools replaced with action-based CQRS tools ### Features * **mrs:** consolidate 20 MR tools into 5 CQRS tools ([#15](#15)) ([ec06fae](ec06fae)) ### Bug Fixes * **mrs:** address PR [#23](#23) review comments and increase coverage ([0e6410b](0e6410b)), closes [#12](#12) [#19](#19) [#20](#20) * **mrs:** address PR review comments from Copilot ([#23](#23)) ([1905ac4](1905ac4))
Summary
browse_*for queries,manage_*for commandsCQRS Tools
browse_merge_requestsbrowse_mr_discussionsmanage_merge_requestmanage_mr_discussionmanage_draft_notesChanges
registry.tsto use gitlab helper for proper typingTest plan
yarn lint- 0 errorsyarn test:unit- 1420/1420 passingyarn build- successBREAKING CHANGE: Individual MR tools replaced with action-based CQRS tools