From 596b5d8916fa67b7bea9dd7122cffdbf5a920935 Mon Sep 17 00:00:00 2001 From: pikastech Date: Tue, 21 Jul 2026 02:35:08 +0200 Subject: [PATCH] feat: expose aggregate Workbench L1 status --- .agents/skills/unidesk-devlevel/SKILL.md | 4 +++- scripts/src/hwlab-native-development.ts | 19 +++++++++++++++++++ scripts/src/hwlab-node-help.ts | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.agents/skills/unidesk-devlevel/SKILL.md b/.agents/skills/unidesk-devlevel/SKILL.md index e884844d..437d6592 100644 --- a/.agents/skills/unidesk-devlevel/SKILL.md +++ b/.agents/skills/unidesk-devlevel/SKILL.md @@ -76,7 +76,9 @@ description: >- - 通过项目 lifecycle 启动的 L1 服务在测试和验收后默认保持运行: - 只有用户明确要求停止或清理时才执行 stop; - 一次性 disposable smoke 可以按自身隔离合同清理,但不能替代可持续访问的 L1 服务; - - 任务结束前必须重新读取 lifecycle status,不能凭启动返回值推断服务仍在运行。 + - 任务结束前必须重新读取 lifecycle status,不能凭启动返回值推断服务仍在运行; + - 多服务 L1 必须优先使用项目 CLI 的聚合 status,一次返回 API、Worker 和 Web 状态,禁止由调用方逐个查询后人工拼接结论; + - 项目暂缺聚合 status 时,应在当前任务内补齐该 CLI 能力,不能把逐服务查询固化为长期验收流程。 - CLI 显式使用项目 native `--over-api` transport,经 native API 调用 Worker。 - Web 使用 `$unidesk-webdev` 的受控入口访问 owning YAML 固定端口上的 native Web。 - 微服务项目只启动当前微服务的前端、API、Worker及必要依赖。 diff --git a/scripts/src/hwlab-native-development.ts b/scripts/src/hwlab-native-development.ts index 55ab8a10..7b7b3d1a 100644 --- a/scripts/src/hwlab-native-development.ts +++ b/scripts/src/hwlab-native-development.ts @@ -14,6 +14,7 @@ export function hwlabNativeDevelopmentHelp(): Record { ok: true, command: "hwlab nodes native-development workbench", usage: [ + "bun scripts/cli.ts hwlab nodes native-development workbench status --node --lane ", "bun scripts/cli.ts hwlab nodes native-development workbench api|worker|web start|stop|restart|status|logs --node --lane ", "bun scripts/cli.ts hwlab nodes native-development workbench cli --node --lane ", "bun scripts/cli.ts hwlab nodes native-development hwpod api|worker|web start|stop|restart|status|logs --node --lane ", @@ -58,6 +59,24 @@ export function runHwlabNativeDevelopmentCommand(args: string[]): Record 0) throw new Error(`native-development workbench status does not accept positional arguments: ${remaining.join(" ")}`); + const command = ["bun", "tools/hwlab-cli/bin/hwlab-cli.ts", "workbench", "service", "status"]; + const result = runCommand(command, spec.workspace, { timeoutMs: 15_000, env: { ...process.env, ...env } }); + const payload = parsePayload(result.stdout); + return { + ok: result.exitCode === 0 && payload.ok !== false, + command: "hwlab nodes native-development workbench status", + node, + lane, + action: "status", + configSource: `${hwlabRuntimeLaneConfigPath()}#lanes.${lane}.targets.${node}.nativeDevelopment.workbench`, + userEndpoint: { url: `${native.publicExposure.publicBaseUrl}/workbench` }, + serviceResult: payload, + ...(result.exitCode === 0 ? {} : { error: { code: "hwlab_native_cli_failed", exitCode: result.exitCode, stderr: result.stderr.trim().slice(-2000) } }), + }; + } const service = parseService(serviceRaw, application); const action = parseAction(actionRaw); const command = ["bun", "tools/hwlab-cli/bin/hwlab-cli.ts", application, "service", service, action]; diff --git a/scripts/src/hwlab-node-help.ts b/scripts/src/hwlab-node-help.ts index 60ada7ae..a088ff32 100644 --- a/scripts/src/hwlab-node-help.ts +++ b/scripts/src/hwlab-node-help.ts @@ -49,7 +49,7 @@ export function hwlabNodeHelp(scope: "legacy-cicd" | "platform-maintenance" | nu "bun scripts/cli.ts hwlab nodes hwpod-preinstall plan --node --lane --dry-run", "bun scripts/cli.ts hwlab nodes hwpod-node plan --node G14-WSL --lane v03", "bun scripts/cli.ts hwlab nodes fake-model-provider plan --node D518 --lane v03 --provider fake-echo", - "bun scripts/cli.ts hwlab nodes native-development workbench web status --node --lane ", + "bun scripts/cli.ts hwlab nodes native-development workbench status --node --lane ", "bun scripts/cli.ts hwlab nodes native-development caserun api status --node --lane ", "bun scripts/cli.ts hwlab nodes secret status --node --lane --name ", "bun scripts/cli.ts hwlab nodes test-accounts status --node --lane ",