@actiondock/builder 2.11.0 → 2.12.0

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.
@@ -54,6 +54,31 @@ Playbook SOPs 为复杂业务任务提供逐步指导规程。详细规程请查
54
54
  ${list}
55
55
  `;
56
56
  }
57
+ /**
58
+ * 渲染「执行 Action」调用指引正文:三处生成器共用同一决策原则,
59
+ * 承载输入模式选择(扁平赋值与 --input-file)与输出模式选择(默认原始输出与按需 --json)。
60
+ */
61
+ function renderInvocationGuidance(describeCmd, runCmd) {
62
+ return `推荐在执行前调用 describe 命令调阅确切参数契约:
63
+
64
+ \`\`\`bash
65
+ # 调阅参数契约与建议赋值样例
66
+ ${describeCmd}
67
+
68
+ # 调用语法格式(其中 ASSIGNMENT 根据 describe 查阅的参数契约提供)
69
+ ${runCmd} -- ASSIGNMENT...
70
+ \`\`\`
71
+
72
+ 输入模式选择(三种输入模式严格互斥,仅选其一):
73
+
74
+ - 扁平赋值为默认首选:参数项少且结构简单时,直接以 \`-- key="value" count:=10\` 形式内联传递。
75
+ - 文件输入用于复杂参数:当参数含深层嵌套结构、大段文本或内容易被终端引号转义破坏时,将完整 JSON 写入文件并通过 \`--input-file input.json\` 传递。
76
+
77
+ 输出模式选择(避免浪费上下文 token):
78
+
79
+ - 默认不加 \`--json\`:stdout 直接输出业务返回正文,保留原生格式与真实换行,绝大多数调用直接阅读正文即可推进后续步骤。
80
+ - 仅在需要结构化提取时才追加 \`--json\`:如需按 \`error.code\` 判定自愈策略、以 \`runId\` 关联追踪或程序化消费完整字段时,才使用 JSON 信封输出(格式见下节)。`;
81
+ }
57
82
  /**
58
83
  * 渲染「结构化响应解析」小节:三处生成器共用同一 JSON 信封代码块,
59
84
  * 仅首行名词与 stdout/stderr 描述行随变体分化。
@@ -67,9 +92,9 @@ function renderJsonEnvelopeSection(wording, options) {
67
92
  const descriptionBlock = options?.withDescriptions === false
68
93
  ? ""
69
94
  : `\n\n${stdoutLine}\n- \`stderr\`:执行日志与诊断${stderrTail}信息。`;
70
- return `### 结构化响应解析
95
+ return `### 结构化响应解析(--json 模式)
71
96
 
72
- 所有 Action 执行结果均在 \`stdout\` 输出标准格式的 JSON ${noun}:
97
+ 仅当调用时显式追加 \`--json\` 选项,\`stdout\` 才输出标准 JSON ${noun};默认不加该选项时直接输出业务正文:
73
98
 
74
99
  \`\`\`json
75
100
  // 执行成功响应 (ok 为 true)
@@ -104,7 +129,7 @@ export function renderRuntimeReferenceContent(options) {
104
129
  \`\`\`bash
105
130
  ${options.entryRelPath || "node ./entry.mjs"} list
106
131
  ${options.entryRelPath || "node ./entry.mjs"} describe <action-id>
107
- ${options.entryRelPath || "node ./entry.mjs"} run <action-id> --json --input-file input.json
132
+ ${options.entryRelPath || "node ./entry.mjs"} run <action-id> -- ASSIGNMENT...
108
133
  \`\`\`
109
134
 
110
135
  若宿主环境已全局安装 \`ad\`,亦可将其链接后统一调度。`
@@ -214,21 +239,7 @@ ad describe ${pkgId}/${firstAction}
214
239
 
215
240
  为避免多技能之间的 Action ID 命名冲突,建议统一使用带有 Package 前缀的完全限定 ID。
216
241
 
217
- 推荐在执行前调用 describe 命令调阅确切参数契约:
218
-
219
- \`\`\`bash
220
- # 调阅参数契约与建议赋值样例
221
- ad describe ${pkgId}/${firstAction}
222
-
223
- # 调用语法格式(其中 ASSIGNMENT 根据 ad describe 查阅的参数契约提供)
224
- ad run ${pkgId}/${firstAction} --json -- ASSIGNMENT...
225
- \`\`\`
226
-
227
- 将参数写入 JSON 文件并通过 --input-file 传递:
228
-
229
- \`\`\`bash
230
- ad run ${pkgId}/${firstAction} --json --input-file input.json
231
- \`\`\`
242
+ ${renderInvocationGuidance(`ad describe ${pkgId}/${firstAction}`, `ad run ${pkgId}/${firstAction}`)}
232
243
 
233
244
  ${renderJsonEnvelopeSection("envelope")}
234
245
  ${playbookSection}
@@ -282,21 +293,7 @@ ${binaryRelPath} describe ${firstAction}
282
293
 
283
294
  ### 执行 Action
284
295
 
285
- 推荐在执行前调用 describe 命令调阅确切参数契约:
286
-
287
- \`\`\`bash
288
- # 调阅参数契约与建议赋值样例
289
- ${binaryRelPath} describe ${firstAction}
290
-
291
- # 调用语法格式(其中 ASSIGNMENT 根据 describe 查阅的参数契约提供)
292
- ${binaryRelPath} run ${firstAction} --json -- ASSIGNMENT...
293
- \`\`\`
294
-
295
- 将参数写入 JSON 文件并通过 --input-file 传递:
296
-
297
- \`\`\`bash
298
- ${binaryRelPath} run ${firstAction} --json --input-file input.json
299
- \`\`\`
296
+ ${renderInvocationGuidance(`${binaryRelPath} describe ${firstAction}`, `${binaryRelPath} run ${firstAction}`)}
300
297
 
301
298
  ${renderJsonEnvelopeSection("result")}
302
299
  ${playbookSection}
@@ -397,21 +394,7 @@ ${playbookEntries.join("\n")}
397
394
  : "";
398
395
  const sInvoke = `## 标准调用命令
399
396
 
400
- 推荐在执行前调用 describe 命令调阅确切参数契约:
401
-
402
- \`\`\`bash
403
- # 调阅参数契约与建议赋值样例
404
- ad describe ${sampleActionId}
405
-
406
- # 调用语法格式(其中 ASSIGNMENT 根据 ad describe 查阅的参数契约提供)
407
- ad run ${sampleActionId} --json -- ASSIGNMENT...
408
- \`\`\`
409
-
410
- 将参数写入 JSON 文件并通过 --input-file 传递:
411
-
412
- \`\`\`bash
413
- ad run ${sampleActionId} --json --input-file input.json
414
- \`\`\`
397
+ ${renderInvocationGuidance(`ad describe ${sampleActionId}`, `ad run ${sampleActionId}`)}
415
398
 
416
399
  ${renderJsonEnvelopeSection("envelope", { withDescriptions: false })}`;
417
400
  const sTroubleshooting = renderTroubleshootingSection(RUNTIME_REFERENCE_REL_PATH);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actiondock/builder",
3
- "version": "2.11.0",
3
+ "version": "2.12.0",
4
4
  "description": "ActionDock Build Planner, distribution packaging, and Skill exporter",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -29,8 +29,8 @@
29
29
  "test": "node ../../scripts/run-tests.ts"
30
30
  },
31
31
  "dependencies": {
32
- "@actiondock/core": "^2.11.0",
33
- "@actiondock/sdk": "^2.11.0"
32
+ "@actiondock/core": "^2.12.0",
33
+ "@actiondock/sdk": "^2.12.0"
34
34
  },
35
35
  "keywords": [
36
36
  "actiondock",