workflow-code structure
workflow-code structure 不执行 workflow。它只读取 workflow 脚本并输出结构报告,用来检查节点定义、执行顺序、参数声明、conversation 配置和 debug registry。
命令格式
参数
| 参数 | 说明 |
|---|---|
workflow-dir | workflow 项目目录。不传时使用当前目录。 |
输出结构
| 字段 | 说明 |
|---|---|
workflow | workflow 名称和基础信息。 |
definitions.nodes | 静态识别到的节点定义。 |
definitions.variables | 静态识别到的关键变量。 |
execution | 推导出的执行结构,包含 runNode、runStreamNode、runIf、runFor、runWhile、runWorkflow 和 question-classifier 分支;return workflow.runNode(...)、return workflow.runIf(...)、return workflow.runFor(...) 等返回表达式同样会纳入所属 branch/loop。 |
diagnostics | warnings、violations 和结构分析错误。 |
params | executor params 声明。 |
conversation | executor conversation 配置。 |
registry | executor registry 声明。 |
失败行为
| 情况 | 行为 |
|---|---|
| 结构分析成功 | 输出结构 JSON,退出码为 0。 |
| 发现脚本规则 violations | 输出包含 diagnostics.error 的结构 JSON,退出码为 1。 |
| workflow 文件无法加载 | 输出错误结构 JSON,退出码为 1。 |
示例
适合场景
| 场景 | 说明 |
|---|---|
| 调试 App 表单参数 | 检查 params 是否被静态识别。 |
| 调试单节点运行 | 检查 registry 中是否存在目标节点。 |
| 检查节点顺序 | 查看 execution 和 definitions.nodes。 |
| 检查条件分支 | 查看 execution 中 source: "run-if" 的 if / else-if / else 路径。 |
| 检查循环结构 | 查看 execution 中 source: "run-for" / source: "run-while" 的循环体 children、条件、items 和 maxIterations。 |
| 检查 workflow 复用 | 查看 execution 中 standardName: "run-workflow" 的子 workflow 调用节点。 |