Fix MCP dep tool parameter names to match CLI (issue_id/depends_on_id)

- Changed from confusing from_id/to_id to clear issue_id/depends_on_id
- Matches CLI convention: bd dep add [issue-id] [depends-on-id]
- Updated all tests and implementations
- Fixes GH #113 where Claude Code was creating dependencies backwards

Closes bd-58

Amp-Thread-ID: https://ampcode.com/threads/T-f01aca11-a10f-4908-9ce6-7e1734f2068f
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-10-23 13:06:54 -07:00
parent 10a313e3a6
commit 4f1d1a2cca
11 changed files with 1777 additions and 102 deletions

View File

@@ -548,7 +548,7 @@ async def test_add_dependency(bd_client, mock_process):
mock_process.communicate = AsyncMock(return_value=(b"Dependency added\n", b""))
with patch("asyncio.create_subprocess_exec", return_value=mock_process):
params = AddDependencyParams(from_id="bd-2", to_id="bd-1", dep_type="blocks")
params = AddDependencyParams(issue_id="bd-2", depends_on_id="bd-1", dep_type="blocks")
await bd_client.add_dependency(params)
# Should complete without raising an exception
@@ -564,7 +564,7 @@ async def test_add_dependency_failure(bd_client, mock_process):
patch("asyncio.create_subprocess_exec", return_value=mock_process),
pytest.raises(BdCommandError, match="bd dep add failed"),
):
params = AddDependencyParams(from_id="bd-2", to_id="bd-1", dep_type="blocks")
params = AddDependencyParams(issue_id="bd-2", depends_on_id="bd-1", dep_type="blocks")
await bd_client.add_dependency(params)
@@ -575,7 +575,7 @@ async def test_add_dependency_not_found(bd_client):
patch("asyncio.create_subprocess_exec", side_effect=FileNotFoundError()),
pytest.raises(BdNotFoundError, match="bd CLI not found"),
):
params = AddDependencyParams(from_id="bd-2", to_id="bd-1", dep_type="blocks")
params = AddDependencyParams(issue_id="bd-2", depends_on_id="bd-1", dep_type="blocks")
await bd_client.add_dependency(params)

View File

@@ -255,7 +255,7 @@ async def test_add_dependency(bd_client):
issue2 = await bd_client.create(CreateIssueParams(title="Issue 2", priority=1, issue_type="task"))
# Add dependency: issue2 blocks issue1
params = AddDependencyParams(from_id=issue1.id, to_id=issue2.id, dep_type="blocks")
params = AddDependencyParams(issue_id=issue1.id, depends_on_id=issue2.id, dep_type="blocks")
await bd_client.add_dependency(params)
# Verify dependency by showing issue1
@@ -392,7 +392,7 @@ async def test_dependency_types(bd_client):
issue2 = await bd_client.create(CreateIssueParams(title="Issue 2", priority=1, issue_type="task"))
# Test related dependency
params = AddDependencyParams(from_id=issue1.id, to_id=issue2.id, dep_type="related")
params = AddDependencyParams(issue_id=issue1.id, depends_on_id=issue2.id, dep_type="related")
await bd_client.add_dependency(params)
# Verify

View File

@@ -382,7 +382,7 @@ async def test_add_dependency_tool(mcp_client):
# Add dependency
result = await mcp_client.call_tool(
"dep",
{"from_id": issue1["id"], "to_id": issue2["id"], "dep_type": "blocks"},
{"issue_id": issue1["id"], "depends_on_id": issue2["id"], "dep_type": "blocks"},
)
message = result.content[0].text
@@ -523,7 +523,7 @@ async def test_dependency_types(mcp_client):
# Test related dependency
result = await mcp_client.call_tool(
"dep",
{"from_id": issue1["id"], "to_id": issue2["id"], "dep_type": "related"},
{"issue_id": issue1["id"], "depends_on_id": issue2["id"], "dep_type": "related"},
)
message = result.content[0].text

View File

@@ -237,7 +237,7 @@ async def test_beads_add_dependency_success():
with patch("beads_mcp.tools._get_client", return_value=mock_client):
result = await beads_add_dependency(
from_id="bd-2", to_id="bd-1", dep_type="blocks"
issue_id="bd-2", depends_on_id="bd-1", dep_type="blocks"
)
assert "Added dependency" in result
@@ -258,7 +258,7 @@ async def test_beads_add_dependency_error():
with patch("beads_mcp.tools._get_client", return_value=mock_client):
result = await beads_add_dependency(
from_id="bd-2", to_id="bd-1", dep_type="blocks"
issue_id="bd-2", depends_on_id="bd-1", dep_type="blocks"
)
assert "Error" in result