Show teams in the workflow mermaid graph

This commit is contained in:
Ian Gulliver
2026-10-21 12:09:33 -07:00
parent 36d6636220
commit 9ab1c0d079
3 changed files with 80 additions and 25 deletions
+7
View File
@@ -92,6 +92,12 @@ private func newStage(_ root: StepNode, _ model: String) -> StepNode {
return s
}
func teamNodes(_ id: String, _ agents: [TeamMember]?, stroke: Color?) -> [FlowNode] {
(agents ?? []).enumerated().map { i, a in
FlowNode(id: "\(id)m\(i)", label: "\(a.name.isEmpty ? " " : a.name)\n\(a.model)", style: NodeColors(fill: Palette.bg, stroke: stroke, text: Palette.text))
}
}
@MainActor
private func stepGraph(_ root: StepNode) -> Flowchart {
var chart = Flowchart(direction: .td)
@@ -104,6 +110,7 @@ private func stepGraph(_ root: StepNode) -> Flowchart {
case .stage:
let id = "n\(chart.order.count)"
chart.node(id, label: node.name.isEmpty ? " " : node.name, shape: .box)
chart.nodes[id]!.members = teamNodes(id, node.agents, stroke: nil)
for b in before {
chart.edges.append(FlowEdge(from: b, to: id, label: nil, style: .solid, arrow: true))
}