-
Notifications
You must be signed in to change notification settings - Fork 0
feat(server): add dcover 'refactor' and 'issues' commands [TG-24011] #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit refactors the core execution logic into a shared `_run_dcover_command` helper function. This new function now encapsulates: - Finding the `dcover` executable - Assembling the command - Appending environment variable options (`DIFFBLUE_COVER_OPTIONS`) - Calling `executor.execute` - Streaming output to the MCP context - Centralized `ToolError` handling The existing `create` tool has been refactored to be a thin wrapper around this new helper. This prepares the codebase for adding the `refactor` and `issues` tools without code duplication.
Adds the new `refactor` tool to the MCP server. This tool exposes the `dcover refactor` (also known as `fix-build`) command. This implementation follows the refactored pattern, acting as a thin wrapper around the `_run_dcover_command` helper. It includes support for the `--dry-run` argument. Unit tests are added to `test/test_server.py` to validate the new tool's command assembly for both default and dry-run cases.
Adds the new `issues` tool to the MCP server, exposing the `dcover issues` command. This tool allows a user to programmatically query a project for a prioritized list of issues. It includes support for all of `issues`' specific arguments, such as `--limit`, `--skip`, `--prompt`, `--cover-json`, and `--dry-run`. Unit tests are added to `test/test_server.py` to validate the new tool's command assembly, including a test for all arguments combined.
Addresses PR feedback by refactoring the `_run_dcover_command` helper to accept `**kwargs`. This change centralizes all tool-specific argument processing (for `create`, `refactor`, and `issues`) inside the helper, making the tool functions themselves simpler wrappers. The existing test suite (23 tests) passes without modification, confirming this refactor is behavior-preserving.
This commit completes the feature by:
1. Adding the new `issues` tool to the MCP server, exposing the
`dcover issues` command.
2. Adding corresponding unit tests for the `issues` tool, including
a test for all its specific arguments.
3. Refactoring the `_run_dcover_command` helper to accept `**kwargs`,
addressing PR feedback. This centralizes all argument-building
logic.
4. Creating a new `_build_tool_args` helper function to resolve
`PLR0912 (Too many branches)` linting errors.
5. Adding a `noqa` directive for `PLR0913 (Too many arguments)`
on the helper, as all arguments are necessary for its function.
Adds `noqa: PLR0917` (Too many positional arguments) to the `create` and `refactor` tool function signatures. This rule is intentionally suppressed as these functions are wrappers that must pass a consistent set of arguments to the underlying helper.
pcrane
approved these changes
Nov 18, 2025
oleh-kovryha
approved these changes
Dec 9, 2025
oleh-kovryha
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR expands the
cover-mcpserver's capabilities beyond test creation by adding two newdcovercommands:refactor(aliased asfix-build) andissues. This enables an AI assistant to have a complete workflow: diagnosing project health, fixing build issues, and then generating tests.The Feature
refactortool that exposesdcover refactor(orfix-build).issuestool that exposesdcover issues, with parameters for limiting, skipping, and requesting prompts._run_dcover_commandhelper function for consistency in logging, execution, and error handling._run_dcover_commandhelper now accepts**kwargsto centralize all tool-specific argument processing._build_tool_argshelper is extracted to resolve RuffPLR0912 (Too many branches)warnings.PLR0913 (Too many arguments)is now suppressed with anoqacomment on the main helper.PLR0917 (Too many positional arguments)is suppressed on the wrapper tools.How to Test
refactortool and verify it executesdcover refactorwith the correct arguments (e.g.,--dry-run).issuestool and verify it executesdcover issueswith the correct arguments (e.g.,--limit 5,--prompt).createtool and verify it still functions correctly after the refactor.uv run coverage run -m pytest -v).uv run ruff check).Related Ticket
TG-24011