feat(workflow & platform): optimize complex workflow orchestration, code node debug summary, MVEL simulation and entity/feetype helpers

- feat(feetype): add --subtree and --ids-only flags to listFeeTypes for direct array export
- feat(platform): add platform gen-props command to generate MVEL/JS entity field constants and templates
- feat(workflow): show code node return value summaries in workflow test and job first screen
- feat(workflow): add workflow node map sub-command and --mapping-file for deep declarative field mutations
- feat(workflow): add executeMvelSandbox for local offline simulation of MVEL code nodes
- test: add comprehensive test cases across feetype, platform gen-props, node map, and MVEL sandbox

Closes #140
This commit is contained in:
gitea committed 2026-10-23 13:06:32 +08:00
1 parent 1739daacf2
commit ad771e92e0
18 files changed
+591 -29

No files matched your search

+2
View File
@@ -106,6 +106,7 @@ describe("CLI - feetype 费用类型管理命令", () => {
total: 3,
items: mockTree,
rawTree: mockTree,
ids: ["COST01", "COST02", "COST19"],
});
const res = await handleFeeTypeCommand(
@@ -134,6 +135,7 @@ describe("CLI - feetype 费用类型管理命令", () => {
total: 2,
items: mockTree,
rawTree: mockTree,
ids: ["COST01", "COST02"],
});
const jsonRuntime = { ...dummyRuntimeWithCorp, jsonMode: true };
+16 -4
View File
@@ -84,11 +84,15 @@ export async function handleFeeTypeCommand(
booleanOption(parsed.options, ["flat", "flatten", "table"]) || false;
const keyword =
stringOption(parsed.options, ["keyword", "q", "query"]) || parsed.args[0];
const subtree = stringOption(parsed.options, ["subtree", "subtree-id", "parent-id"]);
const idsOnly = booleanOption(parsed.options, ["ids-only", "ids"]) || false;
const result = await listFeeTypes(await getClient(), corpId, {
all: includeAll,
flat: isFlat,
flat: isFlat || Boolean(subtree) || idsOnly,
keyword,
subtreeParentId: subtree || undefined,
idsOnly,
});
if (runtime.jsonMode) {
@@ -100,7 +104,7 @@ export async function handleFeeTypeCommand(
total: result.total,
includeDisabled: includeAll,
keyword: keyword || null,
items: result.items,
...(idsOnly ? { ids: result.ids } : { items: result.items }),
},
runtime.outputOptions
),
@@ -109,8 +113,16 @@ export async function handleFeeTypeCommand(
};
}
if (idsOnly) {
return {
stdout: JSON.stringify(result.ids) + "\n",
stderr: "",
exitCode: 0,
};
}
let rows: (string | number)[][] = [];
if (!isFlat && !keyword) {
if (!isFlat && !keyword && !subtree) {
rows = renderTreeRows(result.rawTree);
} else {
const flatItems = (result.items as FlatFeeTypeItem[]) || [];
@@ -126,7 +138,7 @@ export async function handleFeeTypeCommand(
const title = `====== 费用类型列表 (企业: ${corp.name} | 共 ${result.total} 个${
includeAll ? ",含停用" : ""
}${keyword ? `,过滤: "${keyword}"` : ""}) ======`;
}${keyword ? `,过滤: "${keyword}"` : ""}${subtree ? `,子树: "${subtree}"` : ""}) ======`;
const tableStr = rows.length
? printTable(["#", "名称 / 层级路径", "编码", "ID", "状态", "子节点"], rows)
: "暂无匹配的费用类型";
+33
View File
@@ -525,5 +525,38 @@ describe("CLI - platform 命令与 record 动作", () => {
expect(fetch).not.toHaveBeenCalled();
expect(write).not.toHaveBeenCalled();
});
it("platform gen-props 生成 MVEL 和 JS 格式的字段模板", async () => {
spies.push(spyOn(helpers, "createClientsForCorp").mockResolvedValue({ ekbClient: {} } as any));
spies.push(spyOn(services, "resolvePlatform").mockResolvedValue(mockPlatform as any));
spies.push(spyOn(services, "resolveEntity").mockResolvedValue({
id: "E_contract",
name: "合同",
code: "CONTRACT",
fields: [
{ name: "E_contract_name", label: "合同名称", type: "text", optional: false },
{ name: "E_contract_amount", label: "合同金额", type: "money", optional: true },
],
} as any));
// MVEL 模板 (默认)
const mvelRes = await handlePlatformCommand(
{ area: "platform", action: "gen-props", args: ["platform-1", "contract"], options: {}, raw: [] },
dummyRuntime
);
expect(mvelRes.exitCode).toBe(0);
expect(mvelRes.stdout).toContain('String TARGET_ENTITY_ID = "E_contract";');
expect(mvelRes.stdout).toContain('String FIELD_合同名称 = FIELD_PREFIX + "name";');
expect(mvelRes.stdout).toContain('row.put(FIELD_合同名称, "");');
// JS 模板
const jsRes = await handlePlatformCommand(
{ area: "platform", action: "gen-props", args: ["platform-1", "contract"], options: { lang: "js" }, raw: [] },
dummyRuntime
);
expect(jsRes.exitCode).toBe(0);
expect(jsRes.stdout).toContain('const ENTITY_ID = "E_contract";');
expect(jsRes.stdout).toContain('"合同名称": FIELD_PREFIX + "name"');
});
});
+87
View File
@@ -122,3 +122,90 @@ export async function handleImports(parsed: CliParsedArgs, runtime: CliRuntime):
if (runtime.jsonMode) return { stdout: printJson(result, runtime.outputOptions), stderr: "", exitCode: 0 };
return { stdout: `====== 导入任务: ${resolved.platform.name} / ${resolved.entity.name} ======\n${printTable(["#", "任务"], jobs.map((job, i) => [i + 1, cell(job)]))}\n`, stderr: "", exitCode: 0 };
}
export async function handleGenProps(parsed: CliParsedArgs, runtime: CliRuntime): Promise<CliResult> {
const resolved = await resolveAppAndEntity(parsed, runtime);
if (!resolved.entity) {
throw new Error("请提供业务对象 ID、编码或名称: hose-use platform gen-props <应用> <业务对象> [--lang=mvel|js]");
}
const lang = (stringOption(parsed.options, ["lang", "language"]) || "mvel").toLowerCase();
const entity = resolved.entity;
const entityId = entity.id;
const entityName = entity.name;
const prefix = entityId ? `${entityId}_` : "";
if (runtime.jsonMode) {
return {
stdout: printJson(
{
platform: resolved.platform,
entity: {
id: entity.id,
name: entity.name,
code: entity.code,
prefix,
fields: entity.fields.map((f) => ({
fieldKey: f.name,
label: f.label,
type: f.type,
suffix: f.name.startsWith(prefix) ? f.name.slice(prefix.length) : f.name,
})),
},
},
runtime.outputOptions
),
stderr: "",
exitCode: 0,
};
}
const lines: string[] = [];
if (lang === "js" || lang === "javascript") {
lines.push(`// ====== 自建应用实体代码模板 [${entityName}] (JS / QuickJS) ======`);
lines.push(`const ENTITY_ID = "${entityId}";`);
lines.push(`const FIELD_PREFIX = "${prefix}";`);
lines.push("");
lines.push("// ── 字段物理键定义 ──");
lines.push("const FIELDS = {");
for (const f of entity.fields) {
const suffix = f.name.startsWith(prefix) ? f.name.slice(prefix.length) : f.name;
const safeLabel = f.label.replace(/"/g, '\\"');
lines.push(` "${safeLabel}": FIELD_PREFIX + "${suffix}", // ${f.type || "text"}${f.optional === false ? " [必填]" : ""}`);
}
lines.push("};");
lines.push("");
lines.push("// ── 写入数据对象示例 ──");
lines.push("const recordData = {");
for (const f of entity.fields) {
const safeLabel = f.label.replace(/"/g, '\\"');
lines.push(` [FIELDS["${safeLabel}"]]: "", // ${f.label}`);
}
lines.push("};");
} else {
// 默认 MVEL 模板
lines.push(`// ====== 自建应用实体代码模板 [${entityName}] (MVEL) ======`);
lines.push(`String TARGET_ENTITY_ID = "${entityId}";`);
lines.push(`String FIELD_PREFIX = "${prefix}";`);
lines.push("");
lines.push("// ── 物理字段键常量 ──");
for (const f of entity.fields) {
const suffix = f.name.startsWith(prefix) ? f.name.slice(prefix.length) : f.name;
const constName = `FIELD_${f.label.replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g, "_")}`;
lines.push(`String ${constName} = FIELD_PREFIX + "${suffix}"; // ${f.label} (${f.type || "text"})${f.optional === false ? " [必填]" : ""}`);
}
lines.push("");
lines.push("// ── DataLink 行构建模板 (row.put) ──");
lines.push("Map row = new HashMap();");
for (const f of entity.fields) {
const constName = `FIELD_${f.label.replace(/[^a-zA-Z0-9_\u4e00-\u9fa5]/g, "_")}`;
lines.push(`row.put(${constName}, ""); // ${f.label}`);
}
}
return {
stdout: `${lines.join("\n")}\n`,
stderr: "",
exitCode: 0,
};
}
+5 -2
View File
@@ -1,6 +1,6 @@
import { booleanOption } from "../../parser.js";
import type { CliParsedArgs, CliResult, CliRuntime } from "../../types.js";
import { handleList, handleGet, handleEntities, handleSchema, handlePermissions, handleImports } from "./app-info.js";
import { handleList, handleGet, handleEntities, handleSchema, handlePermissions, handleImports, handleGenProps } from "./app-info.js";
import { handleRecords, handleAudit } from "./records.js";
import { handleRecordAction } from "./record-actions.js";
@@ -47,9 +47,12 @@ export async function handlePlatformCommand(parsed: CliParsedArgs, runtime: CliR
case "permissions":
case "permission":
case "auth": return handlePermissions(parsed, runtime);
case "gen-props":
case "gen-mvel-props":
case "props": return handleGenProps(parsed, runtime);
case "imports":
case "import-jobs": return handleImports(parsed, runtime);
default:
return { stdout: "", stderr: `未知 platform 子命令: ${action}。支持: list, get, entities, schema, records, audit, record, permissions, imports\n`, exitCode: 1 };
return { stdout: "", stderr: `未知 platform 子命令: ${action}。支持: list, get, entities, schema, records, audit, record, gen-props, permissions, imports\n`, exitCode: 1 };
}
}
+36
View File
@@ -1656,6 +1656,42 @@ describe("CLI - workflow job 执行详情与异常精准透视", () => {
expect(editRes.exitCode).toBe(0);
expect(editRes.stdout).toContain("修改已保存至工作流");
// 5.1 node map
const mapRes = await handleWorkflowCommand(
{
area: "workflow",
action: "node",
args: ["map", "pipe_node_test", "action_js_1"],
options: { yes: true },
raw: ["workflow", "node", "map", "pipe_node_test", "action_js_1", "--yes"],
},
mockRuntime
);
expect(mapRes.exitCode).toBe(1);
expect(mapRes.stderr).toContain("请通过 --mapping-file=<路径> 指定");
const tmpMappingFile = (await import("os")).tmpdir() + "/test-fields-" + Date.now() + ".json";
await (await import("fs/promises")).writeFile(
tmpMappingFile,
JSON.stringify([{ name: "test_field", label: "测试字段", value: "test_val" }]),
"utf-8"
);
const mapSuccessRes = await handleWorkflowCommand(
{
area: "workflow",
action: "node",
args: ["map", "pipe_node_test", "action_js_1"],
options: { "mapping-file": tmpMappingFile, yes: true },
raw: ["workflow", "node", "map", "pipe_node_test", "action_js_1", `--mapping-file=${tmpMappingFile}`, "--yes"],
},
mockRuntime
);
expect(mapSuccessRes.exitCode).toBe(0);
expect(mapSuccessRes.stdout).toContain("已批量应用映射");
await (await import("fs/promises")).unlink(tmpMappingFile).catch(() => {});
// 6. node rm
const rmRes = await handleWorkflowCommand(
{
+6 -1
View File
@@ -17,7 +17,7 @@ import { stringOption, numberOption, booleanOption } from "../../parser.js";
import { createClientsForCorp, createPiperClientForCorp } from "../../helpers.js";
import { printJson, printTable, printKeyValue } from "../../printer.js";
import type { CliParsedArgs, CliResult, CliRuntime } from "../../types.js";
import { PLATFORM_ID_OPTION_KEYS } from "./shared.js";
import { PLATFORM_ID_OPTION_KEYS, extractCodeNodeSummaries, formatCodeNodeSummariesCard } from "./shared.js";
async function createJobPiperClient(
parsed: CliParsedArgs,
@@ -629,6 +629,11 @@ export async function handleJob(parsed: CliParsedArgs, runtime: CliRuntime): Pro
}
}
const codeSummaries = extractCodeNodeSummaries(tree, flattenExecutionTree);
if (codeSummaries.length > 0) {
outLines.push(...formatCodeNodeSummariesCard(codeSummaries, job.id));
}
return {
stdout: `${outLines.join("\n")}\n`,
stderr: "",
+103 -1
View File
@@ -6,6 +6,7 @@ import {
addWorkflowTask,
editWorkflowTask,
removeWorkflowTask,
applyNodeMapping,
getWorkflowAvailableNodes,
grantWorkflowNodes,
} from "../../../domains/platform/services.js";
@@ -20,7 +21,7 @@ import type { CliParsedArgs, CliResult, CliRuntime } from "../../types.js";
import { createPiperClientForCorp } from "../../helpers.js";
import { createWorkflowDetailClient } from "./shared.js";
const SUB_ACTIONS = new Set(["list", "ls", "get", "show", "info", "add", "append", "insert", "edit", "update", "set", "rm", "remove", "delete", "del"]);
const SUB_ACTIONS = new Set(["list", "ls", "get", "show", "info", "add", "append", "insert", "edit", "update", "set", "map", "rm", "remove", "delete", "del"]);
const CORP_LEVEL_ACTIONS = new Set(["available", "list-available", "catalog", "probe", "grant", "open"]);
export async function handleNodeCommand(
@@ -78,6 +79,7 @@ export async function handleNodeCommand(
" get <pipelineId> <节点标识> 查看指定节点的完整配置 (别名: show, info)",
" add <pipelineId> [选项] 声明式追加或插入新任务节点 (别名: append, insert)",
" edit <pipelineId> <节点标识> 定向修改指定节点配置 (别名: update, set)",
" map <pipelineId> <节点标识> 从映射文件批量更新深层字段 (别名: node map --mapping-file)",
" rm <pipelineId> <节点标识> 安全移除指定任务节点 (别名: remove, delete)",
"",
"子命令 (企业灰度节点级别):",
@@ -110,6 +112,8 @@ export async function handleNodeCommand(
case "update":
case "set":
return handleEditNode(pipelineId, nodeTarget, parsed, runtime);
case "map":
return handleMapNode(pipelineId, nodeTarget, parsed, runtime);
case "rm":
case "remove":
case "delete":
@@ -383,6 +387,14 @@ async function handleEditNode(
}
}
const mappingFile = stringOption(parsed.options, ["mapping-file", "mapping", "file", "json-file"]);
if (mappingFile) {
const fs = await import("fs/promises");
const rawContent = await fs.readFile(mappingFile, "utf-8");
const mappingData = JSON.parse(rawContent);
return handleMapNode(pipelineId, nodeTarget, parsed, runtime, mappingData);
}
requireMutationConfirmation(
parsed,
runtime,
@@ -436,6 +448,96 @@ async function handleEditNode(
};
}
async function handleMapNode(
pipelineId: string,
nodeTarget: string,
parsed: CliParsedArgs,
runtime: CliRuntime,
injectedMappingData?: any
): Promise<CliResult> {
if (!nodeTarget) {
return {
stdout: "",
stderr: [
"请提供目标节点标识 (name 或层级序号): hose-use workflow node map <pipelineId> <nodeNameOrIndex> --mapping-file=<path> [选项]",
"",
"常用选项:",
" --mapping-file=<路径> 包含字段映射的本地 JSON 文件 (可为字段数组或属性对象)",
" --dry-run 只预览变更",
" --yes 确认保存修改",
"",
"示例:",
" hose-use workflow node map 900682164608835609 action_datalink_create --mapping-file=./fields.json --yes",
].join("\n") + "\n",
exitCode: 1,
};
}
let mappingData = injectedMappingData;
if (!mappingData) {
const mappingFile = stringOption(parsed.options, ["mapping-file", "mapping", "file", "json-file"]);
if (!mappingFile) {
return {
stdout: "",
stderr: "错误: 请通过 --mapping-file=<路径> 指定本地字段映射 JSON 文件\n",
exitCode: 1,
};
}
const fs = await import("fs/promises");
try {
const content = await fs.readFile(mappingFile, "utf-8");
mappingData = JSON.parse(content);
} catch (e: any) {
return {
stdout: "",
stderr: `错误: 读取或解析映射文件失败: ${e.message}\n`,
exitCode: 1,
};
}
}
requireMutationConfirmation(
parsed,
runtime,
"批量映射工作流节点配置",
`hose-use workflow node map ${pipelineId} ${nodeTarget} --yes`
);
const { client } = await createWorkflowDetailClient(parsed, runtime, pipelineId);
const detail = await getWorkflowDetail(client, pipelineId);
const { workflow: updatedWorkflow, editedTask, changedKeys } = applyNodeMapping(detail, nodeTarget, mappingData);
if (isDryRun(parsed, runtime)) {
return mutationPreview(parsed, runtime, "批量映射工作流节点配置", `${pipelineId}:${editedTask.name}`, {
pipelineId,
nodeName: editedTask.name,
label: editedTask.label,
nodeType: editedTask.type,
changedKeys,
mappingSummary: Array.isArray(mappingData)
? `数组格式更新 (${mappingData.length} 项)`
: `对象属性更新 (${Object.keys(mappingData).join(", ")})`,
});
}
const saveResult = await updateWorkflow(client, updatedWorkflow);
if (runtime.jsonMode) {
return {
stdout: printJson({ success: true, pipelineId, editedTask, changedKeys, workflow: saveResult }, runtime.outputOptions),
stderr: "",
exitCode: 0,
};
}
return {
stdout: `✅ 节点 [${editedTask.name}] (${editedTask.label}) 已批量应用映射: ${changedKeys.join(", ")},并已保存至工作流 [${pipelineId}]。\n`,
stderr: "",
exitCode: 0,
};
}
async function handleRemoveNode(
pipelineId: string,
nodeTarget: string,
+11 -14
View File
@@ -7,6 +7,7 @@ import {
lintJavaScriptCode,
lintMvelCode,
executeJavaScriptSandbox,
executeMvelSandbox,
} from "../../../domains/platform/services.js";
import { stringOption, booleanOption } from "../../parser.js";
import { printJson, printKeyValue } from "../../printer.js";
@@ -196,6 +197,8 @@ export async function handleWorkflowEvalScript(
const codeInline = stringOption(parsed.options, ["code"]);
const timeoutStr = stringOption(parsed.options, ["timeout"]);
const timeoutMs = timeoutStr ? parseInt(timeoutStr, 10) : 3000;
const explicitType = (stringOption(parsed.options, ["type"]) || "").toLowerCase();
const isMvel = explicitType === "code" || explicitType === "mvel" || (filePath ? filePath.endsWith(".mvel") : false);
// 1. 获取输入参数 inputs
let inputs: Record<string, unknown> = {};
@@ -245,7 +248,9 @@ export async function handleWorkflowEvalScript(
code = fs.readFileSync(filePath, "utf-8");
}
const evalResult = await executeJavaScriptSandbox(code, inputs, { timeoutMs });
const evalResult = isMvel
? await executeMvelSandbox(code, inputs, { timeoutMs })
: await executeJavaScriptSandbox(code, inputs, { timeoutMs });
if (isJson) {
return { stdout: printJson(evalResult, runtime.outputOptions), stderr: "", exitCode: evalResult.success ? 0 : 1 };
@@ -296,18 +301,7 @@ export async function handleWorkflowEvalScript(
}
const task = located.task;
if (task.type !== "code-js2") {
if (task.type === "code") {
return {
stdout: "",
stderr: [
`节点 [${task.name}] 是 MVEL (code) 节点。`,
"当前本地离线沙箱仅支持 JavaScript (code-js2) 运行时仿真。",
"提示: 您可以使用 hose-use workflow lint-script 检查其括号与上游引用,或使用 hose-use workflow test 进行全链路调试。",
].join("\n") + "\n",
exitCode: 1,
};
}
if (task.type !== "code-js2" && task.type !== "code") {
return {
stdout: "",
stderr: `节点 [${task.name}] 不是代码节点,类型为: ${task.type}\n`,
@@ -316,6 +310,7 @@ export async function handleWorkflowEvalScript(
}
const code: string = (task as any).code || "";
const isNodeMvel = task.type === "code";
// 如果没有显式传 input,尝试提取工作流样本数据
if (Object.keys(inputs).length === 0) {
@@ -352,7 +347,9 @@ export async function handleWorkflowEvalScript(
}
}
const evalResult = await executeJavaScriptSandbox(code, inputs, { timeoutMs });
const evalResult = isNodeMvel
? await executeMvelSandbox(code, inputs, { timeoutMs })
: await executeJavaScriptSandbox(code, inputs, { timeoutMs });
if (isJson) {
return { stdout: printJson(evalResult, runtime.outputOptions), stderr: "", exitCode: evalResult.success ? 0 : 1 };
+102
View File
@@ -56,3 +56,105 @@ export async function createJobPiperClient(
}
return clients.easoClient;
}
export interface CodeNodeSummary {
id: string;
name: string;
label: string;
type: string;
status: string;
rawOutput: unknown;
summaryLines: string[];
}
export function extractCodeNodeSummaries(
nodes: Array<any>,
flattenExecutionTreeFn?: (nodes: any[]) => any[]
): CodeNodeSummary[] {
const flattened = flattenExecutionTreeFn ? flattenExecutionTreeFn(nodes) : nodes;
const summaries: CodeNodeSummary[] = [];
for (const node of flattened) {
if (!node) continue;
const type = String(node.type || "");
if (type !== "code" && type !== "code-js2") continue;
const rawOutput = node.output ?? node.outputs ?? node.details;
const summaryLines: string[] = [];
if (rawOutput === undefined || rawOutput === null) {
summaryLines.push(" 出参: (无返回值或 null)");
} else if (Array.isArray(rawOutput)) {
summaryLines.push(` 出参类型: Array (${rawOutput.length} 项)`);
if (rawOutput.length > 0) {
const first = rawOutput[0];
if (first && typeof first === "object") {
const keys = ["planCode", "code", "id", "name", "title", "totalAmount", "amount"];
const matchedKey = keys.find((k) => (first as Record<string, unknown>)[k] !== undefined);
if (matchedKey) {
summaryLines.push(` 首项 ${matchedKey}: ${String((first as Record<string, unknown>)[matchedKey])}`);
}
if ((first as any).amount !== undefined && matchedKey !== "amount") {
summaryLines.push(` 首项金额: ${String((first as any).amount)}`);
}
} else {
summaryLines.push(` 首项值: ${String(first)}`);
}
}
} else if (typeof rawOutput === "object") {
const obj = rawOutput as Record<string, unknown>;
summaryLines.push(" 出参类型: Object");
if (Array.isArray(obj.items)) {
summaryLines.push(` items.length: ${obj.items.length}`);
}
for (const k of ["planCode", "totalAmount", "count", "code", "total", "amount", "success"]) {
if (obj[k] !== undefined) {
summaryLines.push(` ${k}: ${String(obj[k])}`);
}
}
const allKeys = Object.keys(obj);
if (summaryLines.length === 1 && allKeys.length > 0) {
summaryLines.push(` 字段列表 (${allKeys.length} 个): ${allKeys.slice(0, 5).join(", ")}${allKeys.length > 5 ? "..." : ""}`);
}
} else {
summaryLines.push(` 出参值: ${String(rawOutput)}`);
}
summaries.push({
id: node.id || "-",
name: node.name || "-",
label: node.label || node.displayName || (type === "code" ? "MVEL代码节点" : "JS代码节点"),
type,
status: node.status || "UNKNOWN",
rawOutput,
summaryLines,
});
}
return summaries;
}
export function formatCodeNodeSummariesCard(
summaries: CodeNodeSummary[],
jobId?: string
): string[] {
if (summaries.length === 0) return [];
const lines: string[] = [
"",
"── 🧮 核心代码节点出参即时摘要 (Code Return Values) ──",
];
for (const s of summaries) {
const statusIcon = s.status === "COMPLETED" || s.status === "SUCCESS" ? "✅" : s.status === "FAILED" ? "❌" : "⏳";
lines.push(` ${statusIcon} [${s.name}] ${s.label} (${s.type}, 状态: ${s.status})`);
for (const l of s.summaryLines) {
lines.push(` ${l}`);
}
if (jobId) {
lines.push(` ↳ 完整出参查看: hose-use workflow job ${jobId} --node=${s.name} --full`);
}
}
return lines;
}
+6 -1
View File
@@ -11,7 +11,7 @@ import {
import { stringOption, booleanOption, numberOption } from "../../parser.js";
import { printJson, printTable, printKeyValue } from "../../printer.js";
import type { CliParsedArgs, CliResult, CliRuntime } from "../../types.js";
import { createWorkflowDetailClient } from "./shared.js";
import { createWorkflowDetailClient, extractCodeNodeSummaries, formatCodeNodeSummariesCard } from "./shared.js";
import { isDryRun, mutationPreview, requireMutationConfirmation } from "../../mutation.js";
export async function handleWorkflowTest(
@@ -484,6 +484,11 @@ export async function handleWorkflowTest(
}
}
const codeSummaries = extractCodeNodeSummaries(report.executionTree);
if (codeSummaries.length > 0) {
outLines.push(...formatCodeNodeSummariesCard(codeSummaries, report.jobId));
}
return {
stdout: `${outLines.join("\n")}\n`,
stderr: "",