feat(mcp): Add reopen command support for closed issues
Implements the `bd` reopen command across the entire MCP stack, enabling agents to reopen closed issues with optional reason tracking for audit trails. This addresses the need to handle regressions and incorrectly closed issues without manual `bd` CLI intervention. The reopen command is more explicit than `bd update --status open` and emits a dedicated Reopened event in the audit log, making it easier to track why issues were reopened during analysis. Changes: - `models.py`: Add ReopenIssueParams with issue_ids list and optional reason - `bd_client.py`: Implement reopen() method with JSON response parsing - `tools.py`: Add beads_reopen_issue() wrapper with Annotated types for MCP - `server.py`: Register 'reopen' MCP tool with description and parameters Testing (10 new): - `test_bd_client.py`: 4 unit tests (mocked subprocess) - `test_bd_client_integration.py`: 3 integration tests (real `bd` CLI) - `test_mcp_server_integration.py`: 3 MCP integration tests (FastMCP Client) - `test_tools.py`: 3 tools wrapper tests (mocked BdClient) Also updated `README.md`.
This commit is contained in:
committed by
Steve Yegge
parent
331a435418
commit
32a718dacd
@@ -15,6 +15,7 @@ from .models import (
|
||||
Issue,
|
||||
ListIssuesParams,
|
||||
ReadyWorkParams,
|
||||
ReopenIssueParams,
|
||||
ShowIssueParams,
|
||||
Stats,
|
||||
UpdateIssueParams,
|
||||
@@ -381,6 +382,26 @@ class BdClient:
|
||||
|
||||
return [Issue.model_validate(issue) for issue in data]
|
||||
|
||||
async def reopen(self, params: ReopenIssueParams) -> list[Issue]:
|
||||
"""Reopen one or more closed issues.
|
||||
|
||||
Args:
|
||||
params: Reopen parameters
|
||||
|
||||
Returns:
|
||||
List of reopened issues
|
||||
"""
|
||||
args = ["reopen", *params.issue_ids]
|
||||
|
||||
if params.reason:
|
||||
args.extend(["--reason", params.reason])
|
||||
|
||||
data = await self._run_command(*args)
|
||||
if not isinstance(data, list):
|
||||
raise BdCommandError(f"Invalid response for reopen {params.issue_ids}")
|
||||
|
||||
return [Issue.model_validate(issue) for issue in data]
|
||||
|
||||
async def add_dependency(self, params: AddDependencyParams) -> None:
|
||||
"""Add a dependency between issues.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user