Split diagram into separate workflow blocks. Returns list of (workflow_name, lines) tuples.
(diagram: str)
| 205 | |
| 206 | |
| 207 | def parse_workflows(diagram: str) -> List[Tuple[str, List[str]]]: |
| 208 | """Split diagram into separate workflow blocks. |
| 209 | |
| 210 | Returns list of (workflow_name, lines) tuples. |
| 211 | """ |
| 212 | workflows = [] |
| 213 | current_name = "Main Workflow" |
| 214 | current_lines = [] |
| 215 | |
| 216 | for line in diagram.strip().split("\n"): |
| 217 | line = line.strip() |
| 218 | |
| 219 | # New flowchart block |
| 220 | if line.startswith("flowchart"): |
| 221 | if current_lines: |
| 222 | workflows.append((current_name, current_lines)) |
| 223 | current_lines = [] |
| 224 | current_name = "Main Workflow" |
| 225 | continue |
| 226 | |
| 227 | # Workflow name comment |
| 228 | if line.startswith("%% Workflow:"): |
| 229 | current_name = line.replace("%% Workflow:", "").strip() |
| 230 | continue |
| 231 | |
| 232 | if line and not line.startswith("%%"): |
| 233 | current_lines.append(line) |
| 234 | |
| 235 | # Don't forget last workflow |
| 236 | if current_lines: |
| 237 | workflows.append((current_name, current_lines)) |
| 238 | |
| 239 | return workflows |
| 240 | |
| 241 | |
| 242 | def parse_flowchart(lines: List[str], metadata: Dict[str, Any]) -> Tuple[List[GraphNode], List[GraphEdge]]: |
no outgoing calls
no test coverage detected