feat(beads): integrate Beads Mode backend, MCP tools, and GUI support

This commit is contained in:
2026-05-06 13:48:47 -04:00
parent b1ddaa50f4
commit 2b66f3569b
17 changed files with 525 additions and 77 deletions
+66
View File
@@ -62,6 +62,7 @@ import ast
import subprocess
from src import summarize
from src import outline_tool
from src import beads_client
import urllib.request
import urllib.parse
from html.parser import HTMLParser
@@ -1282,6 +1283,31 @@ def dispatch(tool_name: str, tool_input: dict[str, Any]) -> str:
return py_get_docstring(path, str(tool_input.get("name", "")))
if tool_name == "get_tree":
return get_tree(path, int(tool_input.get("max_depth", 2)))
# Beads tools
if tool_name.startswith("bd_"):
if not _primary_base_dir:
return "ERROR: no active workspace to run beads tools."
bclient = beads_client.BeadsClient(_primary_base_dir)
if tool_name == "bd_list":
beads = bclient.list_beads()
if not beads:
return "No beads found."
return "\n".join([f"ID: {b.id}, Status: {b.status}, Title: {b.title}" for b in beads])
elif tool_name == "bd_create":
title = str(tool_input.get("title", ""))
desc = str(tool_input.get("description", ""))
bid = bclient.create_bead(title, desc)
return f"Created bead: {bid}"
elif tool_name == "bd_update":
bid = str(tool_input.get("bead_id", ""))
status = str(tool_input.get("status", ""))
if bclient.update_bead(bid, status):
return f"Updated {bid} to status {status}"
return f"ERROR: bead {bid} not found."
elif tool_name == "bd_ready":
return "READY" if bclient.is_initialized() else "NOT_INITIALIZED"
return f"ERROR: unknown MCP tool '{tool_name}'"
async def async_dispatch(tool_name: str, tool_input: dict[str, Any]) -> str:
@@ -1967,6 +1993,46 @@ MCP_TOOL_SPECS: list[dict[str, Any]] = [
},
"required": ["path"]
}
},
{
"name": "bd_create",
"description": "Create a new Bead in the active Beads repository.",
"parameters": {
"type": "object",
"properties": {
"title": { "type": "string", "description": "Title of the Bead." },
"description": { "type": "string", "description": "Description of the Bead." }
},
"required": ["title", "description"]
}
},
{
"name": "bd_update",
"description": "Update an existing Bead.",
"parameters": {
"type": "object",
"properties": {
"bead_id": { "type": "string", "description": "ID of the Bead to update." },
"status": { "type": "string", "description": "New status for the Bead." }
},
"required": ["bead_id", "status"]
}
},
{
"name": "bd_list",
"description": "List all Beads in the active Beads repository.",
"parameters": {
"type": "object",
"properties": {}
}
},
{
"name": "bd_ready",
"description": "Check if the Beads repository is initialized in the current workspace.",
"parameters": {
"type": "object",
"properties": {}
}
}
]