@fieldwangai/agentflow 0.1.153 → 0.1.156
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -34
- package/README.zh-CN.md +14 -34
- package/agents/agentflow-node-executor-code.md +13 -3
- package/agents/agentflow-node-executor-planning.md +13 -3
- package/agents/agentflow-node-executor-requirement.md +13 -3
- package/agents/agentflow-node-executor-test.md +13 -3
- package/agents/agentflow-node-executor-ui.md +13 -3
- package/agents/agentflow-node-executor.md +13 -3
- package/agents/en/agentflow-node-executor.md +13 -3
- package/agents/zh/agentflow-node-executor.md +13 -3
- package/bin/agentflow.mjs +3 -3
- package/bin/lib/admin-builtin-pipelines.mjs +3 -2
- package/bin/lib/agent-runners.mjs +0 -929
- package/bin/lib/auth.mjs +2 -1
- package/bin/lib/catalog-agents.mjs +2 -1
- package/bin/lib/catalog-flows.mjs +165 -90
- package/bin/lib/composer-agent.mjs +3 -793
- package/bin/lib/composer-skill-router.mjs +3 -323
- package/bin/lib/exec-buffered.mjs +32 -0
- package/bin/lib/flow-dsl/cli.mjs +277 -0
- package/bin/lib/flow-dsl/codegen.mjs +358 -0
- package/bin/lib/flow-dsl/defs.mjs +103 -0
- package/bin/lib/flow-dsl/index.mjs +77 -0
- package/bin/lib/flow-dsl/ir.mjs +305 -0
- package/bin/lib/flow-dsl/layout.mjs +115 -0
- package/bin/lib/flow-dsl/legacy-yaml.mjs +303 -0
- package/bin/lib/flow-dsl/lint.mjs +241 -0
- package/bin/lib/flow-dsl/packages.mjs +251 -0
- package/bin/lib/flow-dsl/parser.mjs +444 -0
- package/bin/lib/flow-import.mjs +96 -26
- package/bin/lib/flow-write.mjs +48 -12
- package/bin/lib/help.mjs +8 -28
- package/bin/lib/html-escape.mjs +19 -0
- package/bin/lib/http-util.mjs +49 -0
- package/bin/lib/legacy-flow-execution.mjs +37 -0
- package/bin/lib/locales/en.json +1 -1
- package/bin/lib/locales/zh.json +1 -1
- package/bin/lib/main.mjs +152 -286
- package/bin/lib/marketplace.mjs +206 -61
- package/bin/lib/model-config.mjs +10 -0
- package/bin/lib/node-package-archive.mjs +240 -0
- package/bin/lib/node-package-bootstrap.mjs +72 -0
- package/bin/lib/node-package-manifest.mjs +174 -0
- package/bin/lib/paths.mjs +42 -19
- package/bin/lib/prd-workflow-routes.mjs +2949 -0
- package/bin/lib/prd-workflow-server.mjs +4884 -0
- package/bin/lib/run-events.mjs +0 -66
- package/bin/lib/schedule-config.mjs +4 -4
- package/bin/lib/skill-runtime.mjs +35 -0
- package/bin/lib/startup-storage-migrations.mjs +274 -0
- package/bin/lib/ui-server.mjs +1092 -18123
- package/bin/lib/user-env.mjs +16 -0
- package/bin/lib/workspace-auto-layout.mjs +234 -0
- package/bin/lib/workspace-flow-store.mjs +478 -0
- package/bin/lib/workspace-graph-merge.mjs +41 -34
- package/bin/lib/workspace-preview.mjs +12 -2
- package/bin/lib/workspace-routes.mjs +3088 -0
- package/bin/lib/workspace-server.mjs +6199 -0
- package/bin/lib/workspace-state.mjs +331 -0
- package/bin/lib/workspace.mjs +2 -1
- package/builtin/nodes/agent_subAgent.md +1 -0
- package/builtin/nodes/control_agent_toBool.md +2 -0
- package/builtin/nodes/control_anyOne.md +2 -0
- package/builtin/nodes/control_cancelled.md +2 -0
- package/builtin/nodes/control_cd_workspace.md +5 -11
- package/builtin/nodes/control_delay.md +2 -0
- package/builtin/nodes/control_end.md +2 -0
- package/builtin/nodes/control_if.md +1 -0
- package/builtin/nodes/control_interval_loop.md +2 -0
- package/builtin/nodes/control_load_mcp.md +24 -0
- package/builtin/nodes/control_load_skills.md +8 -23
- package/builtin/nodes/control_start.md +2 -0
- package/builtin/nodes/control_toBool.md +2 -0
- package/builtin/nodes/control_user_workspace.md +2 -0
- package/builtin/nodes/control_wait_until.md +2 -0
- package/builtin/nodes/display_ascii.md +1 -0
- package/builtin/nodes/display_chart.md +1 -0
- package/builtin/nodes/display_html.md +1 -0
- package/builtin/nodes/display_image.md +1 -0
- package/builtin/nodes/display_markdown.md +1 -0
- package/builtin/nodes/display_mermaid.md +1 -0
- package/builtin/nodes/display_react_app.md +1 -0
- package/builtin/nodes/display_table.md +1 -0
- package/builtin/nodes/provide_bool.md +1 -0
- package/builtin/nodes/provide_file.md +1 -0
- package/builtin/nodes/provide_password.md +1 -0
- package/builtin/nodes/provide_str.md +1 -0
- package/builtin/nodes/tool_display_share_link.md +1 -0
- package/builtin/nodes/tool_get_env.md +2 -0
- package/builtin/nodes/tool_git_checkout.md +1 -0
- package/builtin/nodes/tool_git_worktree_load.md +1 -0
- package/builtin/nodes/tool_git_worktree_unload.md +1 -0
- package/builtin/nodes/tool_gitlab_create_mr.md +1 -0
- package/builtin/nodes/tool_jenkins_build.md +2 -0
- package/builtin/nodes/tool_load_key.md +2 -0
- package/builtin/nodes/tool_nodejs.md +17 -19
- package/builtin/nodes/tool_print.md +2 -0
- package/builtin/nodes/tool_save_key.md +2 -0
- package/builtin/nodes/tool_set_run_env.md +1 -0
- package/builtin/nodes/tool_user_ask.md +2 -0
- package/builtin/nodes/tool_user_check.md +2 -0
- package/builtin/nodes/tool_wecom_send_app_markdown.md +1 -0
- package/builtin/nodes/tool_wecom_send_group_markdown.md +1 -0
- package/builtin/nodes/workspace_one_click_task.md +44 -0
- package/builtin/nodes/workspace_run.md +16 -0
- package/builtin/nodes/workspace_scheduled_run.md +16 -0
- package/builtin/pipelines/module-migrate/scripts/gate.mjs +37 -0
- package/builtin/pipelines/module-migrate/scripts/static-check.mjs +82 -0
- package/builtin/pipelines/module-migrate/workspace.flow.js +172 -0
- package/builtin/pipelines/module-migrate/workspace.layout.json +134 -0
- package/builtin/pipelines/new/scripts/lint-flow.mjs +38 -0
- package/builtin/pipelines/new/workspace.flow.js +91 -0
- package/builtin/pipelines/new/workspace.layout.json +70 -0
- package/builtin/web-ui/dist/assets/{WorkflowAssistantThread-B9xslwI0.js → WorkflowAssistantThread-ClNxY2Wu.js} +1 -1
- package/builtin/web-ui/dist/assets/index-BJzMYRK3.js +870 -0
- package/builtin/web-ui/dist/assets/index-CEXmmwM2.css +1 -0
- package/builtin/web-ui/dist/index.html +2 -2
- package/package.json +3 -1
- package/reference/flow-control-capabilities.md +77 -158
- package/reference/flow-layout.md +1 -1
- package/reference/flow-prompt-handler-check.md +2 -2
- package/skills/agentflow-author-flow/SKILL.md +1 -1
- package/skills/agentflow-cli/SKILL.md +139 -24
- package/skills/agentflow-cli/agents/openai.yaml +2 -2
- package/skills/agentflow-cli/scripts/agentflow-cli.mjs +654 -20
- package/skills/agentflow-cli/scripts/agentflow-runtime.mjs +97 -0
- package/skills/agentflow-flow-add-instances/SKILL.md +1 -1
- package/skills/agentflow-flow-dsl/SKILL.md +206 -0
- package/skills/agentflow-flow-dsl/agents/openai.yaml +4 -0
- package/skills/agentflow-flow-dsl/references/node-calls.md +39 -0
- package/skills/agentflow-flow-edit-node-fields/SKILL.md +1 -1
- package/skills/agentflow-flow-recipes/SKILL.md +7 -4
- package/skills/agentflow-flow-recipes/references/recipes.md +97 -43
- package/skills/agentflow-flow-sync-ui/SKILL.md +1 -1
- package/skills/agentflow-node-dsl/SKILL.md +212 -0
- package/skills/agentflow-node-dsl/agents/openai.yaml +4 -0
- package/skills/agentflow-node-reference/SKILL.md +2 -2
- package/skills/agentflow-node-reference/references/builtin-nodes.md +166 -115
- package/skills/agentflow-runtime-reference/references/runtime.md +1 -1
- package/skills/agentflow-workspace-ascii/SKILL.md +9 -16
- package/skills/agentflow-workspace-graph/SKILL.md +62 -48
- package/skills/agentflow-workspace-html/SKILL.md +7 -2
- package/skills/agentflow-workspace-image/SKILL.md +6 -2
- package/skills/agentflow-workspace-markdown/SKILL.md +14 -21
- package/skills/agentflow-workspace-mermaid/SKILL.md +8 -16
- package/bin/lib/api-runner.mjs +0 -387
- package/bin/lib/apply.mjs +0 -903
- package/bin/lib/composer-flow-instances.mjs +0 -68
- package/bin/lib/composer-flow-skeleton.mjs +0 -334
- package/bin/lib/composer-flow-validate.mjs +0 -47
- package/bin/lib/composer-model-router.mjs +0 -185
- package/bin/lib/composer-node-schema.mjs +0 -303
- package/bin/lib/composer-planner.mjs +0 -751
- package/bin/lib/composer-script-ops.mjs +0 -233
- package/bin/lib/flow-static-preview.mjs +0 -104
- package/bin/lib/hub-login.mjs +0 -54
- package/bin/lib/hub-publish.mjs +0 -159
- package/bin/lib/hub-remote.mjs +0 -189
- package/bin/lib/hub.mjs +0 -299
- package/bin/lib/jenkins.mjs +0 -380
- package/bin/lib/node-execute.mjs +0 -539
- package/bin/lib/normalize-node-tool-command.mjs +0 -97
- package/bin/lib/runtime-context.mjs +0 -243
- package/bin/lib/scheduler.mjs +0 -601
- package/bin/lib/ui-print.mjs +0 -94
- package/bin/pipeline/build-node-prompt.mjs +0 -271
- package/bin/pipeline/check-cache.mjs +0 -191
- package/bin/pipeline/check-flow.mjs +0 -543
- package/bin/pipeline/collect-nodes.mjs +0 -212
- package/bin/pipeline/compute-cache-md5.mjs +0 -177
- package/bin/pipeline/ensure-run-dir.mjs +0 -71
- package/bin/pipeline/gc.mjs +0 -129
- package/bin/pipeline/get-env.mjs +0 -59
- package/bin/pipeline/get-resolved-values.mjs +0 -344
- package/bin/pipeline/load-key.mjs +0 -62
- package/bin/pipeline/parse-flow.mjs +0 -708
- package/bin/pipeline/post-process-control-if.mjs +0 -23
- package/bin/pipeline/post-process-node.mjs +0 -490
- package/bin/pipeline/pre-process-node.mjs +0 -1430
- package/bin/pipeline/resolve-inputs.mjs +0 -201
- package/bin/pipeline/run-tool-nodejs.mjs +0 -167
- package/bin/pipeline/save-key.mjs +0 -93
- package/bin/pipeline/snapshot-prior-round.mjs +0 -70
- package/bin/pipeline/validate-for-ui.mjs +0 -234
- package/bin/pipeline/validate-script-output.mjs +0 -130
- package/bin/pipeline/write-result.mjs +0 -182
- package/builtin/pipelines/module-migrate/flow.yaml +0 -819
- package/builtin/pipelines/new/flow.yaml +0 -545
- package/builtin/pipelines/new/scripts/check-flow.mjs +0 -9
- package/builtin/pipelines/new/scripts/collect-nodes.mjs +0 -211
- package/builtin/web-ui/dist/assets/index-DZ328oSo.css +0 -1
- package/builtin/web-ui/dist/assets/index-DmUV7ZCL.js +0 -888
- package/skills/agentflow-node-authoring/SKILL.md +0 -57
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* 收集所有节点(内置 + 当前流水线)的元数据,按 tool_nodejs 约定向 stdout 输出一行 JSON。
|
|
4
|
-
* 用法:agentflow apply -ai collect-nodes <workspaceRoot> <flowName> [runDir]
|
|
5
|
-
* 输出(仅 stdout 一行):{ "err_code": 0, "message": { "result": "<节点元数据 markdown>" } };err_code 0=成功 1=失败,无 next。
|
|
6
|
-
* 不写任何文件,由 agentflow apply -ai run-tool-nodejs 根据 message 写入 output。
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import fs from "fs";
|
|
10
|
-
import path from "path";
|
|
11
|
-
import { fileURLToPath } from "url";
|
|
12
|
-
import yaml from "js-yaml";
|
|
13
|
-
import { LEGACY_NODES_DIR, PIPELINES_DIR, PROJECT_NODES_DIR } from "../../../../bin/lib/paths.mjs";
|
|
14
|
-
import { getFlowDir } from "../../../../bin/lib/workspace.mjs";
|
|
15
|
-
|
|
16
|
-
const __dirnameScript = path.dirname(fileURLToPath(import.meta.url));
|
|
17
|
-
const PACKAGE_BUILTIN_NODES_DIR = path.join(path.resolve(__dirnameScript, "..", "..", ".."), "nodes");
|
|
18
|
-
|
|
19
|
-
function extractFrontmatter(raw) {
|
|
20
|
-
const m = raw.match(/^---\s*\n([\s\S]*?)\n---/);
|
|
21
|
-
return m ? m[1] : "";
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function parseDescription(fm) {
|
|
25
|
-
const match = fm.match(/\bdescription:\s*["']?([^"'\n#][^\n]*)["']?/);
|
|
26
|
-
return match ? match[1].trim().replace(/^["']|["']$/g, "") : "";
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function parseDisplayName(fm) {
|
|
30
|
-
const match = fm.match(/\bdisplayName:\s*["']?([^"'\n#][^\n]*)["']?/);
|
|
31
|
-
return match ? match[1].trim().replace(/^["']|["']$/g, "") : "";
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/** 解析 frontmatter 中的 input/output 数组,返回 [{ type, name, defaultOrValue }, ...] */
|
|
35
|
-
function parseSlots(fm, key) {
|
|
36
|
-
const slots = [];
|
|
37
|
-
const re = new RegExp(`\\b${key}:\\s*\\n([\\s\\S]*?)(?=\\n[a-zA-Z_][a-zA-Z0-9_]*\\s*:|---|$)`, "m");
|
|
38
|
-
const blockMatch = fm.match(re);
|
|
39
|
-
if (!blockMatch) return slots;
|
|
40
|
-
const block = blockMatch[1];
|
|
41
|
-
let current = {};
|
|
42
|
-
for (const line of block.split("\n")) {
|
|
43
|
-
const typeMatch = line.match(/^\s*-\s+type:\s*["']?([^"'\n]*)["']?/);
|
|
44
|
-
if (typeMatch) {
|
|
45
|
-
if (current.type) slots.push({ ...current });
|
|
46
|
-
current = { type: typeMatch[1].trim() };
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
const nameMatch = line.match(/^\s+name:\s*["']?([^"'\n]*)["']?/);
|
|
50
|
-
if (nameMatch) {
|
|
51
|
-
current.name = nameMatch[1].trim();
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
const defaultMatch = line.match(/^\s+(?:default|value):\s*(.*)$/);
|
|
55
|
-
if (defaultMatch) {
|
|
56
|
-
current.defaultOrValue = defaultMatch[1].trim().replace(/^["']|["']$/g, "");
|
|
57
|
-
slots.push({ ...current });
|
|
58
|
-
current = {};
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
if (current.type) slots.push({ ...current });
|
|
62
|
-
return slots;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function readNodeMeta(filePath) {
|
|
66
|
-
try {
|
|
67
|
-
if (!fs.existsSync(filePath)) return null;
|
|
68
|
-
const raw = fs.readFileSync(filePath, "utf-8");
|
|
69
|
-
const fm = extractFrontmatter(raw);
|
|
70
|
-
return {
|
|
71
|
-
description: parseDescription(fm),
|
|
72
|
-
displayName: parseDisplayName(fm),
|
|
73
|
-
input: parseSlots(fm, "input"),
|
|
74
|
-
output: parseSlots(fm, "output"),
|
|
75
|
-
};
|
|
76
|
-
} catch {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/** 从 flow.yaml 的 instances 得到节点列表,每项 { id, label, definitionId, input, output },input/output 为 [{ type, name, defaultOrValue }] */
|
|
82
|
-
function loadFlowYamlNodes(flowDir) {
|
|
83
|
-
const flowPath = path.join(flowDir, "flow.yaml");
|
|
84
|
-
if (!fs.existsSync(flowPath)) return [];
|
|
85
|
-
try {
|
|
86
|
-
const raw = fs.readFileSync(flowPath, "utf-8");
|
|
87
|
-
const data = yaml.load(raw);
|
|
88
|
-
const instances = data?.instances && typeof data.instances === "object" ? data.instances : {};
|
|
89
|
-
return Object.entries(instances).map(([id, inst]) => {
|
|
90
|
-
const inp = Array.isArray(inst.input) ? inst.input : [];
|
|
91
|
-
const out = Array.isArray(inst.output) ? inst.output : [];
|
|
92
|
-
const input = inp.map((s) => ({
|
|
93
|
-
type: (s && s.type != null) ? String(s.type).trim() : "",
|
|
94
|
-
name: (s && s.name != null) ? String(s.name).trim() : "",
|
|
95
|
-
defaultOrValue: (s && (s.value != null || s.default != null)) ? String(s.value ?? s.default ?? "").trim() : "",
|
|
96
|
-
}));
|
|
97
|
-
const output = out.map((s) => ({
|
|
98
|
-
type: (s && s.type != null) ? String(s.type).trim() : "",
|
|
99
|
-
name: (s && s.name != null) ? String(s.name).trim() : "",
|
|
100
|
-
defaultOrValue: (s && (s.value != null || s.default != null)) ? String(s.value ?? s.default ?? "").trim() : "",
|
|
101
|
-
}));
|
|
102
|
-
return {
|
|
103
|
-
id,
|
|
104
|
-
label: (inst.label != null) ? String(inst.label) : id,
|
|
105
|
-
definitionId: (inst.definitionId != null) ? String(inst.definitionId) : id,
|
|
106
|
-
input,
|
|
107
|
-
output,
|
|
108
|
-
};
|
|
109
|
-
});
|
|
110
|
-
} catch (_) {
|
|
111
|
-
return [];
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function main() {
|
|
116
|
-
const args = process.argv.slice(2);
|
|
117
|
-
if (args.length < 2) {
|
|
118
|
-
const payload = { err_code: 1, message: { result: "Usage: agentflow apply -ai collect-nodes <workspaceRoot> <flowName> [runDir]" } };
|
|
119
|
-
console.log(JSON.stringify(payload));
|
|
120
|
-
process.exit(1);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const [workspaceRoot, flowName] = args.map((p) => path.resolve(p));
|
|
124
|
-
const nodesDirLegacy = path.join(workspaceRoot, LEGACY_NODES_DIR);
|
|
125
|
-
const nodesDirNew = path.join(workspaceRoot, PROJECT_NODES_DIR);
|
|
126
|
-
const flowDir = getFlowDir(workspaceRoot, flowName) || path.join(workspaceRoot, PIPELINES_DIR, flowName);
|
|
127
|
-
|
|
128
|
-
const out = [];
|
|
129
|
-
|
|
130
|
-
// 1. 项目级节点目录:旧 .cursor 与新 .workspace 合并(同 id 新路径优先)
|
|
131
|
-
out.push("# 节点元数据(内置 + 当前流水线)\n");
|
|
132
|
-
out.push("## 1. 内置节点元数据\n\n");
|
|
133
|
-
const projectById = new Map();
|
|
134
|
-
const mergeProjectDir = (dir) => {
|
|
135
|
-
if (!fs.existsSync(dir)) return;
|
|
136
|
-
for (const file of fs.readdirSync(dir).filter((f) => f.endsWith(".md")).sort()) {
|
|
137
|
-
projectById.set(file.replace(/\.md$/, ""), path.join(dir, file));
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
mergeProjectDir(nodesDirLegacy);
|
|
141
|
-
mergeProjectDir(nodesDirNew);
|
|
142
|
-
if (projectById.size === 0) {
|
|
143
|
-
out.push("(无项目内节点目录)\n");
|
|
144
|
-
} else {
|
|
145
|
-
for (const definitionId of [...projectById.keys()].sort()) {
|
|
146
|
-
const meta = readNodeMeta(projectById.get(definitionId));
|
|
147
|
-
if (!meta) continue;
|
|
148
|
-
out.push(`### ${definitionId}\n`);
|
|
149
|
-
out.push(`- **displayName**: ${meta.displayName || definitionId}\n`);
|
|
150
|
-
out.push(`- **description**: ${meta.description || ""}\n`);
|
|
151
|
-
out.push(`- **input** (handle: input-0, input-1, …):\n`);
|
|
152
|
-
if (meta.input.length) meta.input.forEach((s, i) => out.push(` - \`${s.name || "?"}\` (${s.type || "?"}) → input-${i}\n`));
|
|
153
|
-
else out.push(" - 无\n");
|
|
154
|
-
out.push(`- **output** (handle: output-0, output-1, …):\n`);
|
|
155
|
-
if (meta.output.length) meta.output.forEach((s, i) => out.push(` - \`${s.name || "?"}\` (${s.type || "?"}) → output-${i}\n`));
|
|
156
|
-
else out.push(" - 无\n");
|
|
157
|
-
out.push("\n");
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// 2. 当前流水线节点(来自 flow.yaml instances)
|
|
162
|
-
out.push("## 2. 当前流水线节点元数据\n\n");
|
|
163
|
-
const flowNodes = loadFlowYamlNodes(flowDir);
|
|
164
|
-
for (const node of flowNodes) {
|
|
165
|
-
const { id, label, definitionId, input: nodeInput, output: nodeOutput } = node;
|
|
166
|
-
let input = nodeInput || [];
|
|
167
|
-
let output = nodeOutput || [];
|
|
168
|
-
if (input.length === 0 && output.length === 0) {
|
|
169
|
-
const tryPaths = [
|
|
170
|
-
path.join(flowDir, "nodes", `${definitionId}.md`),
|
|
171
|
-
path.join(nodesDirNew, `${definitionId}.md`),
|
|
172
|
-
path.join(nodesDirLegacy, `${definitionId}.md`),
|
|
173
|
-
path.join(PACKAGE_BUILTIN_NODES_DIR, `${definitionId}.md`),
|
|
174
|
-
];
|
|
175
|
-
let meta = null;
|
|
176
|
-
for (const defPath of tryPaths) {
|
|
177
|
-
meta = readNodeMeta(defPath);
|
|
178
|
-
if (meta) break;
|
|
179
|
-
}
|
|
180
|
-
if (meta) {
|
|
181
|
-
input = meta.input;
|
|
182
|
-
output = meta.output;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
out.push(`### ${id}\n`);
|
|
186
|
-
out.push(`- **label**: ${label || id}\n`);
|
|
187
|
-
out.push(`- **definitionId**: ${definitionId || ""}\n`);
|
|
188
|
-
out.push(`- **input** (handle):\n`);
|
|
189
|
-
if (input.length) input.forEach((s, i) => out.push(` - \`${s.name || "?"}\` (${s.type || "?"}) → input-${i}\n`));
|
|
190
|
-
else out.push(" - 无\n");
|
|
191
|
-
out.push(`- **output** (handle):\n`);
|
|
192
|
-
if (output.length) output.forEach((s, i) => out.push(` - \`${s.name || "?"}\` (${s.type || "?"}) → output-${i}\n`));
|
|
193
|
-
else out.push(" - 无\n");
|
|
194
|
-
out.push("\n");
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
const content = out.join("");
|
|
198
|
-
|
|
199
|
-
// 优先写入 output 引脚文件(直接写文件模式)
|
|
200
|
-
const resultOutPath = args[2] ? String(args[2]).trim() : "";
|
|
201
|
-
if (resultOutPath) {
|
|
202
|
-
fs.mkdirSync(path.dirname(resultOutPath), { recursive: true });
|
|
203
|
-
fs.writeFileSync(resultOutPath, content, "utf-8");
|
|
204
|
-
} else {
|
|
205
|
-
// 兼容旧模式:通过 JSON stdout 输出
|
|
206
|
-
const payload = { err_code: 0, message: { result: content } };
|
|
207
|
-
console.log(JSON.stringify(payload));
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
main();
|