Improved workplan dependency management facilities

This commit is contained in:
2026-05-04 11:45:24 +02:00
parent 4d6164e81b
commit bfed370a6e
10 changed files with 380 additions and 29 deletions

View File

@@ -419,6 +419,8 @@ def create_workstream(
owner: str | None = None,
due_date: str | None = None,
repo_id: str | None = None,
planning_priority: str | None = None,
planning_order: int | None = None,
) -> str:
"""Create a new workstream under a topic and emit a progress_event.
@@ -430,6 +432,8 @@ def create_workstream(
owner: optional owner name
due_date: optional ISO date string (YYYY-MM-DD)
repo_id: UUID of the owning repository (GEMS primary; strongly recommended per ADR-001)
planning_priority: optional planning priority (critical/high/medium/low or repo-local value)
planning_order: optional numeric ordering hint inside a repo/domain
"""
if not slug:
slug = re.sub(r"[^a-z0-9]+", "-", title.lower()).strip("-")
@@ -442,6 +446,8 @@ def create_workstream(
"due_date": due_date,
"status": "active",
"repo_id": repo_id,
"planning_priority": planning_priority,
"planning_order": planning_order,
})
_post("/progress", {
"topic_id": topic_id,
@@ -830,21 +836,27 @@ def get_next_steps() -> str:
@mcp.tool()
def create_dependency(
from_workstream_id: str,
to_workstream_id: str,
to_workstream_id: str | None = None,
to_task_id: str | None = None,
relationship_type: str = "blocks",
description: str | None = None,
) -> str:
"""Record that one workstream depends on another.
"""Record that one workstream depends on another workstream or task.
Semantics: from_workstream cannot fully proceed until to_workstream reaches
a satisfactory state.
Semantics: from_workstream cannot fully proceed until the target reaches
a satisfactory state. Provide exactly one of to_workstream_id or to_task_id.
Args:
from_workstream_id: UUID of the workstream that has the dependency
to_workstream_id: UUID of the workstream it depends on
to_task_id: UUID of the task it depends on
relationship_type: blocks | starts_after | informs | soft_dependency
description: optional human-readable explanation of the dependency
"""
dep = _post(f"/workstreams/{from_workstream_id}/dependencies", {
"to_workstream_id": to_workstream_id,
"to_task_id": to_task_id,
"relationship_type": relationship_type,
"description": description,
})
return json.dumps(dep, indent=2)
@@ -862,7 +874,7 @@ def list_dependencies(workstream_id: str) -> str:
"""
edges = _get(f"/workstreams/{workstream_id}/dependencies")
depends_on = [e for e in edges if e["from_workstream_id"] == workstream_id]
blocks = [e for e in edges if e["to_workstream_id"] == workstream_id]
blocks = [e for e in edges if e.get("to_workstream_id") == workstream_id]
return json.dumps({"depends_on": depends_on, "blocks": blocks}, indent=2)