feat(mcp): improve error messages for missing bd CLI

Add helpful installation instructions when bd CLI is not found,
making it clear that the CLI must be installed separately.

Changes:
- Add BdNotFoundError.installation_message() with clear install steps
- Update all BdNotFoundError raises to use new formatted message
- Improve config error message with installation instructions first
- Update tests to match new error message format

Error message now shows:
- Clear explanation that bd CLI is required
- Installation command with curl one-liner
- Link to GitHub installation docs
- Reminder to restart Claude Code after installation

Test results: 90/91 tests passing (1 unrelated path assertion)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-10-14 17:33:54 -07:00
parent 1aad54be55
commit 061e8c4a27
4 changed files with 42 additions and 18 deletions

View File

@@ -68,7 +68,7 @@ async def test_run_command_not_found(bd_client):
"""Test command execution when bd executable not found."""
with (
patch("asyncio.create_subprocess_exec", side_effect=FileNotFoundError()),
pytest.raises(BdNotFoundError, match="bd command not found"),
pytest.raises(BdNotFoundError, match="bd CLI not found"),
):
await bd_client._run_command("show", "bd-1")
@@ -471,7 +471,7 @@ async def test_add_dependency_not_found(bd_client):
"""Test add_dependency when bd executable not found."""
with (
patch("asyncio.create_subprocess_exec", side_effect=FileNotFoundError()),
pytest.raises(BdNotFoundError, match="bd command not found"),
pytest.raises(BdNotFoundError, match="bd CLI not found"),
):
params = AddDependencyParams(from_id="bd-2", to_id="bd-1", dep_type="blocks")
await bd_client.add_dependency(params)
@@ -507,7 +507,7 @@ async def test_quickstart_not_found(bd_client):
"""Test quickstart when bd executable not found."""
with (
patch("asyncio.create_subprocess_exec", side_effect=FileNotFoundError()),
pytest.raises(BdNotFoundError, match="bd command not found"),
pytest.raises(BdNotFoundError, match="bd CLI not found"),
):
await bd_client.quickstart()