"""ekb platform workflow-search:跨所有自建应用查找含指定节点类型的工作流""" import typer from rich.console import Console from rich.table import Table from rich import print as rprint from ekb_cli.services.platform import find_workflows_by_task_type_cmd console = Console() def cmd_workflow_search( task_type: str = typer.Argument(..., help="节点类型,如 http / ekuaibao-ebot-trigger / stop"), all_states: bool = typer.Option(False, "--all", "-a", help="包含已停用的工作流(默认只查启用)"), ): """跨所有自建应用,查找含指定节点类型的工作流""" enabled_only = not all_states matches = find_workflows_by_task_type_cmd(task_type, enabled_only=enabled_only) if not matches: rprint(f"[yellow]未找到含 [bold]{task_type}[/bold] 节点的工作流[/yellow]") return table = Table( title=f"含 {task_type} 节点的工作流(共 {len(matches)} 个)", show_lines=True, ) table.add_column("自建应用", style="cyan") table.add_column("工作流名称") table.add_column("工作流 ID", style="dim") table.add_column("节点数", justify="center", style="bold yellow") for m in matches: table.add_row( m.platform_name, m.workflow_name, m.workflow_id, str(len(m.matched_tasks)), ) console.print(table)