feat(files)!: CQRS consolidation - 5 tools to 2 tools#20
Conversation
BREAKING CHANGE: Replace 5 individual file tools with 2 CQRS-aligned tools Migration guide: - get_repository_tree → browse_files with action: "tree" - get_file_contents → browse_files with action: "content" - create_or_update_file → manage_files with action: "single" - push_files → manage_files with action: "batch" - upload_markdown → manage_files with action: "upload" Changes: - Add BrowseFilesSchema with discriminated union (tree/content actions) - Add ManageFilesSchema with discriminated union (single/batch/upload actions) - Replace filesToolRegistry with 2 consolidated tools - Update read-only tools list to only include browse_files - Update unit tests for new tool structure Closes #12
📊 Test Coverage ReportOverall Coverage: 80.35% 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 5 individual file operation tools into 2 CQRS-aligned tools to improve MCP client compatibility and provide cleaner separation between read (query) and write (command) operations.
Changes:
- Introduces
browse_filestool with discriminated union for "tree" and "content" actions - Introduces
manage_filestool with discriminated union for "single", "batch", and "upload" actions - Updates test suite to cover all new tool actions with comprehensive test cases
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/entities/files/schema-readonly.ts | Adds BrowseFilesSchema discriminated union for read-only file operations |
| src/entities/files/schema.ts | Adds ManageFilesSchema discriminated union for write file operations |
| src/entities/files/registry.ts | Implements consolidated tools with action-based routing, replacing 5 individual tool handlers |
| tests/unit/entities/files/registry.test.ts | Updates all test cases to use new tool structure with action discriminators |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add comprehensive tests for files entity index.ts exports: - Test GITLAB_READONLY environment variable handling - Test conditional tool filtering (read-only vs read-write mode) - Test schema re-exports from schema.ts and schema-readonly.ts - Test registry re-exports Add istanbul ignore comments to TypeScript exhaustive check default branches in registry.ts - these are unreachable at runtime since Zod validates input before the switch statements. Coverage improvement: files entity now at 100% statement coverage.
Address review feedback: content field in BatchFileActionSchema should be required, not optional. This matches the original PushFilesSchema behavior and GitLab's repository commits API requirement for create actions.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 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.
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).
## [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
Consolidates 5 file tools into 2 CQRS-aligned tools for better MCP client compatibility and cleaner read/write separation.
BREAKING CHANGE: Tool names have changed. See migration guide below.
Before (5 tools)
get_repository_tree- List files/foldersget_file_contents- Read file contentcreate_or_update_file- Single file commitpush_files- Batch file commitupload_markdown- Upload attachmentAfter (2 tools)
browse_files- Query operations (tree/content actions)manage_files- Command operations (single/batch/upload actions)Migration Guide
get_repository_treebrowse_filesaction: "tree"get_file_contentsbrowse_filesaction: "content"create_or_update_filemanage_filesaction: "single"push_filesmanage_filesaction: "batch"upload_markdownmanage_filesaction: "upload"Changes
BrowseFilesSchemawith discriminated union patternManageFilesSchemawith discriminated union patternfilesToolRegistrywith 2 consolidated toolsbrowse_filesallowed)Test Plan
Closes #12