批量收口 commands/agent/* 边界:全部改用 _cmd 便捷函数
- rule_service.py 新增 list_rules_cmd / get_rule_cmd / create_rule_cmd - services/__init__.py 导出以上三个 _cmd 函数 - commands/agent/ 下 8 个文件一律移除 `from ekb_cli.api import get_client`, 改为调用 services 层对应的 _cmd 函数(自管 client 生命周期) - 同步清理各文件中残留的局部 try/except EkbError,统一冒泡至全局 handler - 验证:commands/ 目录内已无任何 api 层直接引用
This commit is contained in:
1 parent
19f6c02c2c
commit
c87dfa52a5
10 files changed
+123
-122
No files matched your search
@@ -1,4 +1,7 @@
|
||||
"""ekb agent get <id>:查看 Agent 详情(表现层)"""
|
||||
"""ekb agent get <id>:查看 Agent 详情(表现层)
|
||||
|
||||
不导入 api 层;通过 services.get_agent_cmd 获取数据。
|
||||
"""
|
||||
|
||||
import typer
|
||||
from rich.console import Console
|
||||
@@ -6,8 +9,7 @@ from rich.panel import Panel
|
||||
from rich.table import Table
|
||||
from rich import print as rprint
|
||||
|
||||
from ekb_cli.api import get_client
|
||||
from ekb_cli.services import get_agent
|
||||
from ekb_cli.services import get_agent_cmd
|
||||
|
||||
console = Console()
|
||||
STATE_MAP = {0: "[dim]草稿[/dim]", 1: "[green]已发布[/green]"}
|
||||
@@ -22,8 +24,7 @@ def cmd_detail(
|
||||
full: bool = typer.Option(False, "--full", "-f", help="显示完整内容,不截断规则字段"),
|
||||
):
|
||||
"""查看 Agent 详情"""
|
||||
with get_client() as client:
|
||||
d = get_agent(client, agent_id)
|
||||
d = get_agent_cmd(agent_id)
|
||||
|
||||
state = STATE_MAP.get(d.state, str(d.state))
|
||||
mode = MODE_MAP.get(d.mode, str(d.mode))
|
||||
|
||||
Reference in new issue
Block a user