Files
hose-use/src/ekb_cli/commands/platform/workflow_search.py
T
gitea 760c04be00 feat(platform): 服务层跨应用聚合查询,新增按节点类型筛选工作流
- 新增 list_all_workflows / find_workflows_by_task_type 及其 _cmd 变体
- CLI 新增 workflow-search <task_type> 命令(--all 含停用)
- HTTP 新增 GET /platforms/workflows?task_type=http&enabled_only=true
- 修复 workflow_service.py 中重复定义的函数
2026-04-20 16:50:56 +08:00

43 lines
1.4 KiB
Python

"""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)