fix: harden workflow analysis diagnostics

This commit is contained in:
gitea committed 2026-10-21 16:04:57 +08:00
1 parent 6ce83dd8a7
commit 88a0d97974
5 files changed
+83 -19

No files matched your search

+5 -1
View File
@@ -10,6 +10,10 @@ import { printJson, printTable, printKeyValue } from "../../printer.js";
import type { CliParsedArgs, CliResult, CliRuntime } from "../../types.js";
import { createWorkflowDetailClient } from "./shared.js";
export function isClientGoodOpened(item: { status?: string | null; onLineStatus?: string | null }): boolean {
return item.status?.toUpperCase() === "OPENED";
}
export async function handleAnalyze(parsed: CliParsedArgs, runtime: CliRuntime): Promise<CliResult> {
const pipelineId = parsed.args[0] || stringOption(parsed.options, ["id", "pipelineId"]);
if (!pipelineId) return { stdout: "", stderr: "用法: hose-use workflow analyze <pipelineId>\n", exitCode: 1 };
@@ -44,7 +48,7 @@ export async function handleAnalyze(parsed: CliParsedArgs, runtime: CliRuntime):
const goods = await fetchClientGoods(runtime.selectedCorp!, { isAll: true });
const codes = new Set<string>();
for (const item of goods) {
const isOpened = item.status?.toUpperCase() === "OPENED" || item.onLineStatus?.toUpperCase() === "ONLINE";
const isOpened = isClientGoodOpened(item);
if (isOpened && Array.isArray(item.powers)) {
for (const power of item.powers) {
if (typeof power === "string") {